Hi everyone,
I have a survey with 2025 cases and a date variable called "EndDate" (stored as a double). I need to know what day in April the respondent took the survey, but I mostly keep creating variables with missing values. I have read through all of the documentation so must be missing something basic. I would greatly appreciate any help you can provide. I am using Stata 16.
I think this format is more readable.
list EndDate
9-Apr-2020 15:56:21
9-Apr-2020 15:59:10
9-Apr-2020 15:59:37
9-Apr-2020 16:01:07
9-Apr-2020 16:02:28
I have tried the following and received error messages:
gen date1 = dofy(EndDate)
(2,025 missing values generated)
gen date1 = day(EndDate)
(2,025 missing values generated)
gen date1 = date(EndDate)
invalid syntax
gen date1 = date(EndDate, "DMYhms")
invalid syntax
gen double date1 = date(EndDate, "DMYhms")
invalid syntax
I have a survey with 2025 cases and a date variable called "EndDate" (stored as a double). I need to know what day in April the respondent took the survey, but I mostly keep creating variables with missing values. I have read through all of the documentation so must be missing something basic. I would greatly appreciate any help you can provide. I am using Stata 16.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double EndDate 1902066981000 1902067150000 1902067177000 1902067267000 1902067348000 end format %tcdd-Mon-CCYY_HH:MM:SS EndDate
list EndDate
9-Apr-2020 15:56:21
9-Apr-2020 15:59:10
9-Apr-2020 15:59:37
9-Apr-2020 16:01:07
9-Apr-2020 16:02:28
I have tried the following and received error messages:
gen date1 = dofy(EndDate)
(2,025 missing values generated)
gen date1 = day(EndDate)
(2,025 missing values generated)
gen date1 = date(EndDate)
invalid syntax
gen date1 = date(EndDate, "DMYhms")
invalid syntax
gen double date1 = date(EndDate, "DMYhms")
invalid syntax
Comment