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

Re: st: reshape command


From   "Neil Shephard" <mdeasnds@fs1.ser.man.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: reshape command
Date   Wed, 9 Apr 2003 09:33:53 +0100

Alvine wrote: 
> I'm using the -reshape- command to convert data from long to wide
> 
> My data are:
> 
> No patient	Période	P créat	PCAt
> 1	             0	            75.0	           2.31
> 2	             0                 74               2.29
> 3	             0	           101.8   	  2.31
> 1	             1	            108.9	  2.32
> 2	             1	             91.9	           2.23
> 3	             1	            78.1      	 2.25
> 1	             2	            75.0	           2.25
> 2	             2	            95.0	           2.23
> 3	             2	            86.0	           2.21
> 
> -reshape wide Pcreat Pcat , i (No patient) j(Période)-
> 
> gives:
> 
> No patient	Pcreat0    Pcat0   Pcreat1    Pcat1   Pcreat2    Pcat2
> 1
> 2
> 3
> 
> Is there an option to obtain data like this:
> 
> No patient	Pcreat0    Pcreat1  Pcreat2   Pcat0       Pcat1       Pcat2
> 1
> 2
> 3

After the reshape command you can use the -order- command to 
change the order of your variables, in this instance

order "No patient" Pcreat0 Pcreat1 Pcreat2 Pcat0 Pcat1 Pcat2

hope that helps,

Neil

Neil Shephard
Genetics Statistician
ARC Epidemiology Unit, University of Manchester
neil.shephard@man.ac.uk
neil.shephard@mindless.com

"Contrariwise, if it was so, it might be; and if it
were so it would be; but as it isn't, it ain't. That's
logic" - Tweedledee (Alice Through the Looking Glass)

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index