Date: Wed, 10 Dec 2008 14:33:00 -0500 Jerry "SAS(r) Discussion" Jerry Re: a more efficient approach than using array? To: Paul Dorfman

Paul,

I appreciate this great DoW approach. However, would you consider it has a flaw described below due to this part of your code? (I hope it's not caused by that I didn't specify explicitly the purpose of each line of my codes)

/***************/ if _x < dim (sx) then do ; apd_sx = 1 ; if sx[_x] = '4720' then p_apd_sx = 1 ; end; /***************/

Say if an observation has the following values

ID: 25 prcdr_cd1: "5789" prcdr_cd2: "4701" prcdr_cd3: "5800" prcdr_cd4: "4720" prcdr_cd5: "5900" prcdr_cd6: "6000" (dgns_cd variables skipped)

So prcdr_cd2 is the first variable satisfying the condition of "sx[_x] in '4701','4709','4711','4719','4720'", as it has the value of '4701'. So the "do _x=1 by 2 until (condition)" loop quits and _x=2.

Now it comes to the do loop of "if _x < dim (sx) then do". Because sx[2] = '4701', so p_apd_sx is set to missing, while it should be set to 1, as prcdr_cd4 has the value of "4720".

Hopefully I made my question clear.