thsnks nick
will play with this, sorry re terminology, normally do data manip in spss, but in this instance need parallel 'syntax' in both spss and stata (have managed the first three syntax files, and the counting variables are the final ) before analysis
just a quick question
in spss can stack two data sets with an identid-ier 1 and 2, have a count variable on some events but only in the the section of the file (coded 1) and after the procedure (in this case poisson regression) , the coefficients are assigned to the other section of the data set, is this possible in stata, or do you run againgst data set a and then use the predict against dataset 2 (as two seperate data sets)
if you do not feel that it is appropriate to answer please ignore and i will test this out tomorrow
thanks again
ann
Ann E Fitzmaurice
Medical Statistician
Immpact ,University of Aberdeen
Health Sciences Building
Foresterhill
Aberdeen, AB25 2ZD
Scotland
Tel: +44 (0)1224 553876
Fax: +44 (0)1224 555704
Email: <mailto:[email protected] <mailto:[email protected]> > [email protected]
________________________________
From: [email protected] on behalf of Nick Cox
Sent: Wed 04/07/2007 20:36
To: [email protected]
Subject: st: RE: adding count variables
Whether or not this is quite your problem, this may help.
-collapse- and -contract- are not advisable here, as they
lead to reduced datasets. I guess that you want these characteristics
stored with the individual-level observations.
Suppose you have
familyid personid alive (1: alive, 0: dead)
1 1 0
1 2 0
1 3 0
1 4 1
1 5 1
1 6 1
2 7 0
2 8 0
2 9 1
2 10 1
2 11 1
3 12 1
3 13 1
3 14 1
3 15 1
The number of dead people in each family is
egen n_dead = total(alive == 0), by(familyid)
The number of alive people in each family is
egen n_alive = total(alive == 1), by(familyid)
In addition, use of Stata terminology is advisable
on Statalist. "case" means "observation" in Stata.
Nick
[email protected]
Ann E Fitzmaurice
> Have a data set with approx 22500 cases from n families, i
> want to create a
> variable wuich is the number of family members in each
> family, variable
> identification is caseid. The data set includes a second
> variable denoting
> the status of the person , either alive or dead
>
> What I want to do is to put a variable in the file which
> denotes the number
> within a family for the dead people, for example if there are
> six siblings,
> and 3 are dead , then the first variable will gave a 6 next
> to each member
> and a 3 against each member denoting the number dead within a family
>
> From her it is straight forward to calculate the number of
> siblings within a
> family still alive and then make an adjustment to the number
> of women alive
> to reflect that there has been a death in the family
>
> Can anyone suggest how this might be done
>
> I have looked at collapse , and calculated the total within
> the family using
> _N
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
<<winmail.dat>>