I have start and stop date in 2016-02-11 and 2016-02-24 formats and i am doing the below code:
data trt1;
set trt;
exp = (SEENDTC-SESTDTC+1);
run;
But i get the below error message and i even tried to give format statement but still its not working. any help?
NOTE: Invalid numeric data, SEENDTC='2016-02-24' , at line 161 column 11.
NOTE: Invalid numeric data, SESTDTC='2016-02-11' , at line 161 column 19.
This is because you do not have a SAS date value, but a string containing a human-readable date.
First convert to a SAS date value:
data trt1;
set trt;
format SEENDTC_num SESTDTC_num yymmddd10.;
SEENDTC_num = input(SEENDTC,yymmdd10.);
SESTDTC_num = input(SESTDTC,yymmdd10.);
exp = (SEENDTC_num - SESTDTC_num + 1);
run;
This is because you do not have a SAS date value, but a string containing a human-readable date.
First convert to a SAS date value:
data trt1;
set trt;
format SEENDTC_num SESTDTC_num yymmddd10.;
SEENDTC_num = input(SEENDTC,yymmdd10.);
SESTDTC_num = input(SESTDTC,yymmdd10.);
exp = (SEENDTC_num - SESTDTC_num + 1);
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.