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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.