BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
atnk
Fluorite | Level 6

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; 

1 ACCEPTED SOLUTION

Accepted Solutions
atnk
Fluorite | Level 6

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;

 

View solution in original post

2 REPLIES 2
ballardw
Super User

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.

 

atnk
Fluorite | Level 6

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;

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 616 views
  • 0 likes
  • 2 in conversation