05-14-2017 05:03 PM
I'm trying to create a scatter plot with two continuous variables. I'd then like to colour the plots according to a third, categorical variable.
Is this possible?
My code so far is
proc sgplot data = sasuser.data1;
scatter x = tradingyears y = sales2015;
05-14-2017 05:56 PM
Try adding the third variable as a GROUP var in your scatter statement. Example 1 in the documentation covers this
If you want to control the colours see the post below
Possibly more than you need now, but good to know:
05-14-2017 06:56 PM
I'm not sure what you mean by 'whole plot'?
Colours are usually defined by the Style set. If you're using SAS Studio this is likely HTMLBlue. For publications the style Journal/Journal1 are good. For a clean compact look, I like the Seaside and Meadow styles. Finally, there's a post on here that has the style definition in the style of Stephen Few.