Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: MM/DD/YYYY string to stata date

From   Lars Folkestad <>
To   "" <>
Subject   st: MM/DD/YYYY string to stata date
Date   Mon, 4 Jun 2012 21:36:15 +0200

Dear list

I know this is an old timer but i just dont get it.

I have a variable indicating birth date. The variable is in string format and looks like this


If the the month or day is single digit it looks like this

I have removed the /'s by

gen newstrvar = subinstr(strvar, "/", "", .)

But form there i dont get it.

Ive used

Gen newdate = date (newstrvar, "MDY")

But that only gives me missing values.

What am i doing wrong and is there an easy way to do this?


*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index