Hello,
I probably have a very simple query but I can't work out how to solve it
I have a variable entitled 'y_m_delivery' which is a numeric variable example 199906, I want to create a new variable taking out the month out so that I am only left with the year i.e remove the 06 so it leaves 1999. I have tried
gen year = year (y_m_delivery)
but this does not work
Any help gratefully received
thanks
Related Posts with Extracting the year from a variable in stata
tempfileI often execute - in separate instances of Stata - multiple simultaneous do-files. Many of my do-fil…
I don't understand why the results show different significance?Hi, Statalisters: I am not so much good in posting on the forum, please excuse me for not adhering t…
Combine two variables into a dummy variableHey dear STATA Users, I am meant to create a dummy variable. That's literally a set of dummy variab…
Omitted Interactions in Negative Binomial Panel RegressionHello, I ran into some trouble when introducing interaction effects in my model. To quickly explain…
Trajectory analysis - keep registry_HbA1c if date_of_HbA1c_test > 1 year after baseline_HbA1c for each ID_numberDear Stata experts, I am really stuck. In my data set, I have variables for the participant's ID nu…
Subscribe to:
Post Comments (Atom)
0 Response to Extracting the year from a variable in stata
Post a Comment