Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Data reshape


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: Data reshape
Date   Wed, 8 Feb 2006 17:05:10 -0000

reshape wide DATA, i(id YEAR) j(VARIABLES_CODE) string

will give you what you want except for variable names (which will be
DATAWCO2999, DATAWCO3351 etc). The package -renvars- (type -findit
renvars-) will help you sort these out quickly.

David

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nuno Soares
Sent: 08 February 2006 16:49
To: [email protected]
Subject: st: Data reshape

Hi everyone,

I need to manage some data that is in the following long form:

id	NAME	VARIABLES_CODE	DATA		YEAR
1241	A	WC02999		394500	1990
1241	A	WC03351		264100	1990
1241	A	WC03255		78600		1990
1638	B	WC02999		232700	1990
1638	B	WC03351		79400		1990
1638	B	WC03255		0		1990
1917	C	WC02999		44595		1991
1917	C	WC03351		28399		1991
1917	C	WC03255		17506		1991
1241	A	WC02999		394500	1991
1241	A	WC03351		264100	1991
1241	A	WC03255		78600		1991


I need to put it in the following form:


id	NAME	WC02999	WC03351	WC03255	YEAR
1241	A	394500	264100	7860		1990
1638	B	232700	79400		0		1990
1917	C	44595		28399		17506		1991
1241	A	394500	264100	7860		1991

Does anyone know a way of doing this? I've tried the reshape function
but can't put it this way... I' also tried to break the file into
several files according to the year of each observation but the problem
persists...
Thanks for any help!

Cheers,

Nuno

*
*   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/

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

*
*   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