BookmarkSubscribeRSS Feed
scarrico
Calcite | Level 5

Hello,

 

I am working on generating line graphs using proc sgplot vline and I am having some difficulty assigning confidence intervals to my data points.  I am able to generate the line but no confidence intervals for each data point.

 

Below is the code I have been using:

 

proc sgplot data=CAUTI2;
vline SummaryYM / response=SIR stat=mean limitstat=clm;
yaxis grid values=(0 to 2) valueshint;
refline 0.6963750 0.3762621 1.0164879 / label = ('SIR(mean)' 'UCL' 'LCL');
yaxis label='SIR';
title 'SIR Trend of CAUTI in Acute Care Hospitals in 2018';
run;

 SAS Output

 

GRAPH1 is the desired output.

 

Thank you for your help!

 

Savannah

4 REPLIES 4
ballardw
Super User

@scarrico wrote:

Hello,

 

I am working on generating line graphs using proc sgplot vline and I am having some difficulty assigning confidence intervals to my data points.  I am able to generate the line but no confidence intervals for each data point.

 

Below is the code I have been using:

 

proc sgplot data=CAUTI2;
vline SummaryYM / response=SIR stat=mean limitstat=clm;
yaxis grid values=(0 to 2) valueshint;
refline 0.6963750 0.3762621 1.0164879 / label = ('SIR(mean)' 'UCL' 'LCL');
yaxis label='SIR';
title 'SIR Trend of CAUTI in Acute Care Hospitals in 2018';
run;

 SAS Output

 

GRAPH1 is the desired output.

 

Thank you for your help!

 

Savannah


Data example? Do you actually have multiple values of SIR for values of SummaryYM? If there are not multiple values, or they are all the same, then there is no variability and the confidence interval is +/- 0 from the mean.

scarrico
Calcite | Level 5

Attached are my data

ballardw
Super User

@scarrico wrote:

Attached are my data


Which shows single values of SIR (as well as all the other variables) for each and every value of summaryYM. So there is NO variability  within the data you are graphing.

 

Since that PDF shows values like SIR95CI of 0.592, 3.040 then go back to the data set used to create that summary and graph from there.

OR instead of a not-very-friendly to use value like you have for the SIR95CI create and leave the upper and lower limits in separate variables and use a BAND plot with the UPPER and LOWER values the variables with the limits

Ksharp
Super User
It seems you need VBAR not VLINE statement.

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 16. 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
  • 4 replies
  • 1503 views
  • 0 likes
  • 3 in conversation