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
Quantifying serial correlation in a small-T panelHi all, I have a (very) large N and small T panel. For convoluted reasons, I would like to quantify…
Inputting value of previous rowsHello, I am new to Stata and currently using Stata 15.1. I am working on a project involving firms a…
changing several currencies over multiple years to EUROHey, I am using stata (for the first time) for my thesis. At the moment I have got a large database …
freduse errorWhen I use the freduse command I get the following error: . freduse gdp Java installation not f…
Bootstrap validation - Multivariable regression modelHello I would like to perform bootstrap validation of a multivariable regression model, such as: …
Subscribe to:
Post Comments (Atom)
0 Response to How to create a date variable from month? String Variable
Post a Comment