Including syntax in a SAS ODS pdf file

Is it possible to include the presented syntax or even output the log file when using ODS in PDF using SAS?

For example, provide this simple code:

ods pdf file = "c:\temp\myPDF.pdf"; proc reg data = mydata; model y = x; run; ods pdf close; 

I can get the regression output and the accompanying graph. But is it possible to include an attached command like this in the PDF?

 proc reg data = mydata; model y = x; run; 
+5
source share
1 answer

This, but it requires a few hoops. Fortunately, you can port this to macros to clear your code.

  • Create a temporary fileref to save the log.
  • Run your PDF file and output the log to fileref.
  • Enter code.
  • Stop logging in fileref.
  • Print the contents of a PDF file using ODF TEXT=

Hope this helps

 filename x temp; ods pdf file="c:\temp\temp.pdf"; title "Cost of Power"; options source; proc printto log=x; run; proc reg data=sashelp.cars; model msrp = horsepower; run; quit; proc printto;run; title; ods pdf startpage=now; /*Force a new page in the PDF*/ data _null_; infile x; input; call execute("ods text='LOG: "||_infile_||"';"); run; ods pdf close; filename x ; 
+6
source

Source: https://habr.com/ru/post/1204445/


All Articles