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: Fwd: Creating date variables using loops
From
Lars Folkestad <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Fwd: Creating date variables using loops
Date
Thu, 4 Oct 2012 12:18:33 +0200
> Morning List
>
> I have a dataset containing id startdate stopdate but want to create 1 variable for every day inbetween. The duration is not The same pr id.
>
> I thought that since i increase by one unit (=1day) each time it would be easily done using a loop. I have not used loops before and need coding help:
>
> foreach var in id startdate stopdate {
> gen `day'= but what to write here seening i want The number of variables from start till stop.
>
> Mvh
> Lars Folkestad
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/