On Tue, 3 Oct 2006 10:01:08 -0400, Peter Crawford
>On Tue, 3 Oct 2006 06:53:31 -0700, Newbie <oldscot82@YAHOO.COM> wrote:
>>input id$ code$;
>>In the above dataset, I am trying to extract all ID's that
>>have any of these codes(apple,orange,lemon).
>>If the ID has any of those codes, I would like to extract all records
>>for that ID;
>>Thanks for your help.
>>My final dataset would look like this.
>>Here is what I have got so far
>>proc sort data=test;
>>data test2 ;
>>if first.id then do;
>>if code in ('apple','orange','lemon') then do ;
>time to learn about
>data wanted ;
> set test ;
> where code in ('apple','orange','lemon') ;
>Of course, if instead of the original data, you want counts,
>put that "where statement" into proc freq
this old scot still needs to learn to read before responding !
Not just individuals where found, but the whole ID-group when
any in the group are found .
Multi-pass is perhaps neccessary, but since the data is in ID-order
this extract can merge fruit wanted, with all the details, by ID
data test2 ;
merge test( in= wanted
where= ( code in ('apple','orange','lemon') )
by ID ;
if wanted ;