Date: Mon, 16 Oct 2000 21:39:24 -0400
Reply-To: paula <icj808@USWEST.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: paula <icj808@USWEST.NET>
Subject: keep= vs. Keep statement
My code looks like this
[
data set1 set2;
infile.......;
input A $1 B 2.2 C 3.2;/*A can only take a or b*/
if A = 'a' then do;
x=b+c;
keep a x;
output set1;
end;
if A = 'b' then do;
y=b+c;
keep a y;
output set2;
end;
]
I simply want to keep only TWO variables in the resulting subsets. But the
result is set1 also retains y flooded with missing values, while set2 has
variable included full of missing values as well.
I know the solution is to use Keep= in the Data statement when 'declaring'
the two data sets. Could somebody explain why my original code does not
work?
Thanks.
Sincerely
Paula D