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.
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;
the length of the line is if (year(start) ge &exposureyearstart) and (year(end) le year(&enddt)); which is less than 256 characters
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.
Is line 1008 in the same macro as the %LET for enddt? If not, you may need to define it as a global.
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));
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.
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!
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 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.