PING
0.9
Statistical data handling and processing in production environment
|
Generate the expression used to define whether any series of variables fills a specified criterion in a SQL procedure.
var
: (option) variable(s) for which the test is operated; the variable(s) listed in var
must be already present (i.e., originally coded in the processed table);calcvar
: (option) ibid, however the variable(s) listed in calcvar
refer to previously calculated variables (e.g. , within the same SELECT
statement).val
: a boolean flag (0/1) set to 1 for observations for which the expression cond
holds.
Let us consider the following table dsn1
:
a |
---|
-1 |
-2 |
-3 |
-4 |
-5 |
Then it is only necessary to run the following SQL procedure:
so as to create the following table dsn2
:
absa | conda | condabsa |
---|---|---|
1 | 0 | 0 |
2 | 0 | 0 |
3 | 0 | 1 |
4 | 0 | 1 |
5 | 0 | 1 |
since the calls to macros %sql_operation_sum
:
return respectively the expressions:
expr1=a GT 2
, andexpr2=calculated absa GT 2
.The macro %sql_operation_any
is a wrapper to L. Joseph's original %AnyOf
macro. Original source code (no license, no disclaimer) is available at http://www.medicine.mcgill.ca/epidemiology/joseph/pbelisle/MeanOf.html.
%sql_operation_mean, %sql_operation_sum, %sql_operation_count.