- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Would someone please suggest the SAS procedure for arriving at the answer?
Two columns of data.
Day of Week would be the numbers 1 - 7, a categorical variable.
Response variable Accidents would be daily numbers, a continuous variable.
Number of rows in data set is greater than 1000.
Any guidance appreciated.
Nicholas Kormanik
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Or Proc SQL approach:
data have;
input week$ accident;
cards;
1 23
2 324
3 134
1 134
2 367
3 87
1 56
;
proc sql;
select * from
(select week, mean(accident) as max
from have
group by week)
having max=max(max);
quit;
Haikuo
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Two possible options
1. Proc FREQ -
proc freq data=have;
table day_of_week/chisq;
weight count;
run;
But that won't tell you which one is higher.
2. An ANOVA based on the average number per day of week with contrast tests to isolate the one that is the highest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What would be the code for ANOVA?
Sounds right, that SAS would have to calculate the average number of accidents for each day (1-7), and assess whether there is a significant difference between the days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
*get mean accidents per day;
proc summary noprint nway n
data = have ;
class days ;
var accidents ;
output out = want (
drop = _type_ _freq_)
mean(accidents) = mean_accidents ;
run ;
Then run a proc rank to get the highest if required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Or Proc SQL approach:
data have;
input week$ accident;
cards;
1 23
2 324
3 134
1 134
2 367
3 87
1 56
;
proc sql;
select * from
(select week, mean(accident) as max
from have
group by week)
having max=max(max);
quit;
Haikuo
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I've been thinking as a statistician too long...did you need to test if its significantly different as well, or just after the largest number?