BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Doug
Calcite | Level 5

Are there any quick methods available to convert multiple SAS program files into PDF documents?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Adobe Professional. Or if you have Word 2010 open them using Word and save as PDF, you could easily write a VBA macro to do that.

You could also probably write a macro to read in the program and then PDF it as well I'm guessing. 

View solution in original post

3 REPLIES 3
Reeza
Super User

Adobe Professional. Or if you have Word 2010 open them using Word and save as PDF, you could easily write a VBA macro to do that.

You could also probably write a macro to read in the program and then PDF it as well I'm guessing. 

Haikuo
Onyx | Level 15

ODS can come to your rescue: (works under 9.2)

filename sas "h:\sas.sas";

ods listing close;

ODS pdf file="H:\sas.pdf";

data _null_;

  infile sas ;

  input;

  temp=_infile_;

  file print ods;

  put _ods_;

run;

ODS pdf CLOSE;

ods listing;

And if you have multiple .sas under the same folder,  you can use pipe, filevar= etc to do conversion.

Haikuo

Haikuo
Onyx | Level 15

Code for multiple .sas file pdf conversion, you may need to tweak some parameters to suit your environment.

filename codes pipe "dir  /b /s h:\temp\sascode\*.sas";

ods listing close;

ODS pdf file="H:\sas.pdf";

data _null_;

infile codes truncover;

input fname $40.;

infile dummy filevar=fname end=done;

do while(not done);

input ;

temp=_infile_;

file print ods;

  put _ods_;

end;

run;

ODS pdf CLOSE

ods listing;

Haikuo

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 3 replies
  • 9249 views
  • 9 likes
  • 3 in conversation