Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: Fwd: Adding Observations to PanelDta; Number Obs Equal to Another Variable, varying for each ID
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: RE: Fwd: Adding Observations to PanelDta; Number Obs Equal to Another Variable, varying for each ID
Date
Sun, 19 Sep 2010 20:25:08 +0200
<>
Just
***********
expand NumVisit
***********
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Emma Quinn
Sent: Sonntag, 19. September 2010 20:14
To: [email protected]
Subject: st: Fwd: Adding Observations to PanelDta; Number Obs Equal to
Another Variable, varying for each ID
Hi,
I am working with panel data, and I would like to append observations
to my time series variable. However, the number of observations I
would like to add depends on the ID of the subject and is equal to
another variable in my dataset; the number of appointments they have
made. The appointments for each would be made on two-month intervals
following the starting date--the time variable. I would like to add 2
month intervals for each ID; however the number of 2 month intervals I
add depends on how many visits they ended up making.
For example if :
ID Panel Var Time Var NumVisit
1 2 3/6/2004 12
2 8 3/7/2004 8
3 3 8/7/2005 6
then for ID 3, I would like to generate the date variable 10/7/2005,
12/7/2005, 2/7/2005, 4/7/2005, 6/7/2005 and 8/7/2005.
I tried to tsappend add(), after defining a local macro x = NumVisit
and again as local macro 4 = NumVisit but they didn't work; the
command would not recognize 'x' or '4' as a positive integer.
Alternatively, my time variable corresponds to the "start date" of the
study. I have another date variable that corresponds to the "end
date"--the last visit made. If any one knew how to generate two month
intervals between the two dates, where the start and end date are
different for each ID, that would be much appreciated.
Much appreciated!
*
* 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/