<>
BTW, here are three canonical references (in no particular order), as these
probs crop up quite frequently:
http://www.stata.com/support/faqs/data/#manip
Nick`s
http://www.stata-journal.com/sjpdf.html?articlenum=pr0004
and, on the notion of a "function" in Stata, Nick`s
http://www.stata-journal.com/sjpdf.html?articlenum=pr0007
They are all freely available to everybody with an internet connection :-)
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von MAY BAYDOUN
Gesendet: Montag, 13. April 2009 21:59
An: [email protected]
Betreff: st: Data management question for survival analysis problem
Dear Statalisters,
I am trying to do the following so I can run survival analysis using a
person-period file. I have data with id and visits and each visit is related
to a particular which is the time variable. I have a variable that changes
over visits and has a cutpoint at 16. I changed this variable from
continuous to binary (<=16:0 and >16: 1). Now, I want to create a
time-dependent variable, in such a way that if someone is zero for all
visits, he/she is zero. If they become "1" at a visit, they are 1 in
subsequent visits unless they score another "1" in which case, they become a
"2". I don't want to have missing values for this new variable. What is the
easiest way to do this? Below is an example:
ID VI AGE CONTVAR BINVAR TDVAR
1 1 60 . . .
1 2 62 . . .
1 3 66 12 0 0
1 4 67 14 0 0
1 5 72 17 1 1
2 1 etc. 20 1 1
2 2 . . 1
2 3 12 0 1
3 1 22 1 1
3 2 12 0 1
3 3 16 0 1
3 4 18 1 2
3 5 19 1 3
4 1 22 1 1
4 2 24 1 2
4 3 25 1 3
Thanks for any help you can provide.
Sincerely yours,
May
May Baydoun, PhD in Epidemiology (UNC-Chapel Hill) Staff Scientist,
National Institute on Aging, NIH/IRP, Biomedical Research Center,
Baltimore, MD
*
* 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/