Could you please guide me to overcome this syntax error?
data have;
input renewal_date $;
datalines;
15jun
11sep
14sep
02jan
;
run;
data want;
set have;
if input(cats(renewal_date,"2018"),date9.) > today()) then new_renewel_date=input(cats(renewel_date,"2019"),date9.);
else renewel_date=input(cats(renewal_date,"2018"),date9.);
run;
26 data have;
27 input renewal_date $;
28 datalines;
NOTE: The data set WORK.HAVE has 4 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
33 ;
34 run;
35
36
37 data want;
38 set have;
2 The SAS System 13:51 Monday, September 17, 2018
39 if input((cats(renewal_date,"2018"),date9.) > today()) then new_renewel_date=input(cats(renewel_date,"2019"),date9.);
_ _
79 22
200
40 else renewel_date=input(cats(renewal_date,"2018"),date9.);
____
160
ERROR 79-322: Expecting a ).
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, ;, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT,
IN, LE, LT, MAX, MIN, NE, NG, NL, NOT, NOTIN, OR, THEN, ^, ^=, |, ||, ~, ~=.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 160-185: No matching IF-THEN clause.
41 run;
Unbalance brackets:
Remove one of the closing brackets after today())
Also, you have written "renewel" instead of "renewal" at several places.
Edit : I guess you want
data want;
set have;
if input(cats(renewal_date,"2018"),date9.) > today() then new_renewal_date=input(cats(renewal_date,"2019"),date9.);
else new_renewal_date=input(cats(renewal_date,"2018"),date9.);
run;
Clue:
ERROR 79-322: Expecting a )
If you are using the Enhanced editor you can find matching ( or not matched parentheses by placing the cursor on either the ( or ) and pressing CTRL 9. If you do so on the "input(" ( then you will find that the matching ) is after the today(). In other words the INPUT is being told to include "> today()" in some form. You likely meant there to be a ( before input to go along with the IF.
if (input(cats(renewal_date,"2018"),date9.) > today())
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.