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
Sending output to file _instead of_ Results windowI have a do-file that produces a lot of output from various types of commands. I would like to store…
Tabulating across variables after using multencodeHi Everyone, I have a string variable that contains multi-picklist values separated by a semi-colon…
custom xline value per group in xtlineHi. I'm trying to produce a graph for each US state using -xtline- and the -xline- option (Stata 15.…
Is it possible to have 0 p-value when using chi-square test?Hello, I am having difficulty interpreting the results I have. I want to check whether the probabi…
Gravity model for importsHi, I am new to STATA and I am having some problems in estimating a fixed effects gravity model est…
Subscribe to:
Post Comments (Atom)
0 Response to convert strings into date variables with very heterogeneous formats
Post a Comment