Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: string variable problem


From   "Eric Uslaner" <[email protected]>
To   <[email protected]>
Subject   st: string variable problem
Date   Tue, 19 Jun 2007 13:45:31 -0400

Hello,

I have a string variable problem and I have looked high and low in the
manual for a solution.  One variable in a data set is composed of both
the name of a country and the year of a survey, such as:

Albania2002
Albania2005
Serbia&Montenegro2002
Serbia&Montenegro2005

I want to drop the last four digits (there is already a variable called
year).  I figured out how to drop the last four digits into another
variable with substr but cannot figure out what to do to keep the
country names (which vary in length) and drop the year.  Any help much
appreciated (and I have spent an hour on this with the manual).  You can
also respond to me directly since I get Statalist on digest.  Many
thanks.

Ric Uslaner

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index