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

From |
Phil Schumm <pschumm@uchicago.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: from value to varnames |

Date |
Mon, 18 May 2009 16:05:01 -0500 |

On May 18, 2009, at 3:40 PM, Richard Goldstein wrote:

I have a data set with 3 variables: field, cat, order; there are 258observationsI want the 258 observations in field to be 258 variables where thename of the value in field becomes the new variable name; I want tokeep the associated values of the other two fieldsFor example, say that the first observation has the following values: field cat order namea A 1I want a new set of variables such that I have a variable called"namea" and I still have cat (of "A") and order (of "1") -- butremember that I should now have 258 variables--cat and order can bejoined as the value for each variable; thus, for the example above,the first variable (namea) would now have the value "A1"

gen value = cat + string(order) keep field value sxpose, clear force firstnames -- Phil * * 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/

**Follow-Ups**:**Re: st: from value to varnames***From:*Richard Goldstein <richgold@ix.netcom.com>

**References**:**st: from value to varnames***From:*Richard Goldstein <richgold@ix.netcom.com>

- Prev by Date:
**st: AW: Aggregate and Microdata** - Next by Date:
**st: F-statistic using Newey** - Previous by thread:
**st: AW: from value to varnames** - Next by thread:
**Re: st: from value to varnames** - Index(es):

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