BookmarkSubscribeRSS Feed
aebabinec
Calcite | Level 5

Hello, 

I am using the code from here: http://support.sas.com/kb/39/101.html

 

However, I need help modifying it--

 

using the sample data, supposed I had another variable denoting health-clinic. I need to produce the box plot for each clinic, so how can I modify the code to produce 50 graphs instead of one overall?

 

On these graphs, I also need a to add a reference point for that health-clinics unique value. (on the baseline plot and 15month plot, by measure (see sample data))

 

I.E. the 50 graphs (just like the one in Sample 39101) will be the exact same except for the unique markers for each practice.

 

Thank you!

 

SAMPLE DATA:

 

PracticeID  ClinicName  Measure   ProportionBL   Proportion15

6001             hdosnonds    aspirin         0.786                 0.897

6002             hskndon         aspirin         0.638                0.579

6003              hdonwod       aspirin         0.526                0.599

6001             hdosnonds    bloodp         0.986                 0.857

6002             hskndon         bloodp         0.238                0.903

6003              hdonwod       bloodp         0.436                0.822

5 REPLIES 5
Reeza
Super User

That example is from 2010, SGPLOT now supports box plots, but not sure they're what you want. 

An example is here:

https://support.sas.com/rnd/datavisualization/yourGraphs/analyticalQuick/vbox/

 

If you use SGPLOT then you can just add a BY statement for the CLINIC types to create a graph for each clinic.

 

Or try just adding a BY statement to the SGRENDER for clinics, It does seem to support BY group processing as well.

https://documentation.sas.com/?docsetId=grstatproc&docsetTarget=n131vj4eka12zpn1iwbqufke8l4z.htm&doc...


@aebabinec wrote:

Hello, 

I am using the code from here: http://support.sas.com/kb/39/101.html

 

However, I need help modifying it--

 

using the sample data, supposed I had another variable denoting health-clinic. I need to produce the box plot for each clinic, so how can I modify the code to produce 50 graphs instead of one overall?

 

On these graphs, I also need a to add a reference point for that health-clinics unique value. (on the baseline plot and 15month plot, by measure (see sample data))

 

I.E. the 50 graphs (just like the one in Sample 39101) will be the exact same except for the unique markers for each practice.

 

Thank you!

 

SAMPLE DATA:

 

PracticeID  ClinicName  Measure   ProportionBL   Proportion15

6001             hdosnonds    aspirin         0.786                 0.897

6002             hskndon         aspirin         0.638                0.579

6003              hdonwod       aspirin         0.526                0.599

6001             hdosnonds    bloodp         0.986                 0.857

6002             hskndon         bloodp         0.238                0.903

6003              hdonwod       bloodp         0.436                0.822


 

aebabinec
Calcite | Level 5

@Reeza when I add the BY statement it only plots that clinics value (so I have one point for baseline and then one for 15 month)

 

any ideas? tahnk you for your help!

Reeza
Super User

Yes, that's what happens when you say you want '50 graphs', ie one for each clinic. If that's not what you want, you need to be more specific.

ballardw
Super User

It helps to show the code you are actually using. Referencing a source for similar code is nice but we can't tell what you may have implemented done that wasn't in the example.

 

By "unique marker" do you mean that you want 50 different markers such as different shape and color?

 

If you want 50 graphs, one per clinic then sort the data by clinic and add a by statement using the clinic variable.

 

Since the referenced code does not have a "baseline plot" or a "15month plot" your description is incomplete.

 

 

 

aebabinec
Calcite | Level 5
Here is the code-it is the same as in the sample, just changed to fit my data variables.



proc template;

define statgraph CQM_BY_Quarter;

begingraph;

entrytitle 'CQM Measures for &clinicname (Practice ID &PID) at Baseline and 15 Months';

*entryfootnote halign=left "For ALAT, ASAT and ALKPH, the Clinical Concern Level is 2 ULN" / textattrs=(size=8);

*entryfootnote halign=left "For BILTOT, the CCL is 1.5 ULN: where ULN is the Upper Level of Normal Range" / textattrs=(size=8);

layout overlay / cycleattrs=true yaxisopts=(label='Proportion Patients meeting tx guidelines')

xaxisopts=(display=(ticks tickvalues line));

boxplot x=measure y=proportionbl / discreteoffset=-0.2 boxwidth=0.2 display=(mean outliers caps fill)

outlineattrs=graphdata1(pattern=solid) meanattrs=graphdata1

medianattrs=graphdata1(pattern=solid) whiskerattrs=graphdata1(pattern=solid)

outlierattrs=graphdata1 name='a' legendlabel='Baseline';

boxplot x=measure y=proportion15 / discreteoffset= 0.2 boxwidth=0.2 display=(mean outliers caps fill)

outlineattrs=graphdata2(pattern=solid) meanattrs=graphdata2

medianattrs=graphdata2(pattern=solid) whiskerattrs=graphdata2(pattern=solid)

outlierattrs=graphdata2 name='b' legendlabel='15-Month';

discretelegend 'proportionbl' 'proportion15' / location=inside halign=right valign=top across=1;

*referenceline y=1 / lineattrs=(pattern=dot);

*referenceline y=1.5 / lineattrs=(pattern=dot);

*referenceline y=2 / lineattrs=(pattern=dot);

endlayout;

endgraph;

end;

run;



ods graphics / reset width=5in height=3in imagename= 'Fig1_1_CQM_by_Quarter';

ODS LISTING STYLE=LISTING IMAGE_DPI=100;

PROC SGRENDER DATA=WORK.TemplateData TEMPLATE=CQM_BY_QUARTER;

RUN;



For the unique markers- just markers for each practice for each measure on their respective baseline and 15month plots


SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 747 views
  • 0 likes
  • 3 in conversation