Recently i've discovered some strange behavior (at least for me) of SET statement in some special situation. Consider two datasteps: 1st) data New; do i = 1 to 2; set Old; end; run; 2nd) data New; set Old; set Old; run; The stages of 1st datastep execution are clear for me. In do-loop SET statement reads odd observation firstly and even observation secondly. Both observations are read to the same PDV, that's why NEW contains only even observations. I thought that second datastep must work just the same because it's just unrolled version of the first datastep. But it works differently. NEW and OLD datasets are equal. It doesn't matter how much "set Old;" statements to write in second datastep, result is just the same. For some reason SET statement doesn't move some kind of pointer over the dataset for that style of coding. I haven't found any explanation of such behavior on help pages or anywhere else. Hope that someone can explain it. Cheers, Mike
... View more