BookmarkSubscribeRSS Feed
vomer
Obsidian | Level 7

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?

13 REPLIES 13
art297
Opal | Level 21

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.

vomer
Obsidian | Level 7

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

data_null__
Jade | Level 19

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

Tom
Super User Tom
Super User

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.

Patrick
Opal | Level 21

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.

vomer
Obsidian | Level 7

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

vomer
Obsidian | Level 7

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?

Patrick
Opal | Level 21

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?

KWhalen
Calcite | Level 5

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.

normanfrench
Calcite | Level 5

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!

KWhalen
Calcite | Level 5

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. 

normanfrench
Calcite | Level 5

Thank you very much!

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
  • 13 replies
  • 4593 views
  • 4 likes
  • 7 in conversation