Hi,

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
Period is being stored has a string type of %str181 and format of %s181.

Using the date function:
Code:
gen Date=date(Period, "DMY")
i only get :
Code:
 gen Date=date(Period, "DMY")
(563 missing values generated)

. li Date

     +------+
     | Date |
     |------|
  1. |    . |
  2. |    . |
  3. |    . |
  4. |    . |
  5. |    . |
     |------|
  6. |    . |
  7. |    . |
I am not sure what I've done wrong or how to proceed forward, so any help would be appreciated!