Dear IML Users, I initially posted this query elsewhere, but realised it should be posted here instead. I am populating a matrix using the row values of another matrix (this is a part of a bigger programming issue I have and I have tried to simplify the issue down to its basics - I understand that do loops should be avoided in Proc IML, but in this case it is unavoidable) The issue is that the program works fine as individual statements, but when I insert a do loop, the 'vwap' matrix no longer updates properly - it inserts the number of rows and values from the last iteration and remain unchanged thereafter. I dont understand this as all the other elements update correctly and their properties are the same, so I cant see why it should fail. To see what is happening run the code below, I have hard coded the first two iterations and they work fine, vwap updates with the correct number of rows and the right values inserted. When I used a do loop to control the third execution, the same number of rows and values are inserted from the last iteration. Any help you could give would be most appreciated as this really has be perplexed. proc iml; reset print; xxx = {10 2 2.91, 10 3 3.05, 10 1 3.07}; volume = xxx[1,2]; price = xxx[1,3]; call symput ('volume', char(volume)); call symput ('price', char(price)); vwap = {[&volume] &price}`; volume = xxx[2,2]; price = xxx[2,3]; call symput ('volume', char(volume)); call symput ('price', char(price)); vwap = vwap//{[&volume] &price}`; do i = 3 to 3; volume = xxx[i,2]; price = xxx[i,3]; call symput ('volume', char(volume)); call symput ('price', char(price)); vwap = VWAP//{[&volume] &price}`; end; quit;
... View more