Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: reshape to keep single age range and multiple years
From
Scott Merryman <[email protected]>
To
[email protected]
Subject
Re: st: reshape to keep single age range and multiple years
Date
Thu, 22 Nov 2012 12:26:44 -0600
drop id
reshape wide count , i(yy) j(age)
Scott
On Thu, Nov 22, 2012 at 11:16 AM, Tim Evans <[email protected]> wrote:
> Hi all,
>
> I'm using Stata 11.2 and I've collapsed an individual data set so that I have year, counts of tumours and age at diagnosis. I have multiple years of diagnosis, with single year of age starting from 16 - 100+.
>
> The data look like this:
>
> id yydx count age_at_diag
> 1 1998 1 22
> 2 1998 1 25
> 3 1998 2 26
> 4 1998 4 27
> 5 1998 2 29
> 6 1998 1 31
> 7 1998 2 32
> 8 1998 1 33
> 9 1998 1 35
> 10 1998 2 36
> 11 1998 3 37
> 12 1998 1 38
> 13 1998 9 39
> 14 1998 4 40
> 15 1998 6 41
> 16 1998 8 42
> 17 1998 5 43
> 18 1998 8 44
> 19 1998 10 45
> 20 1998 10 46
> 21 1998 20 47
> 22 1998 23 48
> 23 1998 17 49
> 24 1998 25 50
> 25 1998 31 51
> 26 1998 26 52
> 27 1998 37 53
>
>
> The data continue so that yydx continues until 2010.
>
> What I would like to do and am having trouble doing, is reshape the data so that I have year running down the dataset and age at diag running across the data set like thus
>
> 16 17 18 19 and so on
> 1999 5 0 14
> 1999 1 2 21
> 2000 3 1 19
>
> Does anyone have any suggestions please?
>
> Best wishes
>
> Tim
>
>
>
> _DISCLAIMER:
> This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/