
Tuesday
DanH_sas
SAS Super FREQ
Member since
06-23-2011
- 1,847 Posts
- 161 Likes Given
- 309 Solutions
- 1,058 Likes Received
About
SAS/Graph
ODS Graphics
-
Latest posts by DanH_sas
Subject Views Posted 229 Tuesday 1065 2 weeks ago 1092 2 weeks ago 1112 2 weeks ago 1125 2 weeks ago 298 a month ago 760 a month ago 852 02-10-2025 02:19 PM 1003 02-10-2025 01:57 PM 1024 02-10-2025 01:44 PM -
Activity Feed for DanH_sas
- Got a Like for Re: Coloring sgplot lines by indicator variable value. Wednesday
- Got a Like for Re: Coloring sgplot lines by indicator variable value. Wednesday
- Got a Like for Re: Coloring sgplot lines by indicator variable value. Tuesday
- Posted Re: Coloring sgplot lines by indicator variable value on Graphics Programming. Tuesday
- Got a Like for Re: SGPlot Bar with min and max values. 2 weeks ago
- Got a Like for Re: SGPlot Bar with min and max values. 2 weeks ago
- Got a Like for Re: SGPlot Bar with min and max values. 2 weeks ago
- Got a Like for Re: SGPlot Bar with min and max values. 2 weeks ago
- Posted Re: SGPlot Bar with min and max values on Graphics Programming. 2 weeks ago
- Got a Like for Re: SGPlot Bar with min and max values. 2 weeks ago
- Got a Like for Re: SGPlot Bar with min and max values. 2 weeks ago
- Posted Re: SGPlot Bar with min and max values on Graphics Programming. 2 weeks ago
- Posted Re: SGPlot Bar with min and max values on Graphics Programming. 2 weeks ago
- Posted Re: SGPlot Bar with min and max values on Graphics Programming. 2 weeks ago
- Got a Like for Re: How to display subscript in proc sgplot in y axis for multiple PK parameters in box plot. a month ago
- Got a Like for Re: How to display subscript in proc sgplot in y axis for multiple PK parameters in box plot. a month ago
- Posted Re: How to display subscript in proc sgplot in y axis for multiple PK parameters in box plot on Graphics Programming. a month ago
- Liked Re: box not plotting with 2 y axes for Quentin. a month ago
- Posted Re: box not plotting with 2 y axes on Graphics Programming. a month ago
- Liked Re: box not plotting with 2 y axes for Quentin. 02-10-2025 08:46 PM
-
Posts I Liked
Subject Likes Author Latest Post 5 3 4 12 6 -
My Liked Posts
Subject Likes Posted 4 Tuesday 1 2 weeks ago 1 2 weeks ago 2 2 weeks ago 2 2 weeks ago -
My Library Contributions
Tuesday
4 Likes
Along with the code you have, add the LCGROUP option to the SERIES to specify the variable that contains the binary values. LC stands for "LineColor". The SERIES plot has the ability to assign multiple "group" variable to the plot to control different attributes, including line color, line patterns, marker color, and marker shape.
If you want specific colors for each of the binary values, I would use a discrete attributes map to assign the color to the value. In the end, you code will look something like the following:
data my_attrmap;
retain ID "ind_colors";
input value linecolor $;
cards;
0 blue
1 red
;
run;
proc sgplot data=mydata dattrmap=my_attrmap;
series y=outcome x=time / group=type grouplc=indicator lcattrid=ind_colors;
run;
Hope this helps!
... View more
2 weeks ago
1 Like
There are a different ways to do this. If it were me, I would put the MIN/MAX values in an XAXISTABLE. Try add this statement and see if you like it:
xaxistable min max / position=top location=inside;
If you want all three on the end of the bar, it can be done with TEXT plots, but it will take more work to either determine the correct locations or do some string manipulations with your data. Try the axis table first and see what you think.
... View more
2 weeks ago
1 Like
If the DATALABEL option does not work for you due to the limit bars, you can use a TEXT plot to put the labels on the bars. Put this after your SERIES statement:
text x=Fascia y=Percentuale text=Percentuale / position=bottom;
You can use TEXTATTRS on the statement to customize the text appearance.
... View more
2 weeks ago
2 Likes
The CSV has the response values already formatted, so I couldn't try this solution out, but try the following:
Add a SERIES plot after the VBARPARM statement to draw the line: series x=Fascia y=Percentuale / smoothconnect;
On the VBARPARM, add GROUPDISPLAY=CLUSTER. This will allow the group colors to be applied to the bars and also display the limit bars.
Hope this helps!
... View more
a month ago
2 Likes
You will need to use Unicode for the characters. The following is an example. Be sure to use a full-featured Unicode font. In this case, I chose "Times New Roman Uni", as you where using a serif-based font. Hope this helps!
ods escapechar '~';
proc sgplot data=sashelp.class;
vbox weight / category=sex;
yaxis label="AUC~{Unicode '2097'x}~{Unicode '209B'x}~{Unicode '209C'x}(h*ng/ml)" labelattrs=(family="Times New Roman Uni");
run;
... View more
a month ago
What is your goal in setting WHISKERPCT=25? Are you trying to make the whiskers go away?
... View more
02-10-2025
02:19 PM
No, I did not apply any data jittering here. I think you hit the correct root cause.
... View more
02-10-2025
01:57 PM
I made up this little test at 9.4.m7 and it seems to work. Can you try it and see if it works for you?
proc sgplot data=sashelp.heart;
vbox cholesterol / category=ageatstart group=weight_status;
vbox cholesterol / category=ageatstart group=weight_status y2axis;
y2axis type=log logbase=2;
run;
... View more
02-10-2025
12:48 PM
Are the axes showing values? It might be helpfully to see a image of your output.
... View more
02-10-2025
12:44 PM
I noticed the LOG axis request. Are all of the values of "aval2" greater than zero?
... View more
02-04-2025
02:37 PM
3 Likes
Looking are your original code gain, I do not think you need to have separate SERIESPLOT and SCATTERPLOT statements. You can display the markers on the SERIESPLOT statement and control the marker attributes. Then, you can use one DISCRETELEGEND for all of your SERIESPLOT statements. For example,
seriesplot x=xval y=PK / name='PK' lineattrs=(color=red pattern=solid) yaxis=y legendlabel='PK (ng/mL)' display=(markers) markerattrs=(color=red symbol=circlefilled) yaxis=y datalabel=PK datalabelattrs=(size=6pt);
... View more
02-03-2025
10:53 PM
3 Likes
Here is a simple example of what I was describing:
proc template;
define statgraph merged;
begingraph;
layout overlay;
seriesplot x=ageatstart y=systolic / name="a1" lineattrs=GraphData1;
scatterplot x=ageatstart y=systolic / name="a2" markerattrs=GraphData1;
seriesplot x=ageatstart y=diastolic / name="b1" lineattrs=GraphData2;
scatterplot x=ageatstart y=diastolic / name="b2" markerattrs=GraphData2;
seriesplot x=ageatstart y=weight / name="c1" lineattrs=GraphData3;
scatterplot x=ageatstart y=weight / name="c2" markerattrs=GraphData3;
layout gridded / columns=3 border=true location=outside;
mergedlegend "a1" "a2" / border=false;
mergedlegend "b1" "b2" / border=false;
mergedlegend "c1" "c2" / border=false;
endlayout;
endlayout;
endgraph;
end;
run;
proc sgrender data=sashelp.heart(obs = 5) template=merged; run;
... View more
02-03-2025
01:41 PM
No, ADDTIONALNAMES just adds more "single" items to the merged items. The technique I described (multiple merged legends in the layout gridded) should work for you. Give it a try and let me know.
... View more