BookmarkSubscribeRSS Feed
brophymj
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

1008!+year(&enddt));

          -

          22

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.

7 REPLIES 7
Reeza
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 'program1.sas' /lrecl=300;

brophymj
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

Tom
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.

Doc_Duke
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.

Ron_MacroMaven
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));

Fugue
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.

kaji
Fluorite | Level 6

HI,

 

I found a pretty cool add-in to Base SAS on www.tatesoft.com 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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 7 replies
  • 1194 views
  • 0 likes
  • 7 in conversation