Hello dear community!
I am referring to the attached screenshort where you see two columns containing start and end dates with very hetereogeneous formatting. As of now, both columns are stored as strings since "UnKnown" was inserted everytime no date is given. I am now (1) trying to convert these strings to dates and (2) seeking to extract the year from all these dates. Step 2 is fairly straightforward, but I am struggling with the conversion. There are three different formats: e.g. a.) 18.Jul 14; b.) 1995 and c.) Feb 73. Only the last two digits of the years are shown in cases a.) and c.) so that I would need insert "20" whenever the number are [0,19] and a "19" otherwise. I have been experimenting a lot with date() but failed as of now.
Did someone already encounter a similar problem and could provide me with some insight?
Thanks!
Marie
Related Posts with convert strings into date variables with very heterogeneous formats
Gen variableHi everyone, I have done some research, but couldn't find the answer to the following issue. Dataset…
The modulus -mod()- function is giving me negative values. Is this a bug?The help for the modulus function, -mod()- reads: mod(x,y) Description: the modulus of x with respe…
Fixed Effects regression with clustering - QuestionHello, I'd like to utilize year and industry fixed effects regression and calculate t-statistics us…
Problem importing SAS formatsI'm trying to import SAS formats for CDC's Youth Risk Behavior Survey. I have the SAS data set file …
Apply numerical IDs for multiple dataHello, I was wondering whether anyone can help me- as I am very new to Stata. I have multiple pati…
Subscribe to:
Post Comments (Atom)
0 Response to convert strings into date variables with very heterogeneous formats
Post a Comment