Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Seok-Woo Kwon <kwonsw@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: data transformation |

Date |
Sun, 3 Mar 2013 20:41:04 -0500 |

Dear all: I do not know how to describe my problem in general terms. So let me use an example to describe it. (I am using Stata 12 for Windows.) I have about 10,000 observations and 1,000 variables on individuals, but 4 observations and 3 variables will be enough to show the problem. My data looks like this: id X Y Z ----------------------- 001 1 2 X 002 2 3 Y 003 3 5 2 004 4 6 Y ----------------------- I need data that looks like this: id X Y Z Z_transformed -------------------------------------------- 001 1 2 X 1 002 2 3 Y 3 003 3 5 2 2 004 4 6 Y 6 -------------------------------------------- That is, some values in the variable "Z" will be a variable name (like "X" or "Y"). I would like to transform that variable into a value of that variable for the observation. For example, the value of Z for id 001 is X. Instead of X, I would like to show the value of X for id oo1 (which is 1). Is there a way to program this in Stata? Thank you. Seok-Woo Kwon * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: data transformation***From:*Nick Cox <njcoxstata@gmail.com>

**st: Re: data transformation***From:*"Joseph Coveney" <stajc2@gmail.com>

- Prev by Date:
**Re: st: error message about bootstrp** - Next by Date:
**st: Re: data transformation** - Previous by thread:
**st: error message about bootstrp** - Next by thread:
**st: Re: data transformation** - Index(es):