Data visualization with SAS programming

Please help me to fix this problem!

Reply
Occasional Contributor
Posts: 6

Please help me to fix this problem!

Greetings.

I am quite new in SAS and I have been struggling to change the display of my boxplots from colored to filled patterns in the following codes:

I am using SAS 9.3. Please help me as I have tried everything possible to include the pattern fill attributes in the above code but I keep getting warnings and yet nothing changed!I prefer to differentiate the four group boxplots using fill patterns instead of colors. Please what adjustment do I need to make in the above code to actualize this?


Thanks in advance for helping me out.


Regards,


Jaco

SAS Super FREQ
Posts: 1,081

Re: Please help me to fix this problem!

Fill patterns are not supported for BoxPlot.

You can get empty boxes with different line patterns for the box.

If your data has groups (instead of 4 separate columns), you can use GROUP= .

Occasional Contributor
Posts: 6

Re: Please help me to fix this problem!

Thank you Sanjay@SAS for your swift reply. However, I am a bit confused on how I can use the GROUP= as I am still a newbie in SAS. Could you please elaborate further on how to actualize the empty boxplots with different line patterns, if you don't mind? I have attached the data I used to create the boxplots and the above codes worked pretty on them. The only thing I need is to change the default colors to fill patterns or empty boxes with line patterns. Please kindly help me.

SAS Super FREQ
Posts: 1,081

Re: Please help me to fix this problem!

ods listing style=journal;

proc sgplot data=sashelp.cars(where=(type ne 'Hybrid'));

  vbox mpg_city / category=Origin group=type nofill;

  run;

Occasional Contributor
Posts: 6

Re: Please help me to fix this problem!

Many thanks, Sanjay. I have just tried to incorporate vbox mpg_city / category=Origin group=type nofill into the code, but it seems I would only have empty boxes. Please how would I differentiate them with line patterns as you mentioned above? The graphs will be printed in black and white and therefore, colors are not allowed! Please help me. I am only a newbie and my level of understanding is quite low.

SAS Super FREQ
Posts: 1,081

Re: Please help me to fix this problem!

Each box in the graph uses a different line pattern for the box and the whisker by group.

BoxPlotEmpty.png

Maybe you can also use gray scale fill.

ods listing style=journal;

proc sgplot data=sashelp.cars(where=(type ne 'Hybrid'));

  vbox mpg_city / category=Origin group=type lineattrs=(pattern=solid)

       whiskerattrs=(pattern=solid);

  run;

BoxPlotFill.png

Occasional Contributor
Posts: 6

Re: Please help me to fix this problem!

Thank you Sanjay for taking your time to help me. I sincerely appreciate it!

Ask a Question
Discussion stats
  • 6 replies
  • 642 views
  • 0 likes
  • 2 in conversation