Categorical scatterplots similar to PRISM?

Reply
Occasional Contributor
Posts: 12

Categorical scatterplots similar to PRISM?

The title says it all, I'm trying to generate a scatterplot similar what PRISM can do. Has anyone tried to do something similar in SAS?

http://i.stack.imgur.com/z53zB.gif

Trying a categorical x-axis only creates a column of dots with the corresponding values.

proc sgplot data=sashelp.class;

  scatter x=sex y = height

  /MARKERATTRS  =(symbol=circlefilled);

  run;

I appreciate your feedback.

SAS Super FREQ
Posts: 3,754

Re: Categorical scatterplots similar to PRISM?

I don't know what PRISM is, but it looks like you have a jittered scatter plot with median and 1st and 3rd quartiles(?).  And the markers are assigned attributes by groups. Try this to start. It is from Sanjay's blog post Custom Box Plots - Graphically Speaking  This code requires SAS 9.4.

proc means data=sashelp.cars noprint;
  class Origin;
  var mpg_highway;
  output out=Quantiles(where=(_type_=1))
         median=Median q1=Q1 q3=Q3;
run;

proc sort data=sashelp.cars out=sorted;
by Origin;
run;

/* merge quantiles with sorted data */
data sorted;
set Quantiles sorted;
by Origin;
run;

proc sgplot data=sorted noautolegend;
  scatter x=Origin y=mpg_highway / jitter group=Origin;
  highlow x=Origin high=q3 low=median / type=bar nofill;
  highlow x=Origin high=median low=q1 / type=bar nofill;
run;

Occasional Contributor
Posts: 12

Re: Categorical scatterplots similar to PRISM?

Ah, Jitter is the term I was looking for. Thanks for your reminding me and for the sample code.

Best

Ask a Question
Discussion stats
  • 2 replies
  • 572 views
  • 3 likes
  • 2 in conversation