LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 22 Oct 2007 13:57:17 -0400
Reply-To:     Jack Clark <JClark@CHPDM.UMBC.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jack Clark <JClark@CHPDM.UMBC.EDU>
Subject:      Summing Dynamic Range of Array Variables
Content-Type: text/plain; charset="us-ascii"

Hello,

I would appreciate some suggestions for alternative logic for the way I was trying to sum a dynamic selection of array variables.

I am trying to set a flag variable (E12) to 'Y' when a recipient has at least 12 out of 13 months of Medicaid eligibility. The 13 months (in this example) are always between JAN02 and DEC03 and - and are anchored based on a SAS date variable called IESD_DX which is always between 01MAY02 and 30APR03. The 13 months should include the 4 months prior to the IESD_DX and the 8 months following the IESD_DX.

The array in the data step contains 24 binary variables (1 or 0) where a 1 indicates eligibility and a zero indicates no eligibility. As each observation can have a different date value for IESD_DX, I am trying to dynamically determine which 13 array elements I need to sum to check for a total of 12 or more months' eligibility. The existing DO LOOP below seems to be setting strt and stp OK, and I had tried to use them as array subscripts in the subsequent SUM function - but this is where the error comes in.

data elimit03;

length e12 $ 1 ;

merge epharm03_recips (in=a where=(iesd_44_rx = 'Y'))

eflags03 (in=b keep=recipno jan02 feb02 mar02 apr02 may02 jun02 jul02 aug02

sep02 oct02 nov02 dec02 jan03 feb03 mar03 apr03

may03 jun03 jul03 aug03 sep03 oct03 nov03 dec03)

;

by recipno;

if a and b;

array emon(24) jan02 feb02 mar02 apr02 may02 jun02 jul02 aug02 sep02 oct02 nov02 dec02

jan03 feb03 mar03 apr03 may03 jun03 jul03 aug03 sep03 oct03 nov03 dec03;

do i = 5 to 24 until (strt ne .);

if put(iesd_dx,monyy.) = upcase(vname(emon(i))) then do;

strt = i - 4;

stp = i + 8;

end;

end;

if sum(of emon(strt)-emon(stp)) ge 12 then e12 = 'Y';

run;

SAS Log Error Message:

970 if sum(of emon(strt)-emon(stp)) ge 12 then e12 = 'Y';

-

22

ERROR 22-322: Syntax error, expecting one of the following: ), ','.

971 run;

Thanks in advance for the help.

Jack Clark

Research Analyst

Center for Health Program Development and Management

University of Maryland, Baltimore County


Back to: Top of message | Previous page | Main SAS-L page