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
Industry x Year Fixed effectHello, The data I am using is shown below. With this data I want to do a fixed effects regression, …
New version of descgen on SSCThanks as always to Kit Baum, a new version of the descgen package (described as below on my website…
Economics of Crime Dissertation - terrorist attacks and hate crime in LondonHi Everyone, I am new to Statalist so please let me know if I am not using the forum correctly. Fo…
Alternatives to bysort when dealing with multiple imputations in panelHello everyone, I have a panel with 345 observations and six variables. My cross-sectional variable …
xtdpdml: how to test for endogeneity, lag structure and restrictions?As a sensitivity analysis, I would like to replicate my FE and AB estimations with xtdpdml, or ML-SE…
Subscribe to:
Post Comments (Atom)
0 Response to Keeping the last 4 digits of a long variable
Post a Comment