Hi
I have a query my variable is in the following format: 1901m12, 1902m1 and so on.
I want to separate this and create a monthly variable where January=1, February=2 and so on. What is the command that I could use (This is a string variable)
The code I used is :
gen date1=monthly(date,"YM")
gen date2 = dofm(date1)
format date2 %d
But this is not getting the required results.
My data on the dataex command is as follows
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input int month
-697
-696
-695
-694
-693
-692
-691
-690
-689
-688
-687
-686
-685
-684
-683
-682
-681
-680
-679
-678
-677
-676
-675
-674
Related Posts with How to create a date variable from month? String Variable
Date ConversionHello, I am trying to expend one data set with another data set by using the command "append using,…
Using eydx to calculate percentage difference in Y in difference-in-difference-analysis for men and womenHi everybody I am conducting a DID-analysis. Among other things, I am looking to see how a treatmen…
Conditioning on value of first year for each country in unbalanced panel dataHi all! I have country/year panel data. I would like to drop some observations according to specifi…
Which analysis to use for three repeated measures binary outcomeI'm working on a panel survey. I have a binary y dependent variable measured three times, once befor…
Network meta-analysis from precomputed effect sizeCould I do a network meta-analysis, if I had only the hazard ratio from each article (did not have e…
Subscribe to:
Post Comments (Atom)
0 Response to How to create a date variable from month? String Variable
Post a Comment