BookmarkSubscribeRSS Feed
somkamalin
Calcite | Level 5

I have variables trt and  trt(n=200). In mean plot automation process (GTL), I want to apply discreteattribmap from dataset  to trt which is already there in input dataset but want to display only trt(n=200)  in legend.   trt(n=200) is generated while running GTL which i cant assign attrimmap before running code. I tried with linecolor = trt. in series plot. .It displayed both trt, trt(n=200).   but only want trt(n=200) in legend..   Can any one help me?.

7 REPLIES 7
ballardw
Super User

I think that you will need to show at a minimum your existing GTL code and the Proc Sgender used to create the graphs.

Possibly example data as well.

Since " trt(n=200)" is an unlikely variable name it isn't clear exactly what this is supposed to represent when you say "I have variables trt and  trt(n=200). "

somkamalin
Calcite | Level 5
sorry for the confusion. trt variable takes character values 'Drug A' and
trt(n=200) is not variable name . You can rename it as trtn which takes
value 'Drug A (n=200)'.. I will send the code shortly.
somkamalin
Calcite | Level 5

 

output is attached. discreteattribmap working for scatter but not matching with line color from 'line' of series plot. I need line,symbol color,symbol shape need to merged in legend and plot. can anybody help?

trt= 'Drug A' or 'Drug B'

trtn= 'Drug A(n=200)' or 'Drug B(n=230)'

 

proc template;
define statgraph order;
begingraph;
layout overlay/yaxisopts=(label="Concenration mg/L")
xaxisopts=(label="Week");
ScatterPlot
X=ndy Y=meancon / GROUP=trt NAME="scatter"
YErrorLower=EVAL(meancon-stdcon)
YErrorUpper=EVAL(meancon+stdcon);
SeriesPlot X=ndy Y=meancon / GROUP=trtn name = 'line' ;
mergedlegend 'scatter' 'line' / ;
;
EndLayout
;
EndGraph
;
END;
RUN;

ods rtf file = 'C:\Users\sasgraph_lib\meanplot1.rtf' style = mystyle;
PROC SGRENDER DATA=pk2 dattrmap = sym TEMPLATE=order
; dattrvar trt ='kk' ;
RUN;

 

quit;

ods rtf close;
ods listing;

somkamalin
Calcite | Level 5

main aim is to :   1.  color , shape of line , symbol with  "trt" from discreteattribmap applied to trt .

2. make legend with trtn which has count as above. 

3. line  and symbol merged in legend.

 

Can anybody give hint or suggestion  on this ?. Thanks.

ballardw
Super User

Why do you have two different group variables if they should display as a single item on the legend?

All the examples if find using MERGEDLEGEND show use of the same GROUP variable.

somkamalin
Calcite | Level 5

trt is from input data set which i am assigning discreteattribmap for color , symbol, line type. But trtn generated during GTL run which I cant assign discreteattribmap beforehand. only difference  between them is suffix count. I need only legend with trtn. Main aim is  to get discreteatribmap directly from input data set.

somkamalin
Calcite | Level 5

No response yet.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1432 views
  • 0 likes
  • 2 in conversation