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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: AW: Reshaping question


From   Anders Gaarsdal Holst <anders@kanten.dk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: AW: Reshaping question
Date   Mon, 22 Feb 2010 13:45:11 +0100

The collapse (max) command was just what I was looking for. Thank you very
much Martin.

Sincere regards,
Anders Gaarsdal Holst
MD, Research Fellow
Department of Cardiology, B2142
University Hospital Rigshospitalet
Blegdamsvej 9
2100 Copenhagen

Phone: +45 35450639
Email: anders@kanten.dk


On Fri, Feb 19, 2010 at 4:05 PM, Martin Weiss <martin.weiss1@gmx.de> wrote:

>
> <>
>
> If the id has one or more antibio==1, then the maximum of antibio must be
> 1:
>
>
> *************
> clear*
> set obs 5
> set seed 1001
>
> gen byte id=_n
> expand 4
> gen byte antibio=runiform()<.1
> sort id
> list, noo sepby(id)
>
> collapse (max) antibio, by(id)
>
> list, noo
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Anders
> Gaarsdal
> Holst
> Gesendet: Freitag, 19. Februar 2010 16:02
> An: statalist@hsphsun2.harvard.edu
> Betreff: st: Reshaping question
>
> Dear Statalist,
>
> I have a multiple observations per (person) id dataset and a boolean
> variable of interest "antibio". I would like to reshape this into a a
> single observation per id dataset with a boolean variable indicating
> whether the id has one or more observation with antiobio==1.
>
> This is probably an easy task, but I cannot seem to find the right command.
>
> Sincere regards,
> Anders Gaarsdal Holst
> MD, Research Fellow
> Department of Cardiology, B2142
> University Hospital Rigshospitalet
> Blegdamsvej 9
> 2100 Copenhagen
>
> Phone: +45 35450639
> Email: anders@kanten.dk
> *
> *   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/
>
>
> *
> *   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/
>
*
*   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/


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