Hello,
With this syntax:
proc sgplot data=plot ;
vbox value / category=DV group=genre ;
run;
SGPLOT produces a VBOX with different colors for the two groups defined in GROUP=
See graphs below.
Instead, I would like the two levels of groups (liteary and popular) to have different patterns (for instance, small dots for one and small x for the other).
I have been looking into various options with ATTRMAP, but I do not seem to be able to get it.
Suggestions?
I think you are saying that you want the symbols for the markers to be different for the different groups? If so, consider using ATTRPRIORITY=NONE
ods graphics / attrpriority=none;
proc sgplot data=sashelp.cars(where=(origin^="USA"));
vbox mpg_city /group=origin;
run;
For more on this topic, see "The interaction between ATTRPRIORITY, CYCLEATTRS, and STYLEATTRS in ODS graphics," which describes all the ways that you can get the group attributes to vary.
Fill patterns are sort of out of style. SAS supports some line styles, left right and cross with different weight lines.
proc sgplot data=sashelp.class; styleattrs datafillpatterns=( L1 X2); vbox height /group=sex fillpattern nofill; ; run;
The styleattrs sets the first fill to a left slanting light weight line and the second to across slightly heavier lines.
Fill pattern in the plot says to use them and the NOFILL removes the background color.
Hello,
thanks, but it does not seem to be working. See the adapted syntax and result below.
proc sgplot data=plot ;
styleattrs datafillpatterns=( L1 X2);
vbox value / category=DV group=genre fillpattern nofill;
run;
Produces this result:
I think you are saying that you want the symbols for the markers to be different for the different groups? If so, consider using ATTRPRIORITY=NONE
ods graphics / attrpriority=none;
proc sgplot data=sashelp.cars(where=(origin^="USA"));
vbox mpg_city /group=origin;
run;
For more on this topic, see "The interaction between ATTRPRIORITY, CYCLEATTRS, and STYLEATTRS in ODS graphics," which describes all the ways that you can get the group attributes to vary.
hello Rick,
yes, that worked!
Thank you.
E
How about Discrete Attribute Map Data Sets ?
data plot;
do DV='Legal BERT', 'BERT';
do genre = "literary", "popular";
k+1;
do i = 1 to 64+k;
value = rannor(42)+k;
output;
end;
end;
end;
run;
data DiscreteAttributeMapDS;
length linecolor $ 9 fillcolor $ 9 markersymbol markercolor $ 20;
input ID $ value $ linecolor $ fillcolor $ markersymbol $ markercolor $;
datalines;
MYID literary red pink CircleFilled gold
MYID popular blue lightblue Star green
;
run;
proc sgplot data=plot DATTRMAP=DiscreteAttributeMapDS;
vbox value / category=DV group=genre ATTRID=MYID;
run;
Bart
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.