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

Re: st: changing the structure of a data set


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: changing the structure of a data set
Date   Tue, 9 Aug 2005 14:07:09 +0200

Barbara Hofmann,

You want to restructure a dataset in wide format to long format. It goes
like this, using -reshape-:

----------------------------------
clear
input var1 v1991 v1992 v1993
15   	8.58	8.76	9.53
16	1.01	.91	.9
17	.89	.75	.72
18	.39	.3	.3
19	.28	.23	.16
20	.52	.5	.6
21	.65	.56	.58
22	.89	1.07	.9
end

reshape long v , i(var1) j(year)
sort year var1
list
------------------------------------

Hope this helps
Svend

__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: [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