I am having trouble converting a string to a date.
I have imported an excel file, and have a variable Period which lists string values of the form "DDMMYYYY". However, I cannot seem to be able to convert it to an date. I have used the date function to convert the string, however all that I get are "." as the resulting variable.
I am using publicly available data at: https://www.apra.gov.au/sites/defaul...june_2018.xlsx
I then import using:
Code:
import excel "C:\****\annual_mysuper_statistics_back_series_june_2018.xlsx", sheet("Table 2") cellrange(A7:EX948) firstrow
drop in 1/2
keep in 1/563
Using the date function:
Code:
gen Date=date(Period, "DMY")
Code:
gen Date=date(Period, "DMY")
(563 missing values generated)
. li Date
+------+
| Date |
|------|
1. | . |
2. | . |
3. | . |
4. | . |
5. | . |
|------|
6. | . |
7. | . |
0 Response to Not able to convert string to date using date()
Post a Comment