BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ambadi007
Quartz | Level 8
proc sgpanel data=have DATTRMAP = attrmap_&data. NOAUTOLEGEND;
  panelby TRT/ columns=2 sort=descending novarname /*noheader */HEADERATTRS=(Color=Black  Size=8 
        );
 
  reg x=RESPONSE y=&COMPARE. /group=TRT
   attrid = my_id   ;
   refline 0 / axis=x lineattrs=(thickness=0.5 color=red pattern=solid )transparency=0.5;
   refline 0 / axis=y lineattrs=(thickness=0.5 color=red pattern=solid )transparency=0.5;
   %if &data.=615 %then %do;
   inset rcorr / nolabel position=bottomright ;
   %end;
   %else %if &data.=6142 or &data.=6122 or &data.=6112  %then %do;
   inset rcorr / nolabel position=topleft ;
   %end;
   %else %do;
   inset rcorr / nolabel;
   %end;
run;

Hi ,

could you please tell me how to create a single graph for multiple treatments, for example I need to show TRTA, TRTB,TRTB data in a single graph (Scatter Plot) I am using SG panel now. but I am getting different graphs for different treatments.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@ambadi007 wrote:
proc sgpanel data=have DATTRMAP = attrmap_&data. NOAUTOLEGEND;
  panelby TRT/ columns=2 sort=descending novarname /*noheader */HEADERATTRS=(Color=Black  Size=8 
        );
 
  reg x=RESPONSE y=&COMPARE. /group=TRT
   attrid = my_id   ;
   refline 0 / axis=x lineattrs=(thickness=0.5 color=red pattern=solid )transparency=0.5;
   refline 0 / axis=y lineattrs=(thickness=0.5 color=red pattern=solid )transparency=0.5;
   %if &data.=615 %then %do;
   inset rcorr / nolabel position=bottomright ;
   %end;
   %else %if &data.=6142 or &data.=6122 or &data.=6112  %then %do;
   inset rcorr / nolabel position=topleft ;
   %end;
   %else %do;
   inset rcorr / nolabel;
   %end;
run;

Hi ,

could you please tell me how to create a single graph for multiple treatments, for example I need to show TRTA, TRTB,TRTB data in a single graph (Scatter Plot) I am using SG panel now. but I am getting different graphs for different treatments.


Are all these treatments in one data set? Likely the easiest and more robust approach would be to reshape your data so you have a new variable that holds treatment name with values of TRTA, TRTB, (assuming the second TRTB is misspelled) and TRTC (or later TRTD, TRTE ...). Then use that variable as the Panelby variable.

 

Or at least provide example data of your Have data set. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

 

You may want to consider learning to use the MINOPERATOR MINDELIMITER options so you can use IN comparisons instead of writing stuff like this:

   %else %if &data.=6142 or &data.=6122 or &data.=6112  %then %do;

View solution in original post

1 REPLY 1
ballardw
Super User

@ambadi007 wrote:
proc sgpanel data=have DATTRMAP = attrmap_&data. NOAUTOLEGEND;
  panelby TRT/ columns=2 sort=descending novarname /*noheader */HEADERATTRS=(Color=Black  Size=8 
        );
 
  reg x=RESPONSE y=&COMPARE. /group=TRT
   attrid = my_id   ;
   refline 0 / axis=x lineattrs=(thickness=0.5 color=red pattern=solid )transparency=0.5;
   refline 0 / axis=y lineattrs=(thickness=0.5 color=red pattern=solid )transparency=0.5;
   %if &data.=615 %then %do;
   inset rcorr / nolabel position=bottomright ;
   %end;
   %else %if &data.=6142 or &data.=6122 or &data.=6112  %then %do;
   inset rcorr / nolabel position=topleft ;
   %end;
   %else %do;
   inset rcorr / nolabel;
   %end;
run;

Hi ,

could you please tell me how to create a single graph for multiple treatments, for example I need to show TRTA, TRTB,TRTB data in a single graph (Scatter Plot) I am using SG panel now. but I am getting different graphs for different treatments.


Are all these treatments in one data set? Likely the easiest and more robust approach would be to reshape your data so you have a new variable that holds treatment name with values of TRTA, TRTB, (assuming the second TRTB is misspelled) and TRTC (or later TRTD, TRTE ...). Then use that variable as the Panelby variable.

 

Or at least provide example data of your Have data set. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

 

You may want to consider learning to use the MINOPERATOR MINDELIMITER options so you can use IN comparisons instead of writing stuff like this:

   %else %if &data.=6142 or &data.=6122 or &data.=6112  %then %do;

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
  • 1 reply
  • 585 views
  • 0 likes
  • 2 in conversation