First off, you are using &m, a macro variable, where I don't think you mean to. I think you need an array - two really - coeff0 [a bunch of variables] coeff[a bunch of variables] The two combined need to have 33 columns in total or more. If they both have 33, then you can otherwise use your code as is, just change = coeff0&m to = coeff0 and similar for the other reference. The second problem is that you're confused as to what happens when you have two SET statements. It doesn't go through one and then go through the other; it does one line of each, then the second line of each, until one of them runs out of rows. I'm guessing table_coeffiecients runs out after a row... You need to do something like this. This will iterate through all of table_coefficients the first time through the data step and then return control to the data step loop, then looping normally through the second dataset. This may be overkill (if you have only one row in table_coefficients) and it may not do precisely what you want (if you want, say, different rows in table_coefficients for different rows in data_source) but it should show you the general idea. (I would guess you have only one row in table_coefficients, so it should work but is a bit of overkill.) data work.table_results; array coeffm3 {1:2,2:4,0:32,1:33} _temporary_; if _n_ = 1 then do _pointer = 1 to nobs_coeff; set work.table_coefficients point=_pointer nobs=nobs_coeff; if type = 'N' then do; do i = 1 to 2; do j = 2 to 4; do k = 0 to 32; do m = 1 to 33; if m < 10 then coeffm3{i,j,k,m} = coeff0&m; else coeffm3{i,j,k,m} = coeff&m; end; end; end; end; end; end; set WORK.data_source; g = substr(gewest,2,1); do n=1 to (delta + 1); coe = coeffm3(model, g, 1, n); number_with_coeff = number * coe; output temp9; end; run;
... View more