BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Babloo
Rhodochrosite | Level 12

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;
1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@Babloo

Unbalance brackets:

Remove one of the closing brackets after today())

 

View solution in original post

5 REPLIES 5
Patrick
Opal | Level 21

@Babloo

Unbalance brackets:

Remove one of the closing brackets after today())

 

Vibcom
Fluorite | Level 6

Place close brackets before > .change if condition to--

if input((cats(renewal_date,"2018"),date9.)) > today() then new_renewel_date=input(cats(renewel_date,"2019"),date9.);
gamotte
Rhodochrosite | Level 12

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;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Clue:

ERROR 79-322: Expecting a )
ballardw
Super User

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())

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1531 views
  • 2 likes
  • 6 in conversation