<>
Yes, our posts must have crossed during transmission.
HTH
Martin
-------- Original-Nachricht --------
> Datum: Mon, 28 Dec 2009 08:21:19 -0800 (PST)
> Von: Nikolaos Pandis <[email protected]>
> An: [email protected]
> Betreff: Re: st: Ungroup grouped data
> Dear Martin,
> I did some changes on var names and forgot to drop the counts var (you had
> drop c*) and focused on this var while failing to focus on the outcome
> var.
> Fantastic all around!
> Thank you,
> Nick
> --- On Mon, 12/28/09, Martin Weiss <[email protected]> wrote:
>
> > From: Martin Weiss <[email protected]>
> > Subject: Re: st: Ungroup grouped data
> > To: [email protected]
> > Date: Monday, December 28, 2009, 6:15 PM
> > <>
> >
> > Not sure what you mean. You can omit the -label- stuff if
> > you want to see "0" and "1" for presence or absence of the
> > outcome :-)
> >
> >
> > HTH
> > Martin
> > -------- Original-Nachricht --------
> > > Datum: Mon, 28 Dec 2009 08:08:26 -0800 (PST)
> > > Von: Nikolaos Pandis <[email protected]>
> > > An: [email protected]
> > > Betreff: Re: st: Ungroup grouped data
> >
> > > Dear Martin,
> > >
> > > Many thanks, this was great!
> > >
> > > The counts variable shows the original count for every
> > row of covariate
> > > (var1 and var2) pattern. How could I change this to
> > show only 0 or 1
> > > depending on absence or presence of the outcome?
> > >
> > > For example for covariate pattern 00 we have 7 cases
> > from which we have 4
> > > individuals with the outcome and 3 without. I would
> > like each row to show 0
> > > or 1, in other words for the covariate pattern 00
> > there should be 4 rows
> > > of 1 and 3 of zero value instead of having the value 4
> > for all rows for this
> > > covariate pattern.
> > > I hope I am clear.
> > > Again, many thanks and happy New year.
> > > Nick
> > >
> > > --- On Mon, 12/28/09, Martin Weiss <[email protected]>
> > wrote:
> > >
> > > > From: Martin Weiss <[email protected]>
> > > > Subject: Re: st: Ungroup grouped data
> > > > To: [email protected]
> > > > Date: Monday, December 28, 2009, 5:49 PM
> > > > <>
> > > >
> > > > Here is a reasonably short solution for you! Have
> > a happy
> > > > new year :-)
> > > >
> > > > ***
> > > > clear*
> > > >
> > > > inp byte(counts cases var1 var2)
> > > > 1 1 0
> > > > 2
> > > > 2 2 1
> > > > 2
> > > > 4 7 0
> > > > 0
> > > > 4 12
> > > > 1 1
> > > > 1 3 2
> > > > 2
> > > > 2 7 1
> > > > 0
> > > > 0 2 2
> > > > 0
> > > > 0 13
> > > > 2 1
> > > > end
> > > >
> > > > //to 47 cases
> > > > expand cases
> > > >
> > > > //outcome must be assigned separately
> > > > bys var*: gen byte outcome=inrange(_n,1,counts)
> > > > la def mylabel 0 "outcome not observed" 1
> > "outcome
> > > > observed"
> > > > la val outcome mylabel
> > > >
> > > > //get rid of "counts" and "cases"
> > > > drop c*
> > > >
> > > > li, noo sepby(var*)
> > > >
> > > > ***
> > > >
> > > >
> > > > HTH
> > > > Martin
> > > > -------- Original-Nachricht --------
> > > > > Datum: Mon, 28 Dec 2009 07:37:57 -0800
> > (PST)
> > > > > Von: Nikolaos Pandis <[email protected]>
> > > > > An: [email protected]
> > > > > CC: [email protected]
> > > > > Betreff: st: Ungroup grouped data
> > > >
> > > > > Hi to all,
> > > > >
> > > > > I have the dataset below which I would like
> > to expand
> > > > and list each
> > > > > observation in one row.
> > > > >
> > > > > The counts variable shows the number of
> > individuals
> > > > with the outcome.
> > > > > The cases variable shows the number of
> > individuals
> > > > that share the
> > > > > covariate pattern for the variables var1 and
> > var2.
> > > > > The sum of cases (47) shows the total number
> > of
> > > > exposed individuals and
> > > > > the sum of counts (14) shows the total
> > number of
> > > > individuals,from the
> > > > > exposed, with the outcome.
> > > > >
> > > > > The fully expanded dataset should list 47
> > observations
> > > > (=sum of cases).
> > > > >
> > > > > counts cases
> > > > var1 var2
> > > > > 1 1
> > > > 0 2
> > > > > 2 2
> > > > 1 2
> > > > > 4 7
> > > > 0 0
> > > > > 4 12
> > > > 1 1
> > > > > 1 3
> > > > 2 2
> > > > > 2 7
> > > > 1 0
> > > > > 0 2
> > > > 2 0
> > > > > 0 13
> > > > 2 1
> > > > >
> > > > > Your help would be appreciated.
> > > > >
> > > > > Best wishes,
> > > > >
> > > > > Nick
> > > > >
> > > > >
> > > > >
> > > > > *
> > > > > * 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/
> > > >
> > > > --
> > > > Preisknaller: GMX DSL Flatrate für nur 16,99
> > Euro/mtl.!
> > > > http://portal.gmx.net/de/go/dsl02
> > > > *
> > > > * 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/
> >
> > --
> > Preisknaller: GMX DSL Flatrate für nur 16,99 Euro/mtl.!
> > http://portal.gmx.net/de/go/dsl02
> > *
> > * 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/
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
*
* 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/