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

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


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

Pete,

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.

Ada Ma
Department of Economics
University of Aberdeen, Scotland
[email protected]

----- Original Message -----
From: "Lassen, Peter, pla" <[email protected]>
To: <[email protected]>
Sent: Sunday, January 19, 2003 12:52 PM
Subject: st: collapse, split, generate new variables???


> Hi
>
> I have a dataset where each person is represented by several cases,
varying from 2 to 17. The reason why a person have more than one hit is a
education variable (string) containing all educations attended in a lifetime
for each person.
>
> Now I want to examine whether men and women attend the same courses
equally - Therefore I need to "collapse or spilt?" the educational variable
into several (17) new (dummy)variables, so each person is only represented
once.
> How on earth do I manage that??
>
> Best regards
> Pete
*
*   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