Hello all, I am sorry that my question is so unclear, I was afraid of this. Ok -- I know that you can just use arrays to compare things within a do loop. The issue is, the only reason I was using an array was that so I had a way to reference each column in any observation, without actually manually typing each column name each time. - See the "rates" array in my example does actually contain any numbers to compare, those values are in my data set each in separate column: for example, for _1MoTr: in the data set there are 3 variables FA_1MoTr, FB_1MoTr, FS_1MoTr (FA/FB/FS represent different scenarios the rate is forecasted for -- i'd like to check all of these.) - The entire dataset follow this pattern, i.e. FA_6MoTr, FB_6MoTr, FS_6MoTr, etc. there are 21 rates, times these 3 scenarios, so 63 columns of data in my dataset, and one observation per month for each month from Dec-2012 to Dec-2015. Longer term rates should also be higher than short term, so 1MoTr (1 month) should be less than 6MoTr (6 Month) should be less than 1YrTr (1 year) etc etc. If there are any unintuitive forecast that violate this, I need to interpolate the bad rates from the next best intuitive forecast (i.e. if FA_1YrTr < FA_6MoTr < FA_2YrTr, then I need to overwrite the value for FA_1YrTr by using linear interpolation from FA_6MoTr and FA_2YrTr. I need to check this for each rate, under each scenario (fa/fb/fs), so I could do this by manually writing if-statements and not using any arrays or macro variables at all; however, it would just be very tedious and time consuming because I would be writing hundreds of nested if-else statements, and it would be very hard to read & understand. -I'm not set on using arrays or macros by any means, all that I am trying to do is essentially loop through every variable in my dataset per each observation, rather than manually writing out if-statements for each variable. I thought that using an array of just the rate names (the array is made from a 1-dimensional dataset that is just a list of: 1MoTr,6MoTr,1YrTr,2YrTr...etc, and the reason that I am assigning each value of the array to a macro variable is not quite because of confusion, but because I need to access the actual names in the dataset, which are preceded with the scenario name ("FA_","FB_",or "FS_"), and i know this can be done with global macro variables such as: %let myrate = _6MoTr; So that the code piece: "FA&myrate." would be equal to "FA_6MoTr" so this way I could do something like: do i = 1 to 20; if FA_&curr_Rate. > FA_&next_Rate. then do; if FS_&curr_Rate. > FS_&next_Rate. then do; if FB_&curr_Rate. > FB_&next_Rate. then do; /*do work here */ end; ^ And this will have effectively went through and compared all 63 of my variables as expected, without manually writing 63 if-statements -- I don't need to use macro variables, or arrays, just whatever way is best to do this in sas. I have been reading the documentation on the VNAME function and am not sure that can quite apply to my situation but perhaps there is just a logical disconnect because of the lack of clarity in my question, and I deeply apologize for that -- I know it is my responsibility to present my question as clearly as possible for you guys but I just can't think how else to word this to explain what I'm trying to do here. Please let me know if this makes sense, or perhaps I can try to explain differently and provide more data;/examples.
... View more