Date: Thu, 30 Jun 2011 16:34:31 +0000
Reply-To: "DUELL, BOB (ATTCINW)" <bd9439@ATT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "DUELL, BOB (ATTCINW)" <bd9439@ATT.COM>
Subject: Re: OT: Chance to Make SAS-L History: Did You Know That...
In-Reply-To: <201106301617.p5UAw7FF008366@willow.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
You're right of course, this will not work for me (duh).
Oh well, the brain seems to have started the holiday weekend a bit early.
Thanks Chang!
-----Original Message-----
From: Chang Chung [mailto:chang_y_chung@HOTMAIL.COM]
Sent: Thursday, June 30, 2011 9:17 AM
To: DUELL, BOB (ATTCINW)
Subject: Re: OT: Chance to Make SAS-L History: Did You Know That...
On Thu, 30 Jun 2011 15:43:12 +0000, DUELL, BOB (ATTCINW) <bd9439@ATT.COM>
wrote:
>Although I have never used this tip, I can think of at least one example
where it might be useful. I have a complex data step that merges several
other data sets on a common BY variable (user_id). I need to guarantee
that the record exists in some data sets, but not all. For example, my
current code looks similar to this:
>
>data permdata;
> merge ds1(in=a)
> ds2(in=b)
> ds3
> ds4
> ds5(in=c)
> ds6(in=d);
> by user_id;
> if a and b and c and d;
>run;
>
>Every once in a while I need to add or remove data sets from this
structure. Using this tip, I might be able to simplify this as follows:
>
>data permdata;
> merge ds1(in=keepme)
> ds2(in=keepme)
> ds3
> ds4
> ds5(in=keepme)
> ds6(in=keepme);
> by user_id;
> if keepme;
>run;
you might not! since "if keepme;" above does *not* seem to be equivalent to
"if a and b and c and d" above; it is rather equivalent to "if a or b or c
or d"!
cheers,
chang
|