I need to load a 2d array from table to a SAS data step and then use it to perform variable transformation in another table. The array looks something like this:
- rows: initial_value 1-4
- columns: year 1-4
1 1 2 3
2 2 2 3
3 4 4 4
4 4 5 6
So far I've hardcoded the array into sas code:
data example;
array lookup {4,4} _temporary_
1 1 2 3
2 2 2 3
3 4 4 4
4 4 5 6
;
set source(keep=(value years));
value_final = lookup{value, years};
run;
How do I do the same thing without hardcoding the matrix, but rather loading a table into data step and using as array?
proc iml
. Rick Wicklin has some great examples on his blog (blogs.sas.com/content/iml). Alternatively, look into hash tables. On a side note, you may want to describe exactly what you plan on doing transformation-wise (so people can be more helpful), or simplify your question to just how can I load a table into a multidimensional array. – Robert Penridge