data tbl; retain ord subord label _1 _2 _3 _9; merge shell_final combo; by subord; if subord not in (1,4,5)then do; if not missing(_1) then col1=put(_1, 3.)||' ('||put((_1/&tot1)*100,3.)||'%)'; else if missing(_1) then col1=put(0,3.); if not missing(_2) then col2=put(_2, 3.)||' ('||put((_2/&tot2)*100,3.)||'%)'; else if missing(_2) then col2=put(0,3.); if not missing(_3) then col3=put(_3, 3.)||' ('||put((_3/&tot3)*100,3.)||'%)'; else if missing(_3) then col3=put(0,3.); if not missing(_9) then col9=put(_9, 3.)||' ('||put((_9/&tot9)*100,3.)||'%)'; else if missing(_9) then col9=put(0,3.); end; drop _1 _2 _3 _9; run; data tbl2; retain ord subord label _1 _2 _3 _9; merge shell_final combo; by subord; array vars{4} $ _1 _2 _3 _9; do i=1 to 4; if vars{i} ^=' ' and label='No' then vars{i}=put(vars{i}, 3.)||' ('||put((vars{i}/&tot9)*100,3.)||'%)'; end; run; I am trying to see if there is a way that I can replicate the first code into an array. tbl works for what I am doing but was wondering if I could use an array to accomplish the same thing. In the second code cluster is my attempt to trying an array, but it doesn't work.
... View more