Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Basic Numeric to String Recoding


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Basic Numeric to String Recoding
Date   Mon, 6 Sep 2010 23:21:08 +0200

<>

You want to take a look at
http://www.stata-journal.com/sjpdf.html?articlenum=dm0009



HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Benhoen2
Sent: Montag, 6. September 2010 23:17
To: statalist@hsphsun2.harvard.edu
Subject: st: Basic Numeric to String Recoding

I am a new user - please forgive me.

I have a list of numeric IDs for states (stateid) with abbreviated labels
attached (stname). I would like to create a new string variable made us of
the unabbreviated state names but based on the stateid variable.

I have tried the following: 
1) recode stateid (1="Alabama"), (2="Arkansas"), ..., generate(statename)
2) recode stateid (1="Alabama"), (2="Arkansas"), ..., strgen(statename)
3) generate state="Alabama" if stateid=1

among other nonsensical permutations.  Is there any way to do this using
recode, or something analogous?

I suspect the answer is very simple but I have not been able to figure it
out.  Any help?

Ben


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index