BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Multipla99
Quartz | Level 8

Does anyone have experience from printing thousands of SGPLOT graphs to paper?

 

I need to check approximately 3 500 timeseries of aggregated data to spot those that are less well behaved and therefore could hide some erroneous microdata. My idea is to put them on paper, say 21 graphs on each in 3 columns and 7 rows, and then glance through each paper to quickly discover those abnormal.

 

The timeseries are independent in the aspect that they do not share any axis. They should also be ordered on the paper so that each row is filled from left to right before moving to the next row. Each graph also needs to have its own heading to identify the variable plotted.

 

How can I arrange my ODS output so that each rendered graph will find its correct place on my paper? Does anyone have an idea?

 

Please also find attached a wordfile where I, for illustration, manually put the same timeseries graphs in each cell of a 3x7 table.         

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

On ODS PDF statement you can specify the number of columns in a file.
Then you can control the size of graphics generated with ODS GRAPHICS statements.

The graphs will be created from top to bottom and then across the columns so your code needs to create the graphs in the correct order. That will create the PDF file with all your graphics.

 


%macro create_graphs(n=);
ods graphics / height = 2in width= 2in;
%do i=1 %to &n;

title "Graph &i.";
proc sgplot  data=sashelp.class;
scatter x=height y=weight /group=sex;
run;

%end;

%mend;

ods pdf file='/home/fkhurshed/Demo1/sample1.pdf' columns=3 style = meadow startpage=no;

%create_graphs(n=12);

ods pdf close;

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

Even if you had 30 times series, I would plot them to some FILE and then scroll through them. The days of dumping large amounts of output to paper are long gone, and putting all of this on paper is inefficient and wasteful and environmentally unfriendly.

 

With 3500 anything, I think you need some computerized checking to look for "less well behaved and therefore could hide some erroneous microdata". What that computerized checking to use would be hard to determine, as "less well behaved" isn't really definitive enough to provide more information. But there are computerized outlier detection routines, and computerized checks for different time series types of problems, maybe that's a place to start. Or maybe some other testing is what you want. 

 

PROC SGPLOT can plot all of your time series and send it to a file. 

--
Paige Miller
Multipla99
Quartz | Level 8

Thank you, PaigeMiller, for your interest in my problem.

 

To be more specific the problem I would like to solve is how to print timeseries graphs to a paper format ordered in rows and columns so that I can fit as many graphs as convenient on each page. I'm perfectly aware that I can print SGPLOT graphs to a file but I do not know how to order them in rows and coclumns. 

PaigeMiller
Diamond | Level 26

As stated, you can get PROC SGPLOT to print in columns and rows. Why is this needed? Why couldn't you work with plots that are not in columns and rows?

--
Paige Miller
Reeza
Super User

You did not include any attachments, sample data or examples of output. 

Multipla99
Quartz | Level 8

Thank you, Reeza, for your hint. I thought that I added an example of what I actually wanted but the file didn't seem to get through. I have now added it to this reply and I hope it will get through. I will also see if I can add some code examples later today or tomorrow.

Reeza
Super User

On ODS PDF statement you can specify the number of columns in a file.
Then you can control the size of graphics generated with ODS GRAPHICS statements.

The graphs will be created from top to bottom and then across the columns so your code needs to create the graphs in the correct order. That will create the PDF file with all your graphics.

 


%macro create_graphs(n=);
ods graphics / height = 2in width= 2in;
%do i=1 %to &n;

title "Graph &i.";
proc sgplot  data=sashelp.class;
scatter x=height y=weight /group=sex;
run;

%end;

%mend;

ods pdf file='/home/fkhurshed/Demo1/sample1.pdf' columns=3 style = meadow startpage=no;

%create_graphs(n=12);

ods pdf close;
Multipla99
Quartz | Level 8
Thank you so much, Reeza!
Exactly what I wanted, and you provided as well the code before I did. Hats off!

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
  • 7 replies
  • 624 views
  • 3 likes
  • 3 in conversation