Statalist


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

Re: st: Creating new variables from variable values


From   "Martin Weiss" <[email protected]>
To   [email protected]
Subject   Re: st: Creating new variables from variable values
Date   Mon, 29 Dec 2008 22:10:05 +0100

Your problem is a little hazy to me, and it would be good if you could provide a little example. I have often found -ssc d descsave- useful for extraction purposes...

HTH
Martin
-------- Original-Nachricht --------
> Datum: Mon, 29 Dec 2008 15:55:11 -0500
> Von: "Eric Uslaner" <[email protected]>
> An: [email protected]
> Betreff: st: Creating new variables from variable values

> 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/

-- 
Martin Weiss
Hackersteigle 3
72076 Tübingen
00497071/793535
00491784597218

Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a
*
*   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