Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: collapse, split, generate new variables???


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: collapse, split, generate new variables???
Date   Sun, 19 Jan 2003 18:37:56 -0000

Ada Ma
> 
> Could you cut and paste a few lines of your data set in 
> here?  It's a bit
> hard to guess how your dataset is like from the description.
> 
> My guess is that the structure of your data is something like:
> 
> i.d.            education
> A            diploma
> A            degree
> A            MBA
> A            master
> B            diploma
> B            higher diploma
> B            master
> B            MBA
> B            PhD
> 
> So person A may have his MBA recorded in case 3, but person 
> B's is recorded
> in case 4.
> 
> I think the only way is to gen dummies for each type of education
> attainment, save them in separate files, then merge them 
> back together
> again.
> (If anyone knows of smarter ways to do it please let me know!!)
> 
> IF my guess regarding the structure of your data is 
> incorrect.  If, say,
> e.g. everybody who has done a degree in engineering has 
> case 6 equals to 1,
> then you can use the -reshape- command.
 
This is not the only way to do it. Please 
see my earlier posting and especially the 
reference to the FAQ on multiple responses. 

A -reshape- to wide permits doing this in general
in place without any recourse to any files. 

At worst, you need to map to integers with labels 
first. 

Nick 
[email protected] 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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