Hi everyone,
I am having troubles extracting the year from my dateset. Some observations have the formal d/m/y, while others have only the year.
I tried the following
encode Acquirordateofincorporation, gen(Age)
generate AcquirorAge = yofd(Age)
gen AGE=(2021-AcquirorAge)
I also tried gen Year=real(substr(Acquirordateofincorporation)), but it doesnt work.
Any help would be highly valuable.
Thank You!
Iulia
Related Posts with extract the year from an inconsistent string date variable
Confidence intervals for wtpHi everyone! Does anyone know why do we need to calculate Confidence Interval for Willingness to Pay…
Creating dummy variables with category namesDear all, I have a dataset comprising thousands of individuals. For each individual I have, among ot…
Generating new variableHi. I have made a survey experiment with two experimental groups. In Stata I now have two variables…
Panel binary logistic regression, lagged independent and dependent variables, and age effectsDear Statalist users, I hope you are well. I am a PhD candidate at RMIT University, Melbourne. I a…
Generate dummy from repeated valuesHello, I have a data with repeated numeric observations and would like to generate dummies that end …
Subscribe to:
Post Comments (Atom)
0 Response to extract the year from an inconsistent string date variable
Post a Comment