BookmarkSubscribeRSS Feed
fastb
Fluorite | Level 6

I have an example data set with 5 analytes (Analyte_a through Analyte_e).  I need to create box and whisker plots and histograms

for each of the analytes. I would like the plots to be written to a pdf file with the box and whisker plot and histogram for one analyte per page (so the

finished pdf would be 5 pages total).  I have written a macro, but it is always just one page long and it contains the plots for

the last analyte in the data set (Analyte_e).  Also, the page contains the pots for the last analyte in the list (Analytre_e), but the title in the header

is the name of the second to last analyte (Analyte_d).

-What coding do I need to add so the pdf file has one page per analyte and includes all analytes in the data set and the titles

in the header are for the correct analyte?

-The code that I have wtitten (plots.sas) and an example of the output that I have been creating (Test.pdf) are provided.

I am fairly new to writing macros; help is greatly appreciated!!

1 REPLY 1
Reeza
Super User

Try Move your ODS PDF statement before your loop starts and the ODS Close to after the loop ends.

sas-innovate-2024.png

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.

 

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
  • 962 views
  • 0 likes
  • 2 in conversation