Hi everyone, I would like to ask some help in order to extract year from a string variable (year of incorporation) that is structured in this way: 12/9/1998.
I tried to encode the variable (year of incorporation), change the format in %td and then use the code year(year of incorporation) but Stata returns me a year that does not match with the one in the date. For example, for 12/9/1998 it returns 1970.
How can I solve the problem?
Thanks!
Related Posts with Extract Year from a string variable
How to calculate year in month with conditionsDear all, Year of birth and month of birth of each individual in a given dataset, now I want to gen…
Comparing coefficients while keeping difference between other coefficients constant in mixed modelDear Statalist users, I would like to compare whether the slope is statistically different between …
How to generate a variable which takes for every combination another value?Dear all I have a question. I have a dataset with lots of different variables and want to generate a…
sort row with string variables?Dear All, Is it possible to sort "string" variable? Suppose that the data set is Code: * Example ge…
Interpreting Sargan-Hansen TestsHi all, I am running diff GMM using Sebastian's xtdpdgmm command. However, I am not sure how to int…
Subscribe to:
Post Comments (Atom)
0 Response to Extract Year from a string variable
Post a Comment