I have a series of variables with the following format. x_YYUU where YY = two digit year code, with range from 00-13 (padded leading 0 for single digits) UU = two digit week code, with range 01-52 (padded leading 0 for single digits) I have been able to write this with a manual looping through the YY's 00-13 and then just using an array to go through the UU's (weeks) of each year. Then I thought I could rewrite this as a double array to simplify all the code because there was all these manual loops going through each year 00-13. However, I can't seem to get the double array to work: currentyear is an observation's current year currentweek is an observation's current week there are values present for all observations of these variables above DATA outputset; set inputset; array x{14,52} x_0001-x_0052 x_0101-x_0152 x_0201-x_0252 x_0301-x_0352 x_0401-x_0452 x_0501-x_0552 x_0601-x_0652 x_0701-x_0752 x_0801-x_0852 x_0901-x_0952 x_1001-x_1052 x_1101-x_1152 x_1201-x_1252 x_1301-x_1352; do i=currentyear to 13; do j=currentweek to 52; if missing(x{i,j}) then do; theyear=i; theweek=j; leave; end; end; end; RUN; I get an error on the x{i,j} part stating that the array is out of range. Ive tried to test different parts of the array within this x_YYUU format and I can't figure it out. For example, I thought the 00's were maybe causing a problem, so I used the double array for years starting at 01 instead of 00, still did not work. Is the naming of the variables in such a way that array processing is not possible? It seems wrong that I can do the week as array but not a double array with year. Any guidance would be appreciated.
... View more