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 (January 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 24 Jan 2008 09:56:50 -0500
Reply-To:   "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject:   Re: Array Problem
In-Reply-To:   <200801241411.m0OBmd6h001577@malibu.cc.uga.edu>
Content-Type:   text/plain; charset=utf-8

Toby has already pointed out that you are referring to a two-dimensional array

These suggestions are for your code polishing:

You are mixing styles:

> array a_inj1 {12} A_AUJ1_1 - A_AUJ1_12; > > array n_anum {*} ATL_AUDIT1- ATL_AUDIT13 ;

suggestion: change all hard-coded array dimensions: (12) or {12} to let-SAS-do-your-work-for-you style: (*)

when referencing the upper bound of an array remove the hard-coded integer

do i=1 to dtl_cnt;*where is this var assigned?;

and replace with the function:

do i=1 to dim(ArrayName);*change array dimension and this line still works;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov

> -----Original Message----- > From: owner-sas-l@listserv.uga.edu > [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of John Mackin > Sent: Thursday, January 24, 2008 9:12 AM > To: SAS-L@LISTSERV.UGA.EDU > Cc: John Mackin > Subject: Array Problem > > Below is code I inherited from a previous programmer. I > haven’t used > arrays much in my previous position. > > The message I am receiving is “Too many array subscripts > specified for > array (array name)”. > > I have tried the brackets with {*} and then just for the number of > variables {12} but continue to get the same error. > > I am certainly appreciative of any responses to my dilemma. > > THANK YOU! > > array a_inj1 {12} A_AUJ1_1 - A_AUJ1_12; > array a_pos1 {12} $ A_SOP1_1 - A_SOP1_12; > array a_inj2 {12} A_AUJ2_1 - A_AUJ2_12; > array a_pos2 {12} $ A_SOP2_1 - A_SOP2_12; > array a_inj3 {12} A_AUJ3_1 - A_AUJ3_12; > array a_pos3 {12} $ A_SOP3_1 - A_SOP3_12; > > array n_anum {*} ATL_AUDIT1- ATL_AUDIT13 ; > array n_aind {*} $ ATL_AUDIT_IND1-ATL_AUDIT_IND13 ; > > > do i=1 to dtl_cnt; > do j=1 to 12; > if a_inj1 (i, j) > 0 then do; > Too many array subscripts specified for array a_inj1 > INJTS_NUM = i; > SEQUENCE = j; > INJTS_AUDIT_TYPE = 'DTL' ; > AUDIT = put (a_inj1 (i, j), 3.0) || a_pos1 (i, j); > Too many array subscripts specified for array a_inj1 > Too many array subscripts specified for array a_pos1 > put COBN $ @; put INJTS_NUM @; put SEQUENCE @; > put INJTS_AUDIT_TYPE $ @; > put AUDIT $ @ ; put XREF_COBN1 $ @; put PAID_DATE @; > put CREATEDON @; > put UPDATEDON @ ; put ADJUSTED $ @; put HIC $; > end; > > (same errors for a_inj2 and a_inj3) > > > do j=1 to 12; > if a_inj2 (i, j) > 0 then do; > INJTS_NUM = i; > SEQUENCE = j; > INJTS_AUDIT_TYPE = 'DTL' ; > AUDIT = put (a_inj2 (i, j), 3.0) || a_pos2 (i, j); > put COBN $ @; put INJTS_NUM @; put SEQUENCE @; > put INJTS_AUDIT_TYPE $ @; > put AUDIT $ @ ; put XREF_COBN1 $ @; put PAID_DATE @; > put CREATEDON @; > put UPDATEDON @ ; put ADJUSTED $ @; put HIC $; > end; > do j=1 to 12; > if a_inj3 (i, j) > 0 then do; > INJTS_NUM = i; > SEQUENCE = j; > INJTS_AUDIT_TYPE = 'DTL' ; > AUDIT = put a_inj3 (i, j), 3.0) || a_pos3 (i, j); > put COBN $ @; put INJTS_NUM @; put SEQUENCE @; > put INJTS_AUDIT_TYPE $ @; > put AUDIT $ @ ; put XREF_COBN1 $ @; put PAID_DATE @; > put CREATEDON @; > put UPDATEDON @ ; put ADJUSTED $ @; put HIC $; > end; > end;_anum (i) > 0 then > do; > if > n_anum (i) > 0 then do; > INJTS_NUM = i; > SEQUENCE = 1; > INJTS_AUDIT_TYPE = 'NON' ; * noncov-audit 07/31/02 meeting; > AUDIT = put (n_anum (i), 3.0) || n_aind (i); > put COBN $ @; put INJTS_NUM @; put SEQUENCE @; > put INJTS_AUDIT_TYPE $ @; > put AUDIT $ @ ; put XREF_COBN1 $ @; put PAID_DATE @; > put CREATEDON @; > put UPDATEDON @ ; put ADJUSTED $ @; put HIC $; > end; > end; > > run; > >


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