The data set Charity contains information about high-school students'
volunteer work for charity. The variables give the name of the high school,
the year of the fundraiser, the first name of each student, the amount of
money that each student raised, and the number of hours that each student
volunteered. The RETAIN statement and two sum statements compute the minimum
and maximum values of Year
. The CALL SYMPUT
statements store these values in the macro variables FIRST_YEAR and LAST_YEAR.
A DATA step creates this data set.
data Charity;
input School $ 1-7 Year 9-12 Name $ 14-20 moneyRaised 22-26
hoursVolunteered 28-29;
format moneyRaised dollar8.2;
format hoursVolunteered f3.0;
format Year yrFmt.;
format School schFmt.;
label School = "Schools";
label Year = "Years";
retain yearmin yearmax;
yearmin=min(yearmin,year);
yearmax=max(yearmax,year);
call symput('first_year',put(yearmin,4.));
call symput('last_year', put(yearmax,4.));
datalines;
Monroe 1992 Allison 31.65 19
Monroe 1992 Barry 23.76 16
Monroe 1992 Candace 21.11 5
... more lines of data ...
Kennedy 1994 Sid 27.45 25
Kennedy 1994 Will 28.88 21
Kennedy 1994 Morty 34.44 25
;