Something like this?
clear
input id month temp
1 0 50
1 0 55
1 0 60
1 3 20
1 3 22
1 3 33
1 6 12
1 6 12
1 6 11
2 0 50
2 0 55
2 0 60
2 3 20
2 3 22
2 3 33
end
bys id month: gen foo = _n
reshape wide temp, j( month) i(id foo)
drop foo
l, sepby(id)
Scott
On Thu, Oct 15, 2009 at 6:43 PM, Tina Hernandez-Boussard
<[email protected]> wrote:
> Hi All,,
>
> I am trying to reshape some data from long to wide form
>
> I have an id, temperature and a timepoint. However, id and timepoint are
> not unique, so I have ~1000 temperature readings for every time point for
> every id.
>
> The data's current format
> id month temp
> -----------------------
> 1 0 50
> 1 0 55
> 1 0 60
> 1 3 20
> 1 3 22
> 1 3 33
>
> How I want the data
>
> id temp0 temp3 temp6
> -----------------------
> 1 50 20 12
> 1 55 22 12
> 1 60 . 11
> 1 55 20 12
> 1 . 33 12
> 3 52 20 15
>
>
> Any help with the command? When I use reshape wide temp, i(name )
> j(op_time ) i get the error
>
> op_time not unique within name;
>
>
> Thanks,
>
> Tina
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/