SAS programming code in output

Accepted Solution Solved
Reply
Contributor
Posts: 60
Accepted Solution

SAS programming code in output

In Stata, when you have your output, it also shows you the code you used to produce the output.

 

Is there a similar feature that can be utilized in SAS?

 

So that you can see the sas code with the output together?

 

Thanks!


Accepted Solutions
Solution
‎05-23-2016 09:55 AM
Super Contributor
Posts: 394

Re: SAS programming code in output

You can use PROC DOCUMENT's IMPORT TO statement to import a text file into an ODS DOCUMENT, and then replay it to the listing or any other ODS destination such as a web page or PDF file. Here's an example.

View solution in original post


All Replies
Grand Advisor
Posts: 17,325

Re: SAS programming code in output

Not easily. Recently they've added support for Jupyter notebooks so that would give you what you want:

 

http://blogs.sas.com/content/sasdummy/2016/04/24/how-to-run-sas-programs-in-jupyter-notebook/

Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: SAS programming code in output

SAS code is just text, you could read it in in a datastep infile.  Then proc report it out after the output.

Grand Advisor
Posts: 9,571

Re: SAS programming code in output


Or put the following code at the end of your code.


data _null_;
 file print;
 infile '/folders/myfolders/temp.sas'  lrecl=32767;
 input;
 put _infile_;
run;


Solution
‎05-23-2016 09:55 AM
Super Contributor
Posts: 394

Re: SAS programming code in output

You can use PROC DOCUMENT's IMPORT TO statement to import a text file into an ODS DOCUMENT, and then replay it to the listing or any other ODS destination such as a web page or PDF file. Here's an example.

Contributor
Posts: 60

Re: SAS programming code in output

Thank you!  This worked!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 316 views
  • 0 likes
  • 5 in conversation