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?
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;
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:
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.
Ready to level-up your skills? Choose your own adventure.