| Date: | Mon, 7 Jun 2004 20:13:54 -0400 |
| Reply-To: | Pat Moore <pat.moore@UAA.ALASKA.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Pat Moore <pat.moore@UAA.ALASKA.EDU> |
| Subject: | Re: Missing data note in log |
|---|
Folks,
Bruce, your solution was elegant, but I'm such a poor programmer that I
need SAS to talk to me all the time or I mess up. So I kind of slid
around Henry's suggestion:
compute before subj;
if subjenr or subjsch then do;
pctdevenr=devenrsum/subjenr;
pctdevsch=devschsum/subjsch;
pctlowenr=lowenrsum/subjenr;
pctlowsch=lowschsum/subjsch;
pctupenr=upenrsum/subjenr;
pctupsch=upschsum/subjsch;
pctprenr=prenrsum/subjenr;
pctprsch=prsch.sum/subjsch;
pctgrenr=grenrsum/subjenr;
pctgrsch=grschsum/subjsch;
pcttotenr=totenr.sum/subjenr;
pcttotsch=sch.sum/subjsch;
end;
endcomp;
This worked. It could get a little hairy if there were, say 500 variables
that might be subtrahends in the divisions. I still wonder if there's
some elegant way to tell SAS not to divide by a missing value, which you
could use when you know you'll have missing values in the variables you
may have to divide by.
Pat
|