summarize dx??1
to see which of the days, months, years variables are
out of range.
Anyway, why are you doing it this way? Only a few days ago
a thread you started thrashed out the fact that -todate- from SSC
should be able to do it in one line.
todate datedx, pattern(yyyymmdd) format(%d) gen(datedx1)
Nick
[email protected]
Michael McCulloch
> I've converted a string date (yyyymmdd) to Stata format, using:
>
> . * convert datedx to Stata format
> . tostring datedx, replace
> datedx was double now str8
> . generate str4 dxyr1= substr(datedx,1,4)
> . generate str2 dxmo1 = substr(datedx,5,6)
> . generate str2 dxda1 = substr(datedx,7,8)
> . destring dx*, replace
> dxyr1 has all characters numeric; replaced as int
> dxmo1 has all characters numeric; replaced as byte
> dxda1 has all characters numeric; replaced as byte
> . gen datedx1 = mdy(dxmo1, dxda1, dxyr1)
> (387 missing values generated)
> . format datedx1 %d
>
> However, search for missing values before & after my commands
> yields nothing:
> . list datedx if missing(datedx) in 1/10
>
> Where might the missing 387 values have originated?
*
* 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/