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
1
vote
1 answer

SAS Proc IML simulating using empirical distribution

I am trying to simulate data using an empirical distribution. For example, say there are five outcomes with probabilities as shown in the vector below: PROBABILITY_VECTOR = [0.1, 0.2, 0.3, 0.25, 0.15] The PROBABILITY_VECTOR is calculated from…
MrAnalyst
  • 23
  • 6
1
vote
2 answers

SAS proc iml use to impute the missing sales from the first or second month based on the average of the next two observations

I'm looking a way to impute using proc iml in sas the average of the sales of the next two months. As you can see sometimes I dont have the sales of 201901 and sometimes is missing on 201902 For example for the first barcode I want to find the…
1
vote
1 answer

How to call R repeatedly in a loop and retrieve the results for further processing in SAS

I have simplified the code to illustrate the problem: proc iml; var=40; call ExportMatrixToR(var, "var" ); submit / R; sample<-sample(1:var, 50, replace=TRUE) endsubmit; call ImportDataSetFromR( "WORK.rdata", "sample" ); proc means data=rdata;…
Ben Z
  • 105
  • 6
1
vote
1 answer

rolling up groups in a matrix

Here is the data I have, I use proc tabulate to present it how it is presented in excel, and to make the visualization easier. The goal is to make sure groups strictly below the diagonal (i know it's a rectangle, the (1,1) (2,2)...(7,7) "diagonal")…
1
vote
3 answers

Reset random number stream

It appears that SAS/IML has the ability to reset it's random number stream (doc link) . Is there a similar feature for random number routines in the SAS data step? Based on this post, it seems that subsequent calls to streaminit are ignored…
Robert Penridge
  • 8,424
  • 2
  • 34
  • 55
1
vote
1 answer

working with matrices and samples using PROC IML

I am trying to draw random samples from some distribution as follows: my code runs but the numbers look strange. so I am not sure what went wrong, maybe some operators. The elements are extremely large. my…
duckman
  • 687
  • 1
  • 15
  • 30
1
vote
3 answers

SAS 9.3: Changing the shape of matrix with missing rows

I have a data with the following formats, P1 P2 Score A A 1 A B 2 A C 5 B B 4 B C 9 C A 3 C B 6 which I want to make them into a 3*3 matrix, for those missing rows are zeros. I've googled and found…
user131605
  • 117
  • 4
1
vote
1 answer

Creating a Control Group in SAS

How can I create a subset of a dataset in SAS where I want to determine the mean, variance, and number of observations for a variable before hand? Example: OBS NAME x1 x2 1 Bill 3 2 2 James 4 5 3 Rick 5 6 4 Bob 3 7 5 Clas 5…
GoCubs
  • 23
  • 4
1
vote
2 answers

Equivalent to SAS function repeat in PROC IML

I want to define a string in a PROC IML, say "aaaaa" (five "a"). In a DATA step, I would use the repeat() function, which creates a string repeating substrings, as explained in the documentation. data _null_; x=repeat('a',4); /* string with five…
Vincent
  • 955
  • 2
  • 15
  • 32
1
vote
1 answer

SAS IML append vector to dataset

I'm trying to append a new vector to a dataset in SAS IML I create these data: proc iml; x = {1 2 3}; y = {1 2 3}; create data1 var {x y}; append; close data1; quit; And then I would like to append new vector "z" to the dataset proc iml; use…
Rasmus Larsen
  • 5,721
  • 8
  • 47
  • 79
1
vote
1 answer

Enable R (RLANG) in SAS Studio for OSX (virtual box)

I have installed SAS Studio in OSX via virtualBoxVM. All seems working except making R run from SAS, which is what I am looking for. Running : proc options option=RLANG; run; I get SAS (r) Proprietary Software Release 9.4 TS1M3 NORLANG …
Miguel Vazq
  • 1,459
  • 2
  • 15
  • 21
1
vote
2 answers

How to replace a whole observation working on a SAS file through IML

Long time user, first time poster. I am very new to IML and have played around in R before. I am currently trying to create an adjacency list for easier computation of networks in SAS/IML. The file i am working on is huge. I am doing an…
1
vote
1 answer

SAS IML and SAS/R interface

Does one need to have SAS IML installed to use the SAS/R interface? or should/could one use the sas x command to run R and feed data to it?
gduhoffmann
  • 29
  • 1
  • 7
1
vote
2 answers

IML correlation from different matrices

given a matrix X(n * p), I want to split X into Y1(n * p-k) and Y2(n * k), where Y1 is composed by the first k columns of X and Y2 the others. Now, in R I can get the "crossed" correlation between the columns of Y1 and Y2 calling cor(Y1,Y2,…
stat
  • 699
  • 3
  • 10
1
vote
1 answer

get new data from old one SAS

I'm new in SAS and I have this example : proc iml; x={1 2 3 4 5 6 7 8 9}; y={2,3,5,4,8,6,4,2,2}; z={1,1,1,1,2,2,2,2,2}; data=t(x)||y||z; print data; run; quit; data 1 2 1 2 3 1 3 5 1 4 4 1 5 8 2 6 6 2 7 4 2 8 2 2 9 2 2 How can I…
Math
  • 1,274
  • 3
  • 14
  • 32