02-25-2016 04:24 PM
Hello all! I know there are a ton of "subscript out of range" posts on here, but none of them have helped me identify my problem...
array barriers(19) $ unawareneed_86 unawarelaterdose_86 unawaretimeplace_86 fearsideeffects_86 longdistanceimmsite_86 toobusy_86 nopermission_86 postponed_86 heardneg_86 timeinconvenient_86 vaccinatorabsent_86 vaccinena_86 famprob_86 childillnottaken_86 childilltakendidnotreceive_86 lackoffaithinimm_86 longwaittime_86 lackoftrustinstaff_86 other_86; array barriercited(19) barriercited1-barriercited19; do i=1 to 19; if barriers(i)='Yes' then barriercited(i)=1; else if barriers(i)='No' then vacchx(i)=0; end; numberbarriers=sum(of barriercited(*)); run;
I keep getting this error: "ERROR: Array subscript out of range at line 13972 column 43" (although the numbers tend to change when I re-run it each time. Hoping fresh eyes will help! Thanks!
02-25-2016 04:30 PM
I noticed that literally as soon as I posted the discussion - I thought I deleted it. Guess that's what I get for copy/paste. Thanks though!
02-25-2016 04:43 PM
The error messages from an undeclared array are different, though.
ERROR: Undeclared array referenced: vacchx. ERROR: Variable vacchx has not been declared as an array.
So, I'm not sure how this mistake could explain the "subscript out of range" message.
02-25-2016 05:13 PM
Most likely, you will need to post your actual program. It's not just the reference to a nonexistent array, it's also that you have a second DATA statement instead of a SET statement. While you've posted all the code that seems relevant from your perspective, "fresh eyes" will need to see the whole program to diagnose this.
Need further help from the community? Please ask a new question.