Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: need help with summarizing data


From   Cory Smith <corybsmith@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: need help with summarizing data
Date   Sun, 10 Feb 2013 15:02:56 -0500

You could collapse the data by name, dt, and procedure and use the
collapse to count the number of occurrences. Then you could reshape it
to a wide format to produce a table like what you've described.

On Sun, Feb 10, 2013 at 2:54 PM, Michael Stewart
<michaelstewartresearch@gmail.com> wrote:
> Hi,
> I am trying to find if there is a betterquicker way to do what I am doing
>
> My data is as follows
>
> id      name    dt      procedure
> 1       xxx     2000    eyesurgery
> 1       xxxx    2001    eyesurgery
> 1       xxxx    2002    hernia
> 1       xxxx    2009    hernia
> 2       yyy     2010    hernia
> 2       yyy     2011    cardiacsurgery
> 2       yyy     2012    eyesurgery
> 2       yyy     2012    eyesurgery
>
> I am interested in making a excel file or  a stata dataset as follows for
>
> id      name    eyesurgery_2000 eyesurgery_2001.......eyesyrgery2012
> 1       xxxx            1               1               0
> 2       yyyy            0               0               2
>
> I use tabulate, copy it into excel file (use import wizard) and then
> import into stata
> Is there a quicker way??
>
> --
> Thank you ,
> Yours Sincerely,
> Mike.
> *
> *   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index