Hi, I have the input data, output data I'd like a well as the code below.
A few questions:
1) How can I get SAS to output what I showed below into an Excel spreadsheet with the symbol: ≥
2) When I use the 'do over' language and I have two array names in the 'do over' loop, does it make a difference which name I use? For example, I use: do over pcts. But I also have the array name 'nums' in the if-then statement.
3) Is it OK to put all the if-then statemtents in one 'do over' statement or break them up into multiple do over statements?
data have;
input buildingname & $20. population vaxa_num pctvaxa vaxb_num pctvaxb vaxd_num pctvaxd buildingtype $;
cards;
happy days 100 99 99 96 96 0 0 private
learning tree 20 18 90 19 95 2 10
bean stalk 50 50 100 0 0 50 100
data want;
set have;
array pcts pct_vaxa pct_vaxb pct_vaxd;
array nums vaxa_num vaxb_num vaxd_num;
array pct $5 vaxa_pct vaxb_pct vaxd_pct;
array num $5 vaxa vaxb vaxd;
do over pcts;
pct=put (pcts, 4.);
end;
do over nums;
num=put(nums, 4.);
end;
do over pcts;
if1=< population<=39 and pcts >=95 then pct='>=95':
if1=< population<=39 and pcts >=95 then num='--':
if 40=<population<=99 and pcts >=98 then pct='>=98':
if 40=<population<=99 and pcts >=98 then num='--':
if population>=100 and pcts >=99 then pct='>=99':
if population>=100 and pcts >=99 then num='--':
end;
run;
Final Output
buildingname
population
vaxa_num
pct_vaxa
vaxb_num
pct_vaxb
vaxd_num
pct_vaxd
happy days
100
--
≥99%
--
≥99%
0
0
learning tree
20
18
90
--
≥95%
2
10
bean stalk
50
--
≥98%
0
0
--
≥98%
Thanks!
... View more