BookmarkSubscribeRSS Feed
Doug____
Pyrite | Level 9

I need to create a series of scatter plots four per page for laboratory parameters. They all need to be contained in one RTF and must have varying axis labels, titles and y-axis scales. Can this be done with SGPANEL?

5 REPLIES 5
ballardw
Super User

@Doug____ wrote:

I need to create a series of scatter plots four per page for laboratory parameters. They all need to be contained in one RTF and must have varying axis labels, titles and y-axis scales. Can this be done with SGPANEL?


What have you tried?

When you say "four per page" do you mean a specific 2 by 2 graph layout, 4 separate, one graph panel with 4 graphs vertically or horizontally aligned?

With SGPANEL if you have graphs side-by-side they would have the same vertical axis definition. If you want side-by-side with different y scales you likely need to move to the Graphics Template Language and possibly a Layout LATTICE or Layout DATALATTICE structure.

 

 

Can you provide some data that represents what you want to graph as a data step that we could attempt?

 

Doug____
Pyrite | Level 9

I'm just getting started with it. The layout would be 2x2 per page and each graph would show baseline values on the x-axis and the visit of interest value on the y-axis. Each plot within the parameter would show a different visit. So for example page 1 would show the results for Platelets let's say for Visits 1, 2, 3, 4, then the second page would start at visit 5 - 8, etc. for as many as are needed. Then there would be a page break to the next parameter and it repeats. I don't have any example data so the x and y values could be any integer or floating point number depending on the test conducted. 

Doug____
Pyrite | Level 9

In addition the axis values would be set once per parameter so all the plots look the same within the test analyzed. The y-axis labels would reflect at which visit the analysis takes place and would vary with each plot within the grid.

Doug____
Pyrite | Level 9

I ginned up the following dummy data so if I can get the code working for this then it will work for my example as well.

 

data x;

do trtp = "A", "B";
do i = 1 to 100;
paramcd = "X";
do visit = 1 to 4;
base = ranuni(-1)*10;
aval = ranuni(-1)*1000;
output;
end;
end;

do i = 1 to 100;
paramcd = "Y";
do visit = 1 to 7;
base = ranuni(-1)*40;
aval = ranuni(-1)*50;
output;
end;
end;
end;

run;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

As there are differing attributes for each, I would suggest looking at gridded in graph template label:

http://support.sas.com/documentation/cdl/en/grstatug/62464/HTML/default/viewer.htm#p1hc9zh9cfvelkn11...

 

With this, and dynamic variables you could have the four graphs, gridded, with labels and axis passed in by dynamic variables.  Then you can call this template with a call execute from datastep with each block of data.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1876 views
  • 0 likes
  • 3 in conversation