Date: Thu, 21 Jan 2010 15:16:15 -0500
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: IN - Option
with that option you can see where the data come from. You know that for
datasetA and for datasetB, but you normally don't know it for vacdata.
In your case you can also see it by obs-number. The first obs are from
datasetA, the rest from datasetB. If you change the order for vacdata or
you have a BY-processing in the data-step, you can see the origin of each
obs in src.
Sometimes important is to be sure that data only come from one of the
datasets. E.g. you want to merge two datasets, but you don't want to add
obs from the right side which are not in the left side (by key for sure):
data res;
merge left (in=inleft) right;
by key;
if inleft;
run;
I use the IN operator very often for that.
Gerhard
On Thu, 21 Jan 2010 14:20:36 -0500, SAS Swamy <sasswamy@GMAIL.COM> wrote:
>All,
>
>Can someone please let me know , What exactly would be the use for using
>IN option in data set
>
>For e-g
>data vacdata;
> length src $1.;
> set datasetA (in=in1)
> datasetB (in=in2);
> if in1 then src='1'; else src='2';
> format src $1.;
>run;
>
>I was trying to find the documentation , but somehow I am able to see only
>for MERGE function, possible please send me the links with details If any
>
>- swamy
|