Date: Sun, 25 Feb 2007 12:27:47 -0500
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Question about NMISS
Is there a way to specify an array in a function like nmiss or sum?
I tried (I think) Ron's suggested solution, but got the following error:
data test;
input diasbp sysbp pulse heartrt temp htcm wtkg;
cards;
1 2 3 4 5 6 7
1 . 3 4 5 6 7
;
run;
data want;
set test;
array Measures(*) diasbp sysbp pulse heartrt temp htcm wtkg;
if nmiss( of Measures) eq dim(Measures) then delete;
run;
ERROR: Illegal reference to the array Measures.
Art
--------
On Fri, 23 Feb 2007 16:17:54 -0500, Fehd, Ronald J. (CDC/CCHIS/NCPHI)
<rjf2@CDC.GOV> wrote:
>> From: Sridhar, Nagakumar
>> I am trying to do something like this:
>>
>> if diasbp=. and sysbp=. and pulse=. and heartrt=. and temp=.
>> and htcm=.
>> and wtkg=. then delete;
>>
>> And was advised (by my boss) to use the NMISS function. But
>> when I did the following (and I am not sure if the 2
>> statements mean the same):
>>
>> if nmiss(of diasbp,sysbp,pulse,heartrt,temp,htcm,wtkg)< 7 then delete;
>>
>> I get different results. Can somebody be kind enough to
>> explain to me what the right syntax is?
>
>change less than
>
>if nmiss(of diasbp,sysbp,pulse,heartrt,temp,htcm,wtkg)
> < 7 then delete;
>...^
>
>to equal
>
>if nmiss(of diasbp,sysbp,pulse,heartrt,temp,htcm,wtkg)
> = 7 then delete;
>...^
>
>you might want to examine placing all your variables in an array:
>
>array Measures(*) diasbp sysbp pulse heartrt temp htcm wtkg;
>
>if nmiss( of Measures) eq dim(Measures) then delete;
>
>this is easier to read
>and whenever you change the var list in the array statement
>your code testing for nmiss
>does not break later in the program.
>
>Ron Fehd the less is better
> or easier to read
> or macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
|