Hi everyone,
I have a long variable for source date in this dataset I am working with.
This long variable identifies dates in this way:
31oct1979
31oct1980
31oct1981
But when I tried to get it from dataex for this post, it came up in the following way:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long srcdate
7243
7609
7974
end
format %td srcdate
Now I want to create a year variable which should only consist of the last 4 digits of the original format i.e. 1979, 1980. Can someone help me with the appropriate coding for this?
Related Posts with Keeping the last 4 digits of a long variable
Include all contrasts of categorical IV in margins after mlogitHi! I would like to visualize all contrasts of a categorical IV in an mlogit model, but am stuck on…
big panel data managementHi, I am struggling to manage my large panel dataset 300k observation over 36 months. I would be gra…
Sensitivity Check of Longitudinal MediationDear all, I run a linear model to test for a mediation (outcome and mediator are both metric, the t…
Analyze data on Continuous Glucose Monitoring or Flash Glucose Monitoring in various Diabetes TechnologiesHello Everyone, hope you all are safe and healthy I have been trying to analyze CGM/FGM data for t…
Mediation analysis with 3 conditions categorical IVHello Statalist, I have some questions regarding to my mediation analysis as I'm very new to Stata…
Subscribe to:
Post Comments (Atom)
0 Response to Keeping the last 4 digits of a long variable
Post a Comment