Date: Sat, 21 Feb 2004 15:05:59 -0500
Reply-To: Anbu Arasu <aarumugam@STTHOMAS.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Anbu Arasu <aarumugam@STTHOMAS.EDU>
Subject: value increments in do loop not in set statement
The problem is, variables pos1 and pos in doloop dataset is incrementing
in every iteration. But this is not happening in dataset setstatement. I
could not understand. Please help me.
Thanks,
Anbu
data doloop;
pos1=35;
do i=0 to 5;
pos=sum(pos1,10);
pos1=pos;
*retain;
output doloop;
end;
Output is
Obs pos1 i pos
1 45 0 45
2 55 1 55
3 65 2 65
4 75 3 75
5 85 4 85
6 95 5 95
data setstatement(drop=trtgrp);
pos1=35;
set demo.treatment;
pos=sum(pos1,10);
pos1=pos;
retain pos1;
output setstatement;
run;
Output is
Obs pos1 pos
1 45 45
2 45 45
3 45 45
4 45 45
5 45 45
6 45 45
|