- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 10-20-2024 10:51 PM
(434 views)
I have a csv data set that looks something like this:
Now, I am looking to produce a PDF report that has all of the state info in the data set on one page like this:
The code I have to attempt this is the following:
proc import datafile = "path to csv file" out=StateDataSet dbms=csv replace; run; ods pdf file = "path to store pdf file"; proc print data = StateDataSet NOOBS label; format Area Comma7.0 Population Comma10.0; title ; label State_Name = 'State Name'; label State_Abbrev = 'State Abbrev.'; label Postal_Abbrev = 'Postal Abbrev.'; label Area = 'Area (Sq Mi)'; run; ods pdf close;
However, the PDF produced stretches 2 pages, and it is in a table format. How can I format it, so that it is all in one page and it doesn't come out in the table format to replicate the example?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need customize your page size by "options papersize=(.....)".
proc freq data=sashelp.zipcode;
table STATENAME/out=StateDataSet;
run;
options nodate nonumber papersize=(21cm 38cm) ;
ods pdf file = "c:\temp\temp.pdf" style=journal ;
proc print data = StateDataSet NOOBS label ;
title ;
label STATENAME = 'State Name';
run;
ods pdf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is the proc freq for? I tried out the papersize options and the style, but the report wasn't quite in a format like below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I wrote a PROC FREQ is just to make a sample data since you did not post a data.
You can delete PROC FREQ and use your original dataset to PROC PRINT.
" but the report wasn't quite in a format like "
What do you mean by that ? you can format your report as your wish/code :
options nodate nonumber papersize=(21cm 38cm) ;
ods pdf file = "c:\temp\temp.pdf" style=journal ;
proc print data = StateDataSet NOOBS label ;
format Area Comma7.0 Population Comma10.0;
title ;
label State_Name = 'State Name';
label State_Abbrev = 'State Abbrev.';
label Postal_Abbrev = 'Postal Abbrev.';
label Area = 'Area (Sq Mi)';
run;
ods pdf close;
You can delete PROC FREQ and use your original dataset to PROC PRINT.
" but the report wasn't quite in a format like "
What do you mean by that ? you can format your report as your wish/code :
options nodate nonumber papersize=(21cm 38cm) ;
ods pdf file = "c:\temp\temp.pdf" style=journal ;
proc print data = StateDataSet NOOBS label ;
format Area Comma7.0 Population Comma10.0;
title ;
label State_Name = 'State Name';
label State_Abbrev = 'State Abbrev.';
label Postal_Abbrev = 'Postal Abbrev.';
label Area = 'Area (Sq Mi)';
run;
ods pdf close;