|
One more note of caution. While the original paper I found stated: "The
SAME-AND operator need not be in the same PROC or DATA step as the
previous WHERE statement," the following indicates a different behavior:
proc means data=sashelp.class;
where sex eq 'M';
var age;
run;
proc means data=sashelp.class;
where same and age lt 12;
var age;
run;
data test1;
set sashelp.class;
where sex eq 'M';
run;
data test2;
set sashelp.class;
where same and age lt 12;
run;
When used in either the data step, or proc, SAS indicates:
NOTE: Where clause has been augmented
but the original where clause appears to be ignored anyway.
In all fairness to SAS, the documentation doesn't appear to mention
between step application.
Art
--------
On Tue, 21 Sep 2010 09:32:04 -0500, Data _null_; <iebupdte@GMAIL.COM>
wrote:
>It can also be written WHERE ALSO but I can find the documentation
>except a referene to WHERE ALSO window in PROC REPORT.
>
>131 proc print data=sashelp.class;
>132 where sex eq 'M';
>133 where also name like 'J%';
>NOTE: WHERE clause has been augmented.
>134 run;
>
>NOTE: There were 3 observations read from the data set SASHELP.CLASS.
> WHERE (sex='M') and name like 'J%';
>NOTE: PROCEDURE PRINT used (Total process time):
> real time 0.01 seconds
> cpu time 0.01 seconds
>
>
>135
>136 proc print data=sashelp.class;
>137 where sex eq 'M';
>138 where same and name like 'J%';
>NOTE: WHERE clause has been augmented.
>139 run;
>
>NOTE: There were 3 observations read from the data set SASHELP.CLASS.
> WHERE (sex='M') and name like 'J%';
>
>
>On Tue, Sep 21, 2010 at 9:24 AM, Data _null_; <iebupdte@gmail.com> wrote:
>> On Tue, Sep 21, 2010 at 9:17 AM, Viel, Kevin <kviel@sjha.org> wrote:
>> 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
>>> ;
>>
>> It's not better but for a different purpose.
>>
>> SAME-AND Operator
>> Use the SAME-AND operator to add more conditions to an existing WHERE
>> expression later in the program without retyping the original
>> conditions. This capability is useful with the following:
>>
>> interactive SAS procedures
>>
>> full-screen SAS procedures that enable you to type a WHERE expression
>> on the command line
>>
>> any kind of RUN-group processing.
>>
>> Use the SAME-AND operator when you already have a WHERE expression
>> defined and you want to insert additional conditions.
>>
|