Questions tagged [sas-iml]

SAS/IML is the matrix programming language component to SAS (similar to R).

SAS/IML is the matrix language component of SAS software. It interfaces with the base SAS programming environment, allowing you to smoothly transition from matrix operations to dataset operations, and to use SAS' full suite of statistical tools while enjoying the power of a fully featured matrix language.

SAS/IML also allows an interface into R, to allow users to take advantage of the power of SAS while maintaining the flexibility of using R packages as well.

For more information see http://www.sas.com/technologies/analytics/statistics/iml/index.html

98 questions
7
votes
1 answer

Generate correlated random variables that follow beta distributions

I need to generate random values for two beta-distributed variables that are correlated using SAS. The two variables of interest are characterized as follows: X1 has mean = 0.896 and variance = 0.001. X2 has mean = 0.206 and variance = 0.004. For…
6
votes
3 answers

Does SAS have a equivalent function to all() or any() in R

In R you can perform a condition across all rows in a column variable by using the all() or any() function. Is there an equivalent method in SAS? I want condition if ANY rows in column x are negative, this should return TRUE. Or, if ALL rows in…
MWw
  • 150
  • 1
  • 8
5
votes
1 answer

Hessian in SAS?

Is there any way to get the Hessian matrix in the proc logistic in SAS? Or which will be an option to calculated it taking from departure the proc logsitic? I have been reading the function documentation but cannot see that there is a way to include…
user1571823
  • 394
  • 5
  • 20
3
votes
1 answer

compute the logarithm of a matrix using SAS IML

How can I compute the logarithm of a matrix using SAS IML? I am trying to get something similar to the functionality of the Matlab logm() function.
jaamor
  • 317
  • 3
  • 15
3
votes
2 answers

Using a vector generated in SAS/IML as a macro variable

I am writing a macro that will run PROC MIXED with the level-1 residual variance fixed to a near-zero value using the PARMS statement. I am trying to generate the bulk of the starting values for the PARMS statement using SAS/IML, something…
John
  • 33
  • 3
2
votes
2 answers

how to multiply each row with each row of another matrix elementwise in sas?

I have a row matrix (vector) A and another square matrix B. How can I multiply each row of matrix B with the row matrix A in SAS using proc iml or otherwise? Let's say a = {1 2 3} b = {2 3 4 1 5 3 5 9 10} My output c would be: {2 6 12 1 10 9 5 18…
souravsarkar59
  • 127
  • 1
  • 1
  • 8
2
votes
4 answers

Countifs in SAS

I have a SAS dataset with 3 columns. A FirmIndex, a ProducIndex and a third column called PrChange. Within each FirmIndex & ProductIndex group I want to count how many PrChange are different from . and from 0, and add that to a column called Number.…
phdstudent
  • 1,060
  • 20
  • 41
2
votes
1 answer

Different result from SAS/IML and R, in SVD decomposition

shortly, I'm translating an R package into IML languageand I'm totally struggling myself with the SVD decomposition result between R and IML. R code: s <- svd(MAT) s$v SAS/IML code: call svd (U, D, V, MAT); print V; V is in both sides the matrix…
stat
  • 699
  • 3
  • 10
2
votes
2 answers

How to make multiple data sets using do loops in SAS/IML?

I was trying the following codes: proc IML; do i=1 to 20; [some codes to execute] data[i]; end; QUIT; So I am expecting to get 20 data sets after completing the do loops. Is it possible in SAS? I can do it using macro, but I do not like…
overwhelmed
  • 225
  • 3
  • 12
2
votes
2 answers

Distance function for sas 9.2

In SAS 9.3 we can easily calculate the Euclidean distance matrix between lat, lon by using function distance proc iml; n=5; seed=123456789; lat= J(n,1,0); lon= J(n,1,0); i = 1; do while (i <= n); lat[i] = uniform(seed); …
Math
  • 1,274
  • 3
  • 14
  • 32
2
votes
2 answers

SAS Randgen call with Weibull distribution

I am trying to use call randgen within proc IML to create 10 random numbers that follow a Weibull distribution with certain parameters. Here is the code I am using (obviously there will be more than just one loop but I am just testing right now):…
kelchenk
  • 23
  • 2
2
votes
2 answers

SAS Proc IML: Minimizing a function with respect to one variable

Using SAS proc IML, I have a function: CVF(m,p,h,pi,e); I would like to guess h which minimizes this function. Is there some built-in subroutine to minimize it? Or how can I construct an iterative process for it? Every other variables are defined.
2
votes
1 answer

How to conditionally define a macro-variable inside proc iml?

I have an issue with combining proc iml, if/then and call symputx. If I run the following code : proc iml; call symputx("noif",3); a=1; b=&noif; /* 1) : works*/ if a=1 then call symputx("withif",1); if a=1 then print a;…
Vincent
  • 955
  • 2
  • 15
  • 32
2
votes
2 answers

Loop over names in SAS-IML?

How can I read a SAS-Dataset with a name given as stem+suffix into IML? The stem is given as a SAS macro variable, the suffices I intend to use are in a string-vector in IML. In R I would use suffix<-c('s1','s2') for (s in suffix){ …
user1965813
  • 671
  • 5
  • 16
1
vote
1 answer

Set initial values for solving nonlinear equation by SAS proc IML

I am using SAS proc IML to solve the nonlinear equation (x-0.11)(x-0.32)(x-0.98) = 0. I have to provide initial values for the proc IML. I would like to use 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 as initial values. The SAS program for…
Mizzle
  • 747
  • 4
  • 14
1
2 3 4 5 6 7