Help using Base SAS procedures

Time Series- How to get slope and % change in Y-axis?

Reply
Contributor
Posts: 22

Time Series- How to get slope and % change in Y-axis?

Hi all,

I have a time series data with rate of blood cultures per 1000 pts for 34 months (before and after intervention, indicated by Variable "Intervention" - 0=before intervention, 1= after intervention). Month variable is recorded from Jan 2015 through Oct 2017. I want to see if intervention made a difference in rate of blood cultures (i.e. decrease in the blood culture rate). How do I test this to show a significant difference (with p-value)? Also please explain me how to get the % change in Y-axis for the blood culture rates and slope.

 

 I have no clue how to test this in SAS. Any help with is much appreciated. I am attaching the data (excel sheet) below with the variables.

 

Thank you very much!

SAS Super FREQ
Posts: 4,241

Re: Time Series- How to get slope and % change in Y-axis?

Assuming that these monthly data are independent, you can use either PROC GLM to perform a one-way ANOVA or PROC TTEST to perform a t test. The results are equivalent.

 

 

 

data Have;
input Intervention	Cult_Per_1000pts	Time;
datalines;
0	40.33691	1
0	39.72401	2
0	38.94887	3
0	37.35858	4
0	36.58583	5
0	36.81972	6
0	35.34335	7
0	32.54884	8
0	28.9988	9
0	30.66459	10
0	32.36462	11
0	33.03502	12
0	35.60342	13
0	26.70872	14
0	29.83492	15
0	29.66548	16
1	26.24441	17
1	22.24681	18
1	19.59343	19
1	21.7832	20
1	21.06327	21
1	19.05045	22
1	15.48585	23
1	16.79496	24
1	16.57914	25
1	16.95194	26
1	17.04799	27
1	15.95765	28
1	16.1363	29
1	18.44075	30
1	17.60312	31
1	16.881	32
1	13.90606	33
1	16.62039	34
;

proc glm data=Have;
   class Intervention;
   model Cult_Per_1000pts = Intervention;
   lsmeans Intervention / pdiff;
run;

proc ttest data=Have;
class Intervention;
var Cult_Per_1000pts;
run;

 

 

IMHO, the t test approach is easier and more familiar for most people. The TTEST doc has an example that explains the output. The documentation for PROC GLM has a Getting Started example that discusses ANOVA. and you can Google for other examples. 

 

The test statistic for the ANOVA (F=164.51) is equivalent to the test statistic for the t test (t=12.83) because t^2 = F.

 

Contributor
Posts: 22

Re: Time Series- How to get slope and % change in Y-axis?

[ Edited ]

Hi Rick,

Thanks for the response. I tried the proc autoreg. DO you think this is a good option for testing effect of intervention and time on a rate?

 

   Proc autoreg data = TimeSeries;
   model Cult_Per_1000pts= time Intervention/ method=ml nlag=13;
   run;

 

 

Thanks,

Sat

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