my output would be in a html format report... all i want is a select statement that can output a condition of asm_type = '900' and asm_type = '905' and not anything else.... even-though an id contains the '900' and '905' as its first two asm type, and if it has a third asm type, I would neglect the id all together... I am very new at sas, I hope my explanation is good enuf...
The id that I want would be 076039803, 077318706 , 086856104 , 088458302 , 2001804807 and 276493707.
I Don't want the following ID
687509501 - because it contains more than 2 seq
123123123 - because it starts with seq 0
88888888 - because the second sequence ASSET is 123
99999999 - because the first sequence ASSET is 111
kindly share some light to this humble programmer.... any help given is truly appreciated,
* ensure data is sorted;
proc sort data=INDATA;
retain _GOOD; * flag;
if first.ID then _GOOD=1; * assume its a good ID;
if SEQ not in (1,2) or ASSET not in (900,905) then _GOOD=0; * fails;
if last.ID and _GOOD; * output last obs if good ID;
Works with your sample, but please do some more intensive tests.
[pre]data two ;
do row=1 by 1 until( last.id ) ;
set origs ;
by id notsorted ;
if asset = '900' and seq=1 then f1='1' ;
if asset = '905' and seq=2 then f2='1' ;
else f3= '1' ;
if f3 ne '1' and f1!!f2 = '11' then output ;