BookmarkSubscribeRSS Feed
Quartz | Level 8

Within my sas program I call another program where one of the datasets contains the code:

%let enddt=%sysfunc(inputn(&exposurecutoff,yymmdd8.)); /* converting to sas date */

if (year(start) ge &exposureyearstart) and (year(end) le year(&enddt));

This works perfectly when I run the first program and open the second program manually and running it (rather than calling it using %include). When I run the first program which calls the second one using %include I get the following error:

1008 +if (year(start) ge &exposureyearstart) and (year(end) le




WARNING: Apparent symbolic reference ENDDT not resolved.

ERROR 22-322: Syntax error, expecting one of the following: a name,

              a quoted string, a numeric constant,

              a datetime constant, a missing value, ), INPUT, PUT.

This has to be due to the fact that I'm calling it the program.

Super User

Check the length of the line in the program, if it's over 256 characters it causes issues. Use LRECL to set the length.

%include '' /lrecl=300;

Quartz | Level 8

the length of the line is if (year(start) ge &exposureyearstart) and (year(end) le year(&enddt)); which is less than 256 characters

Super User Tom
Super User

Truncation could still be your problem. The actual line that is truncated could be anywhere before line 1008 and have the effect of not running the step that creates the macro variable.

Rhodochrosite | Level 12

Is line 1008 in the same macro as the %LET for enddt?  If not, you may need to define it as a global.

Lapis Lazuli | Level 10

add the following information notes

%put info &=exposurecutoff;

%let enddt=%sysfunc(inputn(&exposurecutoff,yymmdd8.)); /* converting to sas date */

%put info &=exposureyearstart &=enddt;

if (year(start) ge &exposureyearstart) and (year(end) le year(&enddt));

Quartz | Level 8

Is the code in your first program wrapped in a macro? If so, the enddt macro will be local unless you expressly declare it as global.

Fluorite | Level 6



I found a pretty cool add-in to Base SAS on that may be very usefull to you. The tool called Log Analyser is integrated into Base SAS and can produce Log summary report in a second. You may also analyse log in details if you wish. Really great tool!



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 7 replies
  • 7 in conversation