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

Re: st: Creating new variables from variable values

From   "Martin Weiss" <>
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...

-------- Original-Nachricht --------
> Datum: Mon, 29 Dec 2008 15:55:11 -0500
> Von: "Eric Uslaner" <>
> An:
> 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:
> *
> *
> *

Martin Weiss
Hackersteigle 3
72076 Tübingen

Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!*
*   For searches and help try:

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