Statalist


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

st: Creating new variables from variable values


From   "Eric Uslaner" <[email protected]>
To   <[email protected]>
Subject   st: Creating new variables from variable values
Date   Mon, 29 Dec 2008 15:55:11 -0500

Hi,

I have a data set (European Social Survey) with several variables indicating the respondents' and parents' country of birth.  The values for these string variables (which I know that I can convert) are mostly letters (some are numbers and I am not sure what they mean but I can set them to missing).  There is no value label.

The ESS uses a common letter system for countries (ISO 3166-1) and I have copied them into a Stata file by country.  What I want to do is to edit that file and assign values by groups of countries (e.g., Nordic countries, English speaking countries, etc.) to get groups that fit a theoretical pattern (don't worry about this).  The next step would be to sort by these numerical value labels  (or values for a new variable to create new variables such as born in Nordic countries, born in English speaking countries, born in transition countries, etc.  

Now I know that I can do this by hand (e.g., gen bornsoutherneurope if cntbrtha == ES | cntbrtha == GR etc).  But this would be a rather long and tedious process.  Is there any way to take the country codes (now in a file with country name--which can be deleted and with a region code that I could add) and create new variables from it?

Thanks,

Ric




*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index