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
Fixed Effects at individual-area-level?Hello folks! I have read this paper today: http://ftp.iza.org/dp9311.pdf If you scroll to page 11,…
Merging datasets togetherI am currently in a tricky situation. I have a dataset with 83,311 observations and 109 variables. I…
Instrumental Variables: nonlinear endogenous variable Hello Statalist! I'm doing an exercise from Microeconometrics Using Stata, by Cameron and Trivedi, …
How to test heteroskedasticity with xtpmg command. ThanksDear all, I used xtpmg command to estimate three of following: PMG (Pooled Mean Group) MG (Mean Gro…
Reporting contrasts of marginal effects from logit/probit modelsLet's say I have a model to predict the probability of an outcome, and I am interested in reporting …
Subscribe to:
Post Comments (Atom)
0 Response to How to create a date variable from month? String Variable
Post a Comment