Programming the statistical procedures from SAS

TEMPLATE / NEEDLEPLOT / multiple rows

Reply
Frequent Contributor
Posts: 79

TEMPLATE / NEEDLEPLOT / multiple rows

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

Grand Advisor
Posts: 10,055

Re: TEMPLATE / NEEDLEPLOT / multiple rows

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;

 

Frequent Contributor
Posts: 79

Re: TEMPLATE / NEEDLEPLOT / multiple rows

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

Attachment
Grand Advisor
Posts: 10,055

Re: TEMPLATE / NEEDLEPLOT / multiple rows

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.

Grand Advisor
Posts: 9,463

Re: TEMPLATE / NEEDLEPLOT / multiple rows

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

SAS/GRAPH and ODS Graphics

Ask a Question
Discussion stats
  • 4 replies
  • 252 views
  • 1 like
  • 3 in conversation