I have posted a dataex for my data which quotes dates in the form YYYY.MM:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(date dy) str2 country byte id
1871.01 .05855856 "US" 60
1871.02 .05777778 "US" 60
1871.03 .05639913 "US" 60
1871.04 .05485232 "US" 60
1871.05 .05349794 "US" 60
1871.06 .05394191 "US" 60
1871.07 .05496829 "US" 60
1871.08 .05427975 "US" 60
1871.09 .05371901 "US" 60
1871.1 .05664488 "US" 60
1871.11 .05603448 "US" 60
1871.12 .05485232 "US" 60
1872.01 .05417696 "US" 60
1872.02 .05465164 "US" 60
1872.03 .05357143 "US" 60
1872.04 .05276062 "US" 60
1872.05 .05341699 "US" 60
1872.06 .0545809 "US" 60
1872.07 .05554902 "US" 60
1872.08 .05688492 "US" 60
1872.09 .05858586 "US" 60
1872.1 .05901409 "US" 60
1872.11 .0599394 "US" 60
1872.12 .0591716 "US" 60
1873.01 .05919765 "US" 60
1873.02 .0592233 "US" 60
1873.03 .06017613 "US" 60
1873.04 .06150794 "US" 60
1873.05 .06188119 "US" 60
1873.06 .063253015 "US" 60
1873.07 .0638833 "US" 60
1873.08 .064386316 "US" 60
1873.09 .07026144 "US" 60
1873.1 .07756563 "US" 60
1873.11 .08106436 "US" 60
1873.12 .07466064 "US" 60
1874.01 .07081545 "US" 60
1874.02 .06875 "US" 60
1874.03 .069767445 "US" 60
1874.04 .07173913 "US" 60
1874.05 .07366072 "US" 60
1874.06 .07399103 "US" 60
1874.07 .07399103 "US" 60
1874.08 .0738255 "US" 60
1874.09 .07268722 "US" 60
1874.1 .07284768 "US" 60
1874.11 .072210066 "US" 60
1874.12 .07268722 "US" 60
1875.01 .072136566 "US" 60
1875.02 .07174393 "US" 60
1875.03 .07026144 "US" 60
1875.04 .068817206 "US" 60
1875.05 .07102908 "US" 60
1875.06 .07191781 "US" 60
1875.07 .07118451 "US" 60
1875.08 .07029478 "US" 60
1875.09 .07036613 "US" 60
1875.1 .070930235 "US" 60
1875.11 .069221966 "US" 60
1875.12 .06864989 "US" 60
1876.01 .06726457 "US" 60
1876.02 .06637168 "US" 60
1876.03 .06651885 "US" 60
1876.04 .06912442 "US" 60
1876.05 .07177033 "US" 60
1876.06 .072289154 "US" 60
1876.07 .07317073 "US" 60
1876.08 .07633588 "US" 60
1876.09 .0813008 "US" 60
1876.1 .08174387 "US" 60
1876.11 .08333334 "US" 60
1876.12 .08379889 "US" 60
1877.01 .0819155 "US" 60
1877.02 .08434132 "US" 60
1877.03 .08596215 "US" 60
1877.04 .08955783 "US" 60
1877.05 .08646259 "US" 60
1877.06 .0897436 "US" 60
1877.07 .08273684 "US" 60
1877.08 .07432787 "US" 60
1877.09 .06712963 "US" 60
1877.1 .06293052 "US" 60
1877.11 .06110429 "US" 60
1877.12 .05846154 "US" 60
1878.01 .05821538 "US" 60
1878.02 .05921384 "US" 60
1878.03 .05787037 "US" 60
1878.04 .05606607 "US" 60
1878.05 .05562874 "US" 60
1878.06 .0542522 "US" 60
1878.07 .05293103 "US" 60
1878.08 .05313044 "US" 60
1878.09 .05184659 "US" 60
1878.1 .05221264 "US" 60
1878.11 .05210375 "US" 60
1878.12 .05217391 "US" 60
1879.01 .05075419 "US" 60
1879.02 .04940701 "US" 60
1879.03 .05068493 "US" 60
1879.04 .04952255 "US" 60
end
[/CODE]
I tried a simple code:
gen date2=subinstr(date, ".", "/", .)
drop date
rename date2 date
However I am getting a mistype error for the first line. I don't think there is a mistake with the code so any ideas on what is causing the mistype error?
Related Posts with Stata Date
how to use the value of variable A in last year for variable B in this yearHi everyone, I would ike to create a new variable whose value equals to the value of another variab…
PPML Gravity Model: interacting continuous variablesGood afternoon! I am estimating a PPML gravity model of trade adding an index of ethnic fractionalis…
Standerdized diffrence calculation in complex weighted dataHey guys, I am trying to calculate the standardized differences in complex weighted data. I was abl…
margins at percentilesHi Statalists, I have code like this: Code: regress y x1 x2 x3 egen p10 = pctile(x1), p(10) egen …
Combining values for multicode response variables to create a new cumulative variableI need to create a total variable that will sum the code frequencies from each response variable. I…
Subscribe to:
Post Comments (Atom)
0 Response to Stata Date
Post a Comment