Hi,
I'm trying to solve the following exercise, but I haven't got a clue how to solve letter c.
Can someone help me out?
34. A local gym runs a New Year’s membership offer that is available to anyone who joins the gym on
January 1st. The promotion states that if the new member continues to work out for at least 30
minutes a day for the first four months of the year, then they will have the $150 start-up fee
refunded. This year, 245 people signed up for the offer. Members were tracked automatically via
the computer check-in system when they arrived and left the gym. The raw data file NewYears.dat
contains variables for the member ID, and check-in times for the first 119 days of the year,
followed by the check-out times for the first 119 days of the year.
a. Examine the raw data file NewYears.dat and read it into SAS.
b. Create new variables for the time (in minutes) that the member spent at the gym each day.
c. Create a flag that identifies whether members are eligible for the refund. Members are eligible if
they worked out for at least 30 minutes a day for all 119 days.
d. Calculate the overall average time spent at the gym for each new member.
e. View the resulting data set. In a comment in your program, state the values for refund eligibility
and overall average time for members 330 and 331.*/
proc import
datafile="/folders/myfolders/The Little SAS Book/Input/Chapter 3/NewYears.dat"
out=newy replace dbms=dlm;
delimiter=",";
getnames=yes;
run;
data newy;
set newy;
array in {119} In_Day_1-In_Day_119;
array out {119} Out_Day_1-Out_Day_119;
array timesession {119};
do i=1 to 119;
timesession{i}=out{i} - in{i};
end;
AvgTime=mean(of timesession1-timesession119);
informat In_Day_1-In_Day_119 Out_Day_1-Out_Day_119 AvgTime
timesession1-timesession119 time5.;
format In_Day_1-In_Day_119 Out_Day_1-Out_Day_119 AvgTime
timesession1-timesession119 time5.;
run;