BookmarkSubscribeRSS Feed
MaryA_Marion
Lapis Lazuli | Level 10

Here is the basic code:

proc sgplot data=df;
vline G / response=fits stat=mean;
run;

I am doing the same thing for variables A-F. I want to panel them making a main effects mean plot for the response.

Can you help with the syntax? My problem with this is that the variables A-G are continuouos covariates and not levels of a factor.

I think it may be appropriate to use proc sgpanel. Right now I am doing these one at a time using sgplot code.

Formerly, proc gplot was used with proc greplay but I am assuming SAS has upgraded this approach. I am trying to keep this simple.

 

Thank you.

 

6 REPLIES 6
ballardw
Super User

Data example?

You likely want to add a variable to indicate which "panel" a specific graph belongs in. This might mean restructuring the data, possibly with Proc Transpose so that you have a variable indicating the original variable name. Then use Panelby statement with that new variable.

Likely there is more work involved in reshaping the data then the Sgpanel code.

MaryA_Marion
Lapis Lazuli | Level 10

Thank you for the reply. I wanted a verbal response at first. I am having difficulties making a flow diagram of how to prepare the panel plot. I am enclosing a sample data set this time ( modified  on 12-03 9:05am).

 

Rick_SAS
SAS Super FREQ

Can you say more about what you are trying to accomplish?

 

In your program, you use PROC GENMOD to fit a regression surface that models the response Y as a linear function of the continuous covariates A, B, and C.  Do you want to visualize slices through that surface as a function of each covariate while holding the other covariates fixed at their mean values? If so, use the EFFECTPLOT statement. One choice is as follows:

proc genmod data=so;
model y = a b c / dist = normal link=identity lrci obstats;
output out=sonorm pred=fits STDRESDEV=Z;

effectplot fit (x=a);
effectplot fit (x=b);
effectplot fit (x=c);
run; quit;

 

MaryA_Marion
Lapis Lazuli | Level 10

In my effort to understand verbal instructions I missed the obvious. Here is a similar graph to what I am doing. Just reduce # of variables down to A B C.

MaryA_Marion_0-1638482391093.png

 

MaryA_Marion
Lapis Lazuli | Level 10

I need simple means plots that are panelled. Do I want to use sgplot or sgpanel to do it? I was hoping to modify my sgplot code to output a panel. I can transpose like was mentioned. Then A B C become like subjects (rows in dataset)?

MaryA_Marion
Lapis Lazuli | Level 10

Here is an updated sas file.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 2718 views
  • 0 likes
  • 3 in conversation