Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73269

Odd dates

$
0
0
I have data-set in a stata file. The data has a columns with date of births and a school joining dates of individuals.

Date format is the following -

1965-11-24 00:00:00
1964-07-15 00:00:00

Variable is 'str19' & Format '%19s'



I have to do some addition subtraction of the dates on two columns. Since the current format is string and additional/subtraction is not possible, I converted the dates to numeric format using this command:

gen NUM_DOB = date( dob , "YMD#"),

This gave me a 5 digit numeric with Type 'float' and format '%9.0g'


However, some of the dates are weird in the dataset e.g.

dob
2049-10-08 00:00:00
2049-11-24 00:00:00

I checked with the data provider and he informed that dates are correct, stata format is giving issues to me. For example, for 2049-10-08 00:00:00 actual date is 7 Oct 1989.

How do I change the format of these unreal dates to the numeric which translate into the 'real' dates.

Thanks!
guneet



Viewing all articles
Browse latest Browse all 73269

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>