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

Re: st: Another resphaping problem


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: Another resphaping problem
Date   Fri, 15 Apr 2005 22:36:55 +0200

Sascha,
 
No, it is not ridiculous - but it is solvable.
Each pair of observations must have an unique id, 
and if your data are as regular as claimed, 
you can create the id by:
   generate id=int((_n+1.1)/2)

Adding 1.1 instead of 1 makes sure that rounding
errors don't mess things up. It goes like this:
 
   clear
   input group var strategy
   1 11 0
   1 12 1
   1 13 0
   1 14 1
   2 15 0
   2 16 1
   end
   generate id=int((_n+1.1)/2)
   reshape wide var , i(id group) j(strategy)
   list

Isn't that what you wanted?
 
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, work:  +45 8942 6090 
Phone, home:  +45 8693 7796 
Fax:          +45 8613 1580 
E-mail:       [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