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
placebo test of SCMin the article''Synthetic Control Methods for Comparative Case Studies: Estimating the Effect of Cal…
Proportional redistributionI have a dataset with a variable sex (male, female, unknown), I want to create a new variable that w…
compare value different variable and rowshello, I want to compare values of two varible in diffrent rows. For example vr1 vr2 10 20 20 30 40 …
How to do bootstrap test for a nonlinear mediation effect with a moderator and fixed effectsHi Statalist, I have a problem about how to use bootstrap test to further detect a mediation proces…
Reshape Data panel to wideHi everyone, I struggle to reshape my panel data to wide. The idea is to start from this: Code: …
Subscribe to:
Post Comments (Atom)
0 Response to How to create a date variable from month? String Variable
Post a Comment