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?
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.
Programs run fine on their own. So this has to be a problem with the include. There are no errors or missing parts.
Stops working is not very specific. If these are independent programs I would run them all separately using SYSTASK
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.
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.
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...
SYSTASK
For UNIX
http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#a001215125.htm
For Windows
And here examples of how to use systask to start SAS jobs:
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?
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?
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.
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!
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.
Thank you very much!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.