Date: Thu, 30 Mar 2000 10:04:54 -0800
Reply-To: Ya Huang <ya.huang@AGOURON.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AGOURON.COM>
Subject: Merge, why I can't turn off the default retain?
Content-Type: text/plain; charset=us-ascii
Hello all,
It seems that whenever I think I have known something well in SAS,
I'll be proved wrong. This time is "Merge":
data xx;
do x=1 to 2;
do y=1 to 5;
output;
end;
end;
data xx_h (rename=(y=ny));
set xx;
by x;
if first.x then delete;
else output;
data xx;
merge xx(in=a) xx_h(in=b);
by x;
if a and not b then ny=.; /**********/
options nocenter;
proc print;
run;
====================
OBS X Y NY
1 1 1 2
2 1 2 3
3 1 3 4
4 1 4 5
5 1 5 5 <== retained
6 2 1 2
7 2 2 3
8 2 3 4
9 2 4 5
10 2 5 5 <== retained
Question is why I still get ny retained in obs=5,10?
I expected after using the "if a and not b then ny=." statement,
ny would be missing in obs=5,6. But as you can see,
they are still retained. Can somebody tell me why?
Thanks,
Ya Huang