Sales Month
|
RevCargo
|
---|---|
JAN1997
|
$171,520,869.10
|
JAN1998
|
$238,786,807.60
|
JAN1999
|
$280,350,393.00
|
FEB1997
|
$177,671,530.40
|
FEB1998
|
$215,959,695.50
|
FEB1999
|
$253,999,924.00
|
Sales Month
|
RevCargo
|
MonthNo
|
Cargosum
|
PctRev
|
---|---|---|---|---|
JAN1997
|
$171,520,869.10
|
1
|
$8,593,432,002.35
|
<RevCargo/Cargosum> |
JAN1998
|
$238,786,807.60
|
1
|
$8,593,432,002.35
|
<RevCargo/Cargosum> |
JAN1999
|
$280,350,393.00
|
1
|
$8,593,432,002.35
|
<RevCargo/Cargosum> |
FEB1997
|
$177,671,530.40
|
2
|
$8,593,432,002.35
|
<RevCargo/Cargosum> |
FEB1998
|
$215,959,695.50
|
2
|
$8,593,432,002.35
|
<RevCargo/Cargosum> |
FEB1999
|
$253,999,924.00
|
2
|
$8,593,432,002.35
|
<RevCargo/Cargosum> |
General form, PROC MEANS
with OUTPUT statement:
PROC MEANS DATA=input-SAS-data-set NOPRINT;
<VAR variable(s);>
OUTPUT
OUT= output-SAS-data-set
statistic=output-variable(s);
RUN;
input-SAS-data-set
identifies the data
set on which the summary statistic is generated.
variable(s)
is the name or names
of the variable or variables that are being analyzed.
output-SAS-data-set
names the data set
where the descriptive statistics will be stored.
statistic
is one of the summary
statistics generated.
output-variable(s)
names the variable
or variables in which to store the value or values of statistic in
the output data set.
|
proc means data=sasuser.monthsum noprint; var revcargo; output out=sasuser.summary sum=Cargosum; run; proc print data=sasuser.summary; run;
data sasuser.percent1(drop=cargosum); if _N_=1 then set sasuser.summary(keep=cargosum); set sasuser.monthsum(keep=salemon revcargo); PctRev=revcargo/cargosum; run;
General form, sum statement:
variable+expression;
variable
specifies the name
of the accumulator variable. This variable must be numeric. The variable
is automatically set to 0 before the first observation is read. The
variable's value is retained from one DATA step iteration to
the next.
expression
is any numeric SAS
expression.
|
data sasuser.percent2(drop=totalrev); if _N_=1 then do until (LastObs); set sasuser.monthsum(keep=revcargo) end=lastobs; TotalRev+revcargo; end; set sasuser.monthsum(keep=salemon revcargo); PctRev=revcargo/totalrev; run;