Hi,
I need to use a two-dimensional array to perform a table lookup.
I have a text file that looks like this (the dots represent continuous data, I didn't want to type out all 630 observations):
WT A B...I
1 17.00 18.25 ... 21.65
2 22.50 19.75 ... 22.85
. . .
. . .
. . .
69 28.95 31.80 ... 36.25
70 32.60 34.95 ... 37.05
I have a dataset with entries having the variables WT and Group (A-I). I would like a code that will give me the price, based on the WT and Group of an item. So for an item that weighed 2 and was in group B, 19.75 would be outputed.
I tried doing something like this, but couldn't get it to work.
FILENAME RATES 'F:\Rate.txt';
DATA LOOK_UP;
ARRAY Price{70,9};
infile RATES;
do WT = 1 to 70;
do Group = 1 to 9;
input Price{WT,Group} @;
end;
end;
set PCDTX2;
Group = input(translate(GROUP,'12345689','ABCDEFGHI'),1.);
Revenue= Price{WT,Group};
RUN;
Any help would be appreciated. Thank you.
Message was edited by: stat11
Message was edited by: stat11