> -----Original Message-----
> From: VISINTAINER PAUL [mailto:[email protected]]
> Sent: Thursday, August 15, 2002 12:13 PM
> To: '[email protected]'
> Subject: st: Splitting a numeric variable
>
> 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?
>
> Thanks.
>
> Paul visintainer
Assuming the variable is called datevar:
gen year = int(datevar/10000)
gen month = int((datevar-year*10000)/100)
gen day = datevar-year*10000-month*100
gen newdate=mdy(month,day,year)
format newdate %d
Nick Winter
*
* 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/