Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

My date variable is a string, how can I turn it into a date variable Stata can recognize?

recognize stata String turn
0
Posted

My date variable is a string, how can I turn it into a date variable Stata can recognize?

0

“), we are using this as an example of what you could do with regular expressions. The goal of this process is to produce a string variable with the appropriate four digit year for every case, which Stata can then easily convert into a date. To do this we will start by separating out each element of the date (day, month, and two- or four- digit year) into a separate variable, then we will assign the correct four-digit year to cases where there are currently only two digits, finally, we concatenate the variables to create a single string variable that contains month, day, and four-digit years.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123