Help using Base SAS procedures

%include stops .. need help please

Reply
Frequent Contributor
Posts: 117

%include stops .. need help please

Hi Guys,

So I am using a master file that contains about 6 %include statements calling my bigger sas programs.

%include(C:\program1.sas);

%include(C:\program2.sas);

%include(C:\program3.sas);

%include(C:\program4.sas);

%include(C:\program5.sas);

%include(C:\program6.sas);

etc.

Problem is that when I run this master file SAS stops working after the first few programs and just ignores the rest of the file.... no errors are seen in the log either...

How can I fix this problem?

PROC Star
Posts: 7,356

%include stops .. need help please

A first possibility I can think of is the SAS hasn't stopped running but is waiting for a quit statement.  If so, if you run each of the programs manually in order without using an include statement you may be able to see where it is waiting for an exiting statement.

Frequent Contributor
Posts: 117

Re: %include stops .. need help please

Programs run fine on their own. So this has to be a problem with the include. There are no errors or missing parts.

Respected Advisor
Posts: 3,777

Re: %include stops .. need help please

Stops working is not very specific.  If these are independent programs I would run them all separately using SYSTASK

Super User
Super User
Posts: 6,498

Re: %include stops .. need help please

You might also check the line lengths on the programs.  Perhaps SAS is truncating some lines when using  %INC that are not truncated when it is the main program.

Can you run them one by one in the same SAS sessions without errors?  Perhaps some options, macro variables, librefs , work datasets create by one of the earlier programs is causing the later programs to execute differently than they do if run individually.

Respected Advisor
Posts: 3,887

Re: %include stops .. need help please

I'm with data _null_ that if these are independent programs using SYSTASK would be the right thing to do (and you could even run your programs in parallel).

If you want to stick with %include then below options could help:

options s=0 s2=0 source2;

The first two options set the allowed code line length to the maximum, source2 shows you the code of "includes" in the log which makes debugging easier.

Frequent Contributor
Posts: 117

Re: %include stops .. need help please

Using options did not solve the issue. I am curious on systask... can you provide example of how I can write the code? I have no idea how it works...

Frequent Contributor
Posts: 117

Re: %include stops .. need help please

Using

%include C:\program1.sas / lrecl=32767; run;

seems to solve the problem for a few but this still happenes in the later programs... maybe this can help diagnose the problem better?

Respected Advisor
Posts: 3,887

Re: %include stops .. need help please

There are length limitations for source code documented. What limitations there are depends on your OS and SAS version (what do you have).

For debugging I would first try and figure out which %include is the first one no more working. Then I would run only this %include and see if the problem persists.

If it is a code line length issue: Could you please explain how it comes that your code is all on one line. Could you also explain how you run your code (both separately and via %include statement). Are you using for both the same environment and client?

New Contributor
Posts: 2

Re: %include stops .. need help please

In case anyone else has this problem, I figured out one potential cause and solution.

 

In the program that the %include called, I'd commented out the end of my code using "/*". Since it was the end of the program, I'd not closed the block comments with a matching "*/". This was causing the parent program to have subsequent code commented out.

New Contributor
Posts: 2

Re: %include stops .. need help please

hi, did you figure it out? I met the same problem. Could you kindly let me know how to solve it? Thank you very much!

New Contributor
Posts: 2

Re: %include stops .. need help please

Yep-if you're using a %include, and it's mysteriously not running anything after what's in the called-in program, check the called-program for a comment that isn't closed at the end of the code. 

New Contributor
Posts: 2

Re: %include stops .. need help please

Thank you very much!

Ask a Question
Discussion stats
  • 13 replies
  • 1276 views
  • 4 likes
  • 7 in conversation