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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 105 views
  • 0 likes
  • 2 in conversation