John,
how about this (assuming that var1 and var2 are constant within ID):
ren code j_var
ren value code
reshape wide code, i(ID) j(j_var)
kind regards,
Sebastian
On 4/19/06, Rijo John <[email protected]> wrote:
> hi all,
>
> can anyone help me reshape my data in the following way?
>
> Currently my data is in the following format:
>
> ID code value var1 var2
> 1 110 10 5 8
> 1 111 30 5 8
> 1 115 25 5 8
> 2 110 28 3 6
> 2 111 21 3 6
> 3 115 32 7 6
> 4 110 23 9 4
> 4 111 45 9 4
> 4 115 65 9 4
>
> and I want to convert it into
>
> ID code110 code111 code115 var1 var2
> 1 10 30 25 5 8
> 2 28 21 . 3 6
> 3 . . 32 7 6
> 4 . 45 65 9 4
>
> The codes reshaped from long to wide format and the values for each
> codes are taken from the variable "value". Hence the variable "value"
> disappears and new variables "code110 code111 code115" appears. var1
> and var2 are same for each codes in a particular ID.
>
> I am not able to figure out how to reshape it.
>
> Regards,
> John.
>
> *
> * 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/
>
--
- Seb F Buechte
-
- Stay tuned!
*
* 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/