Help using Base SAS procedures

Getting error in log

Reply
Super Contributor
Posts: 259

Getting error in log

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.

Super User
Posts: 17,912

Re: Getting error in log

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;

Super Contributor
Posts: 259

Re: Getting error in log

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
Super User
Posts: 6,502

Re: Getting error in log

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.

Trusted Advisor
Posts: 2,113

Re: Getting error in log

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

Regular Contributor
Posts: 200

Re: Getting error in log

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

Super Contributor
Posts: 307

Re: Getting error in log

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.

Occasional Contributor
Posts: 13

Re: Getting error in log

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!

Ask a Question
Discussion stats
  • 7 replies
  • 420 views
  • 0 likes
  • 7 in conversation