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
0
votes
2 answers

SAS: working with matrices using IML

So I am trying to calculate this formula but the results are strange. The elements are extremely large so I am not sure where I went wrong. I have attached a photo of the formula: and here is my code: *calculating mu_sum and…
duckman
  • 687
  • 1
  • 15
  • 30
0
votes
0 answers

Calling an R function from loaded file in SAS

I have an .R file that has a few functions stored in it. Functions as in FunctionName <- function(x). I am trying to write a SAS code that references this R file and can call and run one of the functions in the R file. Here is my code: proc…
SoloSpirit
  • 87
  • 12
0
votes
1 answer

Creating an average matrix from four individual matrices of same size in SAS / IML

I am using IML/SAS in SAS Enterprise Guide for the first time, and want to do the following: Read some datasets into IML matrices Average the matrices Turn the resulting IML matrix back into a SAS data set My input data sets look something like…
Martin Reindl
  • 989
  • 2
  • 15
  • 33
0
votes
1 answer

Cell by cell average of four tables in SAS

I have three tables which look look as follows: A B C A B C A B C D 1 2 3 D 2 3 4 D 3 4 5 E 4 5 6 E 5 6 7 E 6 7 8 F 7 …
Martin Reindl
  • 989
  • 2
  • 15
  • 33
0
votes
1 answer

SAS Proc IML Optimization

proc iml; start f_prob(beta) global(one_m_one, pone_m_one); p = nrow(one_m_one); td = j(p,3,0.); a = 1; do i = 1 to p; td[i,1] = exp((one_m_one[i,1])*(beta[1]) + (one_m_one[i,2])*(beta[2]) + (one_m_one[i,3])*(beta[3]) +…
Sopon
  • 1
  • 2
0
votes
1 answer

How to create multiple datasets in SAS using loops

proc iml; use rdata3; read all var _all_ into pp; close rdata3; do i = 1 to 1050; perms = allperm(pp[i, ]); create pp&i from perms[colname= {"Best" "NA1" "NA2" "Worst"}]; append from perms; close pp&i; end; I will like to create…
Sopon
  • 1
  • 2
0
votes
3 answers

Using a sas lookup table when the column number changes

I have two sas datasets, Table 1 Table 2 col1 col2 col3 col4 col5 a b . 1 2 3 4 1 1 1 5 8 6 1 1 4 2 5 9 7 1 4 3 3 6 9 7 1 …
Harry
  • 15
  • 4
0
votes
1 answer

Performing calculations on only certain columns in a matrix in SAS IML

I need to create, in IML, a matrix with several columns and do some calculations on only some columns (the values in one column must not change). For example, I'll need to multiply one column by another elementwise. What is the syntax for this?
Mhoram
  • 421
  • 2
  • 6
  • 13
0
votes
1 answer

SAS IML equivalents of Alter Table and Update

Am I right that, to add a new column to an existing SAS dataset, I use the Alter Table statement (and, for populating the new column, the Update statement) in proc sql? If so, what are the equivalent statements in proc iml (or can it even be done in…
Mhoram
  • 421
  • 2
  • 6
  • 13
0
votes
2 answers

Making SAS handle very small numbers without rounding

I have a range of large (4- or 5-digit) numbers, which I need to raise to the -1 power. Because the numbers are all so large, they are obviously going to be very small when raised to that power. When I do it in SAS (using the elementwise operator),…
Mhoram
  • 421
  • 2
  • 6
  • 13
0
votes
3 answers

Raising an array of numbers to a power in SAS

I need to raise every number in an array (a column in a SAS dataset) to a certain power. I've been told that this can be done in IML, after writing the contents of the column to a matrix. However, a matrix must apparently be square to be raised to a…
Mhoram
  • 421
  • 2
  • 6
  • 13
0
votes
3 answers

sas macro loops using index numbers

I am very keen to learn whether I can handle or not such situations in SAS Base without using SAS IML; Let's say I have the vector have a b c d e f 1001 JPN 10,000 50% JPN 2,000 1001…
Jonsi Billups
  • 133
  • 1
  • 3
  • 15
0
votes
1 answer

difference between svd() and call svd, R and IML

I'm translating a package from R to IML, and this will be free online when it will be done :). I gain different results from the decomposition of a big matrix, both results seems the same when you look at them, but, if for example I take first 2…
stat
  • 699
  • 3
  • 10
0
votes
1 answer

How to do an anova with permutation in sas

How could I do ANOVA with permutation in SAS? The purpose of that is kind of shorting the running time and save the output instead of print them out. I once used iml did a paired t-test with permutation. It went great. But I'm a bit concerned with…
0
votes
2 answers

Do Loop for Matrix Multiplication in SAS

I have a 6*6 matrix called m1, and I want to use Do Loop in SAS to create matrices such that m2=m1*m1; m3=m2*m1; m4=m3*m1 ... mi=m(i-1)*m1. Here is what I wrote: proc iml; use a; read all into cat(m,1); do i=2 to…
Irena
  • 1