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

RE: st: reshape command


From   BISSERY Alvine <[email protected]>
To   [email protected]
Subject   RE: st: reshape command
Date   Wed, 09 Apr 2003 10:53:53 +0200

Thank you, it works perfectly !

-----Message d'origine-----
De: Neil Shephard [mailto:[email protected]]
Date: mercredi 9 avril 2003 10:34
�: [email protected]
Objet: Re: st: reshape command


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
[email protected]
[email protected]

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

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