Or you can make sure its always in. See below. data have; input alcohol $ numbers treatment $; cards; Yes 3 drug1 Yes 2 drug2 No 1 drug3 No 3 drug4 ; run; data values; Alcohol="Yes";output; Alcohol="No"; output; Alcohol="NA"; output; run; proc sql; create table empty as select distinct treatment, 0 as num, v.alcohol from have h cross join values v; quit; proc sql; create table filled as select a.treatment, max(a.num, b.numbers) as value, a.alcohol from empty a left join have as b on a.treatment=b.treatment and a.alcohol=b.alcohol order by a.alcohol, b.treatment; quit; proc transpose data=filled out=summary1; by alcohol; id treatment; var value; run;
... View more