Hi All, I have a variable named "company" with six "product" categories. I am able to assign different colors but I am unable to assign different lines patterns. For example, I tried assigning the first three "dash" and the subsequent three "solid" but it does not work. Thanks.
proc sgplot data=in;
inset 'Types' / textattrs=GraphLabelText;
style attrs
datacontrastcolors=(blue black red green orange purple)
datalinepatterns=(dash dash dash solid solid solid);
yaxis label='Unit $';
series x=Qtr y=company / group=product;
run;
Yes, there is no space in the styleattrs and there was no error in the code. The code actually needed the AttrPriority=None in the ods graphics section. Thanks.
ods graphics / AttrPriority=None;
Doesn't work is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the "<>" to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. 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.
One thing, the code that you show uses "style attrs". The statement requires "styleattrs", one word, no space and if the code you submitted had the space it was a syntax error and wouldn't apply the attributes.
When I dummy up some data to make a simple series plot it get 3 dashed (blue black and red) and 3 solid lines (green orange (not notable orange on my monitor but that's not uncommon) and purple.
data example; do product=1,2,3,4,5,6; do qtr=1 to 10; company= qtr/product; output; end; end; run; proc sgplot data=example; inset 'Types' / textattrs=GraphLabelText; styleattrs datacontrastcolors=(blue black red green orange purple) datalinepatterns=(dash dash dash solid solid solid); yaxis label='Unit $'; series x=Qtr y=company / group=product; run;
Recommend providing example data in the form of a data step if you want us to make something that works with your data.
Yes, there is no space in the styleattrs and there was no error in the code. The code actually needed the AttrPriority=None in the ods graphics section. Thanks.
ods graphics / AttrPriority=None;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.