|
This may not be elegant, but it'll work:
Data current;
Input age cases;
Cards;
1 2
3 2
4 4
10 7
;
Proc sql;
Select max(age) into :max_age /* create macro variable */
From current
;
data new;
do age = 1 to &max_age.; /* macro variable */
output;
end;
run;
proc sort data = current;
by age;
proc sort data=new;
by age;
data combined;
merge new current;
by age;
cases=max(0,cases);
run;
Warren Schlechte
Heart of the Hills Research Station
HC7 Box 62
Ingram, Texas 78025
Phone: 830.866.3356
Fax: 830.866.3549
|