|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: using reshape / xpose
From
"Michael Blasnik" <[email protected]>
To
<[email protected]>
Subject
st: Re: using reshape / xpose
Date
Mon, 11 Dec 2006 12:46:17 -0500
Did you read -help reshape- ?
This may do what you want -- but you may run into limits on # variables if
you don't have at least Stata/SE.
reshape wide v3, i(ID) j(v2) string
renpfix v3
The second line drops the v3 prefix from the created variables. You may
need to rename v3 first if other variables have the same starting 2
characters (e.g., if you have a v30 in your dataset)
Michael Blasnik
----- Original Message -----
From: "Mingfeng Lin" <[email protected]>
To: <[email protected]>
Sent: Monday, December 11, 2006 12:21 PM
Subject: st: using reshape / xpose
This might actually be a very simple question but I still couldn't
figure out after I tried the reference and the Statalist archive. I
have a dataset that looks like this:
ID v2 v3
1 abc 99
1 dce 812
1 kdje 282
2 abc 33
2 dce 221
2 kdje 772
....
And I am trying to change it into this format:
ID abc dce kdje
1 99 812 282
2 33 221 772
....
There are over 1000 variables for each ID (those like abc, dce, kdje
in the example above), and I would really like to keep the original
variable names. I also tried -xpose-, but then the variable names
(like abc, dce, kdje) became missing in the new dataset. Is there a
quick way to do this?
*
* 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 |