Appreciate if someone help me to resolve the NOTE in second data step. I'm not receiving any note if month value is 10,11 or 12.
26 data test;
27 day='1';
28 month='1';
29 year=2018;
30 run;
NOTE: The data set WORK.TEST has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
31
32 data test1;
33 set test;
34 new_year=put(year,z4.);
2 The SAS System 07:19 Friday, September 21, 2018
35 day_month_year=catt(day,month,new_year);
36 renewal_date=input(day_month_year,ddmmyy8.);
37 format renewal_date date5.;
38 run;
NOTE: Invalid argument to function INPUT at line 36 column 14.
day=1 month=1 year=2018 new_year=2018 day_month_year=112018 renewal_date=. _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to
missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 36:14
NOTE: There were 1 observations read from the data set WORK.TEST.
NOTE: The data set WORK.TEST1 has 1 observations and 6 variables.
day_month_year=catt(day,month,new_year);
=
day_month_year=catt('1','1',2018);
This is not a valid ddmmyy8 format.
If you want a date then use (with numeric values):
data test; day=1; month=1; year=2018; date=mdy(month,day,year); format date date9.; run;
@Babloo wrote:
Appreciate if someone help me to resolve the NOTE in second data step. I'm not receiving any note if month value is 10,11 or 12.
26 data test; 27 day='1'; 28 month='1'; 29 year=2018; 30 run; NOTE: The data set WORK.TEST has 1 observations and 3 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 31 32 data test1; 33 set test; 34 new_year=put(year,z4.); 2 The SAS System 07:19 Friday, September 21, 2018 35 day_month_year=catt(day,month,new_year); 36 renewal_date=input(day_month_year,ddmmyy8.); 37 format renewal_date date5.; 38 run; NOTE: Invalid argument to function INPUT at line 36 column 14. day=1 month=1 year=2018 new_year=2018 day_month_year=112018 renewal_date=. _ERROR_=1 _N_=1 NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to missing values. Each place is given by: (Number of times) at (Line):(Column). 1 at 36:14 NOTE: There were 1 observations read from the data set WORK.TEST. NOTE: The data set WORK.TEST1 has 1 observations and 6 variables.
Did you bother the read the error where it shows day_month_year=112018 The ddmmyy informat expects the 3rd and 4th values to be a valid month number. 20 is NOT a valid month number. Convert any day, month or year values to numeric separately and use the MDY function on the numeric values: date = mdy(input(month,best.),input(day,best.), year) since it appears your year might actually be numeric.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.