Operators

advertisement
Language Reference under IML
Base SAS Functions Accessible from SAS/IML
Has listing of functions that were used in data step/base language that can be used in IML. Here are
some.
NOTE: In IML the use of a goto statement is limited to being used within a do loop. Often there are ways
to avoid the use of the goto using do while.
Probability Functions
CDF
computes cumulative distribution functions
LOGPDF
computes the logarithm of a probability function
LOGSDF
computes the logarithm of a survival function
PDF
computes probability density functions
POISSON
returns the probability from a Poisson distribution
PROBBETA
returns the probability from a beta distribution
PROBBNML returns the probability from a binomial distribution
PROBBNRM returns the probability from the bivariate normal distribution
PROBCHI
returns the probability from a chi-squared distribution
PROBF
returns the probability from an F distribution
PROBGAM
returns the probability from a gamma distribution
PROBHYPR returns the probability from a hypergeometric distribution
PROBMC
returns a probability or a quantile from various distributions for multiple
comparisons of means
PROBNEGB returns the probability from a negative binomial distribution
PROBNORM returns the probability from the standard normal distribution
PROBT
returns the probability from a t distribution
SDF
computes a survival function
Quantile Functions
BETAINV returns a quantile from the beta distribution
CINV
returns a quantile from the chi-squared distribution
FINV
returns a quantile from the F distribution
GAMINV returns a quantile from the gamma distribution
PROBIT
returns a quantile from the standard normal distribution
TINV
returns a quantile from the t distribution
You can also use the quantile ( ) function as used before in the data step.
Operators
Addition Operator: +
Comparison Operators: < > = <= >= ^=
Concatenation Operator, Horizontal: ||
Concatenation Operator, Vertical: //
Direct Product Operator: @
Division Operator: /
Element Maximum Operator: <>
Element Minimum Operator: ><
Index Creation Operator: :
Logical Operators: & | ^
Multiplication Operator, Elementwise: #
Multiplication Operator, Matrix: *
Power Operator, Elementwise: ##
Power Operator, Matrix: **
Sign Reverse Operator: Subscripts: [ ]
Subtraction Operator: Transpose Operator: ` (or you can use t( ) for transpose
There is some ability to call a SAS procedure from within IML but it doesn’t really offer much as
we can’t use the results from the proc within IML.
Usage Note 33542: Calling a SAS procedure within PROC IML
You can call another procedure from within an IMLPlus program using a SUBMIT block
in PROC IML beginning with SAS/IML 9.22 in SAS 9.2 TS2M3.
You can also use the SUBMIT block to call SAS procedures in SAS/IML Studio
beginning with SAS 9.2. SAS/IML Studio is provided with SAS/IML and is documented
in the SAS/IML Studio User's Guide and in SAS/IML Studio for SAS/STAT Users. Note
that SAS/IML Studio was previously called SAS STAT Studio and is documented in the
SAS Stat Studio User's Guide and in SAS Stat Studio for SAS/STAT Users. For
information on downloading SAS/IML Studio, see the SAS/IML download page.
Example
In this example, the UNIVARIATE procedure is called within SAS/IML to compute a
kernel density estimate for some randomly generated data.
The following statements generate data from a mixture of normal distributions and
stores them in a matrix, X. Note that when run in SAS/IML Studio, the PROC IML
statement below is not necessary and should be omitted.
proc iml;
call randseed(123);
y = j(400,1);
call randgen(y, 'normal');
z = j(100,1);
call randgen(z, 'normal', 3, 0.5);
x = y // z;
To use these values in PROC UNIVARIATE, write them to a SAS data set using
CREATE and APPEND statements. These statements create data set A from matrix X.
create a var {"x"};
append;
close a;
Next, the UNIVARIATE procedure is called from within IML by using SUBMIT and
ENDSUBMIT statements. The UNIVARIATE procedure creates an output data set
(KerOut) that contains 401 observations.
submit;
proc univariate data=a;
var x;
histogram / kernel;
run;
endsubmit;
Download