VISINTAINER PAUL
Quick question.
I have a numeric variable (float) of the form: 19460515
The variable actually refers to the date, May 15, 1946. Truncating
and
concatenating functions appear to operate only on string variables.
What
approach can I use to change this to the correct date?
>>>
Manual discussion: [U] p.287
FAQ discussion:
How do I convert date variables into Stata elapsed dates when
the numbers run together, like 4151999?
http://www.stata.com/support/faqs/data/dateseq.html
First principles approach:
. gen year = real(substr(string(date),1,4))
. gen month = real(substr(string(date),5,2))
. gen day = real(substr(string(date),7,2)
etc.
Canned solution:
. ssc inst todate
. todate date, p(yyyymmdd) g(sdate)
Recommendation: use the resources available.
Nick
[email protected]
*
* 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/