Friday, March 2, 2012

Adding custom tips to GTL output

The default behavior for mouse over events is to show only the values being plotted. I contacted SAS tech support to find out how to display other variables in the output. The key is to use the rolename=(tip1=column) tip=(tip1) syntax shown below.

proc template ;
  define statgraph sgplot ;
    begingraph ;
      layout overlay ;
        ModelBand "G63LAMQ2" /  
          display=(outline) OutLineAttrs=GraphPredictionLimits 
          Name="MODELBAND" LegendLabel="95% Prediction Limits" ;
        ModelBand "G63LAMQ3" /  
          Name="MODELBAND1" LegendLabel="95% Confidence Limits" ;
        ScatterPlot X=Age Y=Weight / 
          rolename=(tip1=name tip2=sex tip3=age tip4=weight) 
          tip=(tip1 tip2 tip3 tip4) ;
        RegressionPlot X=Age Y=Weight / 
          NAME="REG" LegendLabel="Regression" clm="G63LAMQ3" cli="G63LAMQ2" ;
        DiscreteLegend "MODELBAND" "MODELBAND1" "REG" ;
      endlayout ;
    endgraph ;
  end ;
run ;

ods graphics / imagemap = on ;
ods listing close ;
ods html path='c:\temp' file='tips.html' ;

  proc sgrender data=sashelp.class template=sgplot ;
  run ;

ods html close ;
ods listing ;

No comments:

Post a Comment