Date: Fri, 16 Dec 2005 23:50:54 GMT
Reply-To: Roger Lustig <trovato@VERIZON.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roger Lustig <trovato@VERIZON.NET>
Subject: Re: Number of times where the condition is met?
In-Reply-To: <ED92B7C78985D611BB3B00B0D0FC32BA19B80A@sh0cx691.rc.gc.ca>
Content-Type: text/plain; charset=us-ascii; format=flowed
Hamani:
Try a loop and an array.
data new (drop=i);
set old;
***This sets up an array with default names as you have them;
array age (12);
***See docs for what to do when the names are not as nice;
n_chlt5=0;
do I=1 to 12; *** Look up the DIM function too!;
if age(I) < 4 then n_chlt5 + 1;
end;
run;
By the way, given the name of your new variable, don't you want
less-than-or-equal-to 4?
Roger
Elmaache, Hamani wrote:
> Hi there.
> Please can someone help?
>
> I want to count the number of times where the following condition is met:
>
> data two;
> set one;
>
> if age1<4 or age2<4 age3<4 or age4<4
> age5<4 or age6<4 age7<4 or age8<4
> age9<4 or age10<4 age11<4 or age12<4
> then n_chlt5 ????;
>
> I want to how many people ( among these 12 people)
> are aged less than 4 years.
>
> Thanks a lot and nice week-end.