Date: Sat, 3 Jun 2006 11:15:05 -0700
Reply-To: chandu.isi@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: chandu.isi@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: Is it possible ?- Between DATA Final & SET Source
In-Reply-To: <1149354507.066260.142430@i40g2000cwc.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Let us see the the following ex:
PROGRAM 1-B
DATA CLIENT_LEUVEN;
INFILE CLIENT;
INPUT CLIENT_ID $ 1 - 14
LAST_NAME $ 16 - 35
FIRST_NAME $ 37 - 56
HOME_CITY $ 58 - 77
HOME_COUNTRY $ 79 - 93
...;
IF HOME_CITY = 'LEUVEN';
RUN;
DATA CLIENT_LEUVEN;
INFILE CLIENT;
INPUT HOME_CITY $ 58 - 77 @;
IF HOME_CITY = 'LEUVEN';
INPUT CLIENT_ID $ 1 - 14
LAST_NAME $ 16 - 35
FIRST_NAME $ 37 - 56
HOME_COUNTRY $ 79 - 93
...;
RUN;
In the above example 1-B, I am reading ALL variables into PDV and then
apply IF condition. As in the 1-C example I am reading the variable on
which I am applying IF condition then ONLY I am reading other variables
if it satisfies.
I mean can we do
DATA Fianl;
....some conditions....;
SET source;
like that?
As we can apply statments in between
DATA Final;
...some options/statments(for e.g LENGTH statement);
SET source;
Thanks in advance
chandu
chris@oview.co.uk wrote:
> Hi,
>
> Yes, it is possible - depending on exactly what you're trying to do.
> It seems like you need to use the 'where' data set option:
>
> data test1;
> set test (keep = x where = (x > 1));
> z = x;
> run;
>
> but perhaps this isn't exactly what you meant? Your example code could
> be made to work, but I think you'd need to use the 'point' option on
> the second 'set' statement in order to access the correct observation.
> I don't see why you'd want to so it that way, though, so I must be
> missing something??
>
> Chris.
> --------------------------------------------------------
> Elvis SAS Log Analyser - http://www.oview.co.uk/elvis
> --------------------------------------------------------
>
>
> chandu.isi@gmail.com wrote:
> > Hi All,
> >
> > I have a SAS dataset with say 100 varaibles.
> >
> > Is it possible to read ONLY the observations which satisfies some
> > conditions( if or where based on say 2 fields-variables) into PDV?
> >
> > Say for eg: something like below
> >
> > data test1;
> > set test(keep = x);
> > if x > 1 then do;
> > set test;
> > z = x;
> > end;
> > run;
> >
> > Thanks in advance,
> > Chandrasekhara Rao.