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

SAS Innovate 2025: Call for Content

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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