Hello,
I'm trying to output what is basically just a print out of a formats catalog and two things keep happening:
1. I cannot for the life of me stop it from printing thousands and thousands of lines in the log. How do i keep it from writing to the log??? I thought it was ods listing close, (even tried ods _all_ close) but that doesn't appear to do anything at all.
2. I keep getting this in the log. I have a run statement before ods pdf close. ?:
1031 /****PDF TEST*****/
1032 ods _all_ close;
1033 ods pdf file="&path.AppendixC.pdf";
NOTE: Writing ODS PDF output to DISK destination
"[path removed for confidentiality]\AppendixC.pdf", printer "PDF".
1034 data _null_;
...
[thousands of lines of crap - no error messages or warnings at all though]
...
1009 ods pdf close;
NOTE: ODS PDF printed no output.
(This sometimes results from failing to place a RUN statement before the ODS PDF CLOSE
statement.)
My code:
ods _all_ close;
ods pdf file="&path.AppendixC.pdf";
data _null_;
set formats2;
by sort;
/*Longest name is 11, Type is 9, Value is 16, Label is 50.*/
put @1 Name @12 Type @23 Value @37 Label1;
if label2 ne "" then do;
put @37 Label2;
end;
if label3 ne "" then do;
put @37 Label3;
end;
if label4 ne "" then do;
put @37 Label4;
end;
if label5 ne "" then do;
put @37 Label5;
end;
run;
ods pdf close;
Thanks,
Megan
Yes, thanks. I ended up getting this to work. 🙂
ods listing close;
ods pdf file="&path.AppendixC.pdf";
proc report data=Formats3 nowd headline headskip wrap;
column first_name first_type value label;
define first_name / width=12 "Format Name";
define first_type / width=9 "Type";
define value / width=16 "Value";
define label / width=254 "Label";
run;
ods pdf close;
Without a file statement in the data step, put will always write to the log, not the output destination.
When creating HTML, I often open the HTML destination with no_bottom_matter, close it, write some text to the file with a data _null_; and file .... mod;, and then reopen the same file in ODS HTML with no_top_matter and mod after the fileref.
Don't know if a similar trick is possible (and makes sense) with ods pdf.
Thanks. I added the file line to it and that kept it from writing to the log window, but i still got the same
1097 ods pdf close;
NOTE: ODS PDF printed no output.
(This sometimes results from failing to place a RUN statement before the ODS PDF CLOSE
statement.)
It did create a pdf, but it wont' open:
Adobe Acrobat DC could not open "AppendixC.pdf" because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF.
Took a look at the ODS PDF documentation. You cannot manually write additional data to a PDF destination like you can with the HTML destination.
So, data _null_ is out, and you must create your output with the proper procedures (proc print, proc report, the graphic procedures, or proc sql with a select) when writing to the PDF destination.
Ok, thanks. Back to the drawing board!! 🙂
From I can see you are attempting it may be that reshaping your data and proc report would work. A hint: if you want to see different variables in the same column in output that you want to transpose data creating a different variable whose values become the column enteries.
Your example I think would work with Proc Report with Name Type and Value as Group variables.
Yes, thanks. I ended up getting this to work. 🙂
ods listing close;
ods pdf file="&path.AppendixC.pdf";
proc report data=Formats3 nowd headline headskip wrap;
column first_name first_type value label;
define first_name / width=12 "Format Name";
define first_type / width=9 "Type";
define value / width=16 "Value";
define label / width=254 "Label";
run;
ods pdf close;
Great that you found a solution.
Remark: You can write to the PDF destination using a data _null_ step: Just add
file print;
to the data step in order to redirect the output from the log to the output destination (which is the PDF file after the ODS PDF and ODS listing close statements).
That did work too, thanks!
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.