BookmarkSubscribeRSS Feed
saza
Quartz | Level 8

I am enrolled in a biostats course where we have started to implement sas more for our solutions. The statement before the question is introduced is the following:

The SAS Institute distributes several sample datasets with its programs.  These datasets get used in many textbook examples and homework problems.  We've frequently used their FITNESS dataset that has running times and resting and post-run pulse rates for a group of men.  I've always wondered whether this was a normal group of people. The variable RESTPULSE contains the resting pulse rate for each participant in the fitness study.  The normal pulse rate for men is 72. Is this a normal group? 

1) Using the dataset Fitness calculate PRE for the resting pulse rate variable. Round to two digits after the decimal.

I have attached the dataset and now I am attaching the code I am using and trying to figure out why I am getting an error when I try to obtain the sseA and sseC values. 

libname fitness "/home/u59291263/fitness";
run;

proc means data=fitness.fitness;
var restpulse;
run;
* mean= 53.45;
data fitness.fitness_errors;
set fitness.fitness;

hypoMean = 72;
observedMean= 53.4

sseC = (restpulse-72)**2;
sseA = (restpulse-53.4)**2;
run;

*Get SSE;
proc means data=fitness.fitness_errors sum;
var sseC sseA;
run;

data work.pre;
modC=
modA=

pre = (modC-modA)/modC
prePCT = pre*100;
3 REPLIES 3
sbxkoenk
SAS Super FREQ

Hello @saza ,

 

When I take the fitness data from here :

SAS/STAT® 15.2 User's Guide
The REG Procedure
Example 104.2 Aerobic Fitness Prediction
https://go.documentation.sas.com/doc/en/statug/15.2/statug_reg_examples02.htm

, I do not see a variable where the mean equals 72.

 

Also your program contains (several) syntax errors, like missing semi-colons.

observedMean= 53.4

 

Also, in SAS, there's no need to submit a PROC MEANS, copy / paste the results in a subsequent data step (which is what we call 'hard-coded').
You can do all that in one flow.
You need to program in such a way that the results from one step are streaming into the other step. Your program should be 'dynamic' (such that you do not need to change anything if the input data change).

 

Good luck,

Koen

saza
Quartz | Level 8
Thank you for catching my errors. I was able to obtain the PRE using the following code with corrected ";"
libname fitness "/home/u59291263/fitness";
run;

proc means data=fitness.fitness;
var restpulse;
run;
* mean= 53.45;
data fitness.fitness_errors;
set fitness.fitness;

hypoMean = 72;
observedMean= 53.4;

sseC = (restpulse-72)**2;
sseA = (restpulse-53.4)**2;
run;

*Get SSE;
proc means data=fitness.fitness_errors sum;
var sseC sseA;
run;

data work.pre;
modC= 12407.00;
modA= 1741.76;

pre = (modC-modA)/modC;
prePCT = pre*100;
run;

however, my professor wants to use this method to calculate the f statistic. The hypomean of 72 was obtained from the paragraph before the question.
sbxkoenk
SAS Super FREQ

Hello,

 

What is your research question?

What is the question you are trying to answer?
I am quite sure there's a SAS-procedure for the analysis you want to do.
No need to do all these calculations manually in a data step.

 

What do you need the F-statistic for? 
The F-statistic is simply a ratio of two variances.
But it's "all over the place".
Probably you want to do an ANOVA, ... then look into PROC ANOVA and PROC GLM.

 

Thanks,

Koen

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 343 views
  • 0 likes
  • 2 in conversation