Hi,

I am failing at a surprisingly simple task. In a csv file I have a date variable (mess_datum) in the format yyyymmdd. When I import the csv to Stata (15), the variable will be imported in long format and displayed correctly. Then all I want is copy this variable, so what I do is just
Code:
gen date = mess_datum
But then, for example for all the values 19470123, 19470124, and 19470125 in mess_datum, I will get the value of 19470124 in the new variable date. The pattern repeats so that for three days I get only one common value.
I figured out that clonevar does the trick but I am still wondering what went wrong with generate? I tried several things, for example changing mess_datum to double format first, but no success.

Thanks for your help!

Array