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.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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