I am currently studying for my Advanced SAS certification using Chapter 16 of the Advanced Prep Guide. On page 586 is SAS code for using nested do-loops to load an 2-dimensional array ("Targets") from a SAS dataset (sasuser.ctargets) which contains stored array data. The beginning of the code reads as follows: data work.lookup; array Target{1997:1999, 12} _temporary_; if _n_=1 then do i = 1 to 3; set sasuser.ctargets; array mnth(*) Jan--Dec; do j=1 to dim(mnth); targets(year,j) = mnth(j); end; end; [more code ... that transfers the data from the targets array to the data set work.lookup] My question concerns where the data from sasuser.ctargets lives when it is "set," and how the 3 iterations of the outer do-loop moves down the data coming from sasuser.ctargets to transfer it into the arrany mnth. I read the "set sasuser.ctargets" statement as reading the data from sasuser.ctargets into the data set work.lookup -- but work.lookup is eventually used to build the new data set that only contains data from sasuser.ctargets in a sort of a transposed format. I also do not see where "year" gets defined -- it just appears when needed to indicate the row number. Since year is not defined, and since year does not = i, how does the outer do loop know to iterate down the rows? sas
... View more