Set repeated data sets in a SAS data step -
Set repeated data sets in a SAS data step -
suppose have sas dataset looks this:
id x 1 1234 2 2345 3 3456
i need new info set has info set read in (say) 2 times, new variable indicating "replication" is:
id x rep 1 1234 1 2 2345 1 3 3456 1 1 1234 2 2 2345 2 3 3456 2
it of import info read in exact order -- entire initial info set read once, again, etc.
any ideas on efficient way in info step? (in reality info set huge, need read several times, , want avoid sorting.)
i tried this, order of observations in new info set not want:
data foo; set tmp; rep=1; output; set tmp; rep=2; output; run;
if want maintain info step, work described.
data foo; set tmp (in=ina) tmp (in=inb); if ina rep=1; if inb rep=2; run;
sas
Comments
Post a Comment