BookmarkSubscribeRSS Feed
lotteo
Fluorite | Level 6

Hey,

I have a long SAS code, containing proc means, univariate, logistics, genmode... If I print my results as pdf file, I get a file with 525 pages, which is expensive to print on paper.  I have seen, that a lot of the proc freq and proc logistics ans univariate tables are each on one page, even If they are very small, so I'd rather have them on the same page or let SAS decide, when It is time to take a new page because there isn't enough space anymore.

I've read something about ods pdf and ods startpage=no but did not understand enough, that it worked... (I wrote in the very beginning: ods pdf file="xyz"; then the whole code, then ods pdf close; which didnt work... but I also dont know what to refer to, at the place of xyz)

 

I can't copy the whole code, since it it very long 😄 but I will post the first few lines, in case it is important 

 

libname nako "C:\Users\Lotte\Documents\Ernährung\Uni\MartinLutherUniversitätHalle\Masterarbeit\Daten für SAS";
data nako1;
set TMP1.bs_diab_v1;
run;

 

Thank you!! Lotte

1 REPLY 1
Shmuel
Garnet | Level 18

I have done something similar very long time ago. The main logic is to write all output to a text file and then ommit the "new page" control lines.

Check the output file, first 2-3 pages of next code and locate the "new page" control lines:

filename  myprint '<folder and file name>.txt;
proc printto file=myprint; run;
... enter yor code ...
proc printto; run;

then do:

ods pdf file= <ods file folder and name>.pdf;
data _null_;
  infile myprint truncover;
  input a_line $;
  if a_line = "1  " then delete;  /* target - ommit new page control line; May need correction */
run;
ods pdf close;

I'm not sure proc printto is available on all sas platforms.

Above code is not tested. I hope it should give you the hint how to solve the problem.

 

I'm adding here my test done owith SAS On Demand for Academics:

/* target: ommit break page lines */
filename myprint '~/reports/myprint.txt';
proc printto print=myprint; run;

proc print data=sashelp.class; run;

proc print data=sashelp.cars; run;

proc printto; run;

data _null_;
  length a_line $132;
  infile myprint truncover;
  input a_line $132.;
  if substr(a_line,1,1) = 'FF'x then delete;
  file print;
  put a_line;
run;

You still may want to remove some titles or headings.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 209 views
  • 1 like
  • 2 in conversation