| Date: | Tue, 21 Sep 2010 10:17:26 -0400 |
| Reply-To: | "Viel, Kevin" <kviel@SJHA.ORG> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Viel, Kevin" <kviel@SJHA.ORG> |
| Subject: | Re: SAME-AND operator in Data Step |
| In-Reply-To: | <D318FFABEC06504E9EB926116EF6CC0605DFEDEB@VAPWVBE022.us.ad.wellpoint.com> |
| Content-Type: | text/plain; charset="us-ascii" |
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Chaitovsky, Avi-Gil
> Sent: Tuesday, September 21, 2010 9:24 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: SAME-AND operator in Data Step
>
> I inherited the following code (I've masked variable names and values),
> which uses SAME-AND operators, which I'm not familiar with. Based on
> what I read in the SAS documentation, I'm not sure I understand why it
> was used here - or where it would be helpful to use. Could someone
> please enlighten me?
>
>
>
> data NEWDATA / view=NEWDATA;
>
> set OLDDATA;
>
>
>
> where same and PRODUCT in('H','P','Q') or GROUP=:'E';
>
> where same and FLAG_A='Y';
>
> where same and FLAG_B='N';
>
> where same and INCURRED_DATE between &DATE1 and &DATE2;
Had you not posted this, I would have wondered about this code had I encountered it. I am not sure how this might be better than:
Where ( PRODUCT in('H','P','Q') or GROUP=:'E' )
And FLAG_A='Y'
And FLAG_B='N';
And INCURRED_DATE between &DATE1 and &DATE2
;
This is more legible to me. The only thing that seems reasonable is that this might have come from a macro generated from a list of conditions:
%Do %While ( &Condition. Ne ) ;
Where Same And &Condition. ;
%End ;
Which is not much simpler to code than:
Where &Condition.
%Do %While ( &Condition. Ne ) ;
And &Condition.
%End ;
;
Of course, I left some details out, but the jist is covered...
-Kevin
Kevin Viel, PhD
Senior Research Statistician
Patient Safety & Quality
International College of Robotic Surgery
Saint Joseph's Translational Research Institute
Saint Joseph's Hospital
5671 Peachtree Dunwoody Road, NE, Suite 330
Atlanta, GA 30342
(678) 843-6076: Direct Phone
(678) 843-6153: Facsimile
(404) 558-1364: Mobile
kviel@sjha.org
Confidentiality Notice:
This e-mail, including any attachments is the
property of Catholic Health East and is intended
for the sole use of the intended recipient(s).
It may contain information that is privileged and
confidential. Any unauthorized review, use,
disclosure, or distribution is prohibited. If you are
not the intended recipient, please delete this message, and
reply to the sender regarding the error in a separate email.
|