BookmarkSubscribeRSS Feed
henrik_dahl
Calcite | Level 5

We have build a tool that automatically creates Data catalog, Program documentations, Data lineage, runtime statistics and more utilizing the output from the procedure proc scaproc
2 questions:
1) if we have a program like:

proc scaproc; 
   record 'record.txt'; 
run;
%include("Some_SAS_program.sas");
proc scaproc; 
   write; 
run;

Then the file record.txt will hold all the right JOBSPLITS for the included code, BUT the source code included does not follow after the line: 

/* JOBSPLIT: STEP SOURCE FOLLOWS */

Is there some way to achieve that the code is included in the output from proc scaproc?

2) Proc export does not seem to generate any ATTR-information on what is being exported. Is there a way to capture that information using proc scaproc? 

A description on what we are trying to achieve is here: 
https://www.youtube.com/watch?v=hxJw1ZFj1r4 

3 REPLIES 3
Quentin
Super User

Interesting.  I've never really played much with SCAPROC, but agree when I use %INCLUDE, I don't see the included code in the record, even when source2 is turned on.  I ran code like:

 

options source2 ;

proc scaproc; 
   record 'Q:\junk\record.txt'; 
run;

proc print data=sashelp.class(obs=3) ;
run ;

%include "Q:\junk\freq.sas";
proc scaproc; 
   write; 
run;

And I could see the PROC PRINT step, but couldn't see the PROC FREQ step that was in the %included code.  Report snippet:

/* JOBSPLIT: SYSSCP WIN */
/* JOBSPLIT: PROCNAME PRINT */
/* JOBSPLIT: STEP SOURCE FOLLOWS */

proc print data=sashelp.class(obs=3) ;
run ;

%include "Q:\junk\freq.sas";

/* JOBSPLIT: JOBENDTIME 02AUG2024:08:28:07.15 */
/* JOBSPLIT: END */



Tom
Super User Tom
Super User

I think you can kind of get it to work by using macro call instead.  At least it appears to put in a "jobstep" when the macro generates the code.

 

So make a macro that includes the file.

Replace the %INCLUDE statement with a call to the macro.

Add the EXPANDMACROS option to the record statement.

ballardw
Super User

Not a new issue.

https://communities.sas.com/t5/SAS-Programming/include-thwarts-data-flow-diagram-from-SCAPROC/td-p/5...

 

shows a work around that may not be the nicest approach.

 

And this note: https://support.sas.com/kb/48/812.html

acknowledges the behavior and "to be fixed in later release" from Dec 2012

 

Anyone tried reading the source file into a data step and using Call Execute with the lines of code?

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1383 views
  • 8 likes
  • 4 in conversation