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
defining a new variable such that one variable (string) in another variable?Dear All, Suppose that I have the data Code: * Example generated by -dataex-. To install: ssc insta…
esttab produces redundant table openings &\multicolumns{}, when looping and appending regression results, that can not be suppressedDear Ben Jann, I am very much thankful for all the scripts and packages that you have written so fa…
Error r(198)-- "option bwcheck() not allowed" displays when attempting to use the rdsampsi commandI'm trying to find the sample size for an MDES for a regression discontinuity analysis, and I stumbl…
generating observation "scores" after Mokken analysisDear all, I am conducting a Mokken scale analysis using loevh, with the following syntax: Code: lo…
no observations r(2000)Hi, I'm trying to make a regression on a panel dataset, but this ---no observations r(2000);--- I a…
Subscribe to:
Post Comments (Atom)
0 Response to extract the year from an inconsistent string date variable
Post a Comment