Date: Thu, 2 Mar 2000 16:45:25 -0500
Reply-To: WHITLOI1 <WHITLOI1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: WHITLOI1 <WHITLOI1@WESTAT.COM>
Subject: Re: Fundamental Question
Content-Type: text/plain; charset=US-ASCII
Mohammad,
Consider
data a b;
set k;
u = i * x ;
if i in (2, 4, 6) then do;
y=x;
output a;
end;
else if i in (9, 10) then do;
z=x;
output b;
end;
q = 10 * x ;
output ;
run ;
Do you want SAS trying to guess whether u or q should be on A or B or both or
neither? If yes, can you guess what I intended? Would your answer change if we
added C to the list of data sets on the DATA statement. In general computer
laguages give the programmer power by letting him have control of the decisions.
The cost is usually more work in coding. The alternative is usually a crippled
language. Of course the best languages have good
defaults. The SAS default is put everything on every data set. What are the
good alternatives? You might just try to completely explain on what basis SAS
should have put
Y on A, and not on B. Then try to find some good examples where your defualt
would
either make for a lot of extra code or be very hard for the programmer to
remember. What
if we had used
array look (2) y z ;
and
look(1) = x ;
or
look(2) = x ;
Ian Whitlock <whitloi1@westat.com>
____________________Reply Separator____________________
Subject: Re: Fundamental Question
Author: Mo Uddin-M <uddin.m@PG.COM>
Date: 3/2/2000 2:56 PM
Thanks to Jack Hamilton, Pete Laud, F.J. Kelley, David Ward & Jim Edgington for
answering my question. I knew I could use KEEP/DROP. My question was HOW OR WHY
it works like this. According to the logic of the code, one should not see Z in
data a or Y in data b. I guess Pete Laud and F. J. Kelley explained it well.
Thanks again.
Mohammad Uddin
|