BookmarkSubscribeRSS Feed
KevinViel
Pyrite | Level 9

I created a forest plot with multiple rows for a data set with several outcomes.  For another task, I wish to have several needle plots for each level of a variable GROUP.  The do I need multiple LAYOUT statements:

 

layout overlay ;

  needleplot x = AA
                    y = HLA_y1
                 / group = HLA_BindingLevel1
                   index = HLA_binding1
                   lineattrs = ( pattern = solid )
                   ;
endlayout ;

 

layout overlay ;

  needleplot x = AA
                    y = HLA_y2
                 / group = HLA_BindingLevel2
                   index = HLA_binding2
                   lineattrs = ( pattern = solid )
                   ;
endlayout ;

 

or am I missing something and I should be able to concatenate the data into rows instead of columns and have one such statement:

 

layout overlay ;

  needleplot x = AA
                    y = HLA_y
                 / group = HLA_BindingLevel
                   index = HLA_binding
                   lineattrs = ( pattern = solid )
                   ;
endlayout ;

 

I want to include AXISTABle statements, too, to provide summary details such as the name of the row and the number of needles above a threshold.

 

Thank you,

 

Kevin

4 REPLIES 4
ballardw
Super User

My first approach if I needed similar plots for each level of a variable would be to get the plot working for one level and then sort the data by the variables that are needed for each level and use a BY statement;

 

proc sgrender data=have template=templatename;

  by levelvar;

  <other options>;

run;

 

KevinViel
Pyrite | Level 9

With the disclaimer that I have not tested your code, I need the needleplot stacked for comparison.  A draft is attached.  For the GMAP version of these maps, I stacked 40 different rows.

 

This graph was created with multiple LAYOUT statements.

 

 

Thank you,

 

Kevin


SGRender.gif
ballardw
Super User

You have a couple of options for the basic graph. One would be DATAPANEL:

layout datapanel classvars=(classificationvariable) /  ROWS=3
<other datapanel options>; layout prototype; <needleplot stuff goes here> endlayout; endlayout;

You can actually specify numbers of rows and columns to get side-by-side and stacked. By default each panel of the graph will have a header like "ClassificationVariable= Level of Variable" and will display the formatted value if you specify a format.

 

To provide number of needles it may be easiest to presummarize the data and have a variable with one value per classification level with the value and use an INSET option on the datapanel statement and INSETOPTS to control where in the plot it appears.

If you have lots of rows you will also likely have to increase the amount of space available to display everything by adjusting the ODS height option:

 

ods graphics /height=15in; or similar.

 

If you have exactly 2 classification variables you could use DATALATTICE.

Ksharp
Super User

OhOh. It is about ODS Graphics, Plz post it at 

SAS/GRAPH and ODS Graphics

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1468 views
  • 1 like
  • 3 in conversation