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
3 answers

How to not change the length of preexisting character variables when creating a new dataset in proc-iml?

I have a dataset which I manipulate in proc-iml and then create a new dataset reading some of the manipulated values in. When I read character values in, their length is changed from 7 to 9. This doesn't really create a problem, except for the minor…
Leksa99
  • 43
  • 4
0
votes
1 answer

SAS: create covariance matrix with variables

I am working on a project in which we have to do some simulations. I am now at the point I want to use the RandNormal function, to generate multivariate normal data given a vector of means and a covariance matrix. For the covariance matrix, we have…
Katie
  • 131
  • 4
0
votes
0 answers

Is there an IML equivalent to SQL count?

In the following example that produces a frequency based on a variable proc iml; call randseed(1); Y = sample(2014:2020, 3000); M = sample(1:12, 3000); D = sample(1:31, 3000); create Date var {Y M D}; append; run; data Date; set Date; format M z2.…
RavenR
  • 25
  • 5
0
votes
1 answer

SAS: what does J(x, y, z) mean

I'm currently working on a SAS project and I stumbled upon a line, which I don't understand. N = 1000 p = 0.05 PD = J(N, 1, p) Is PD in this situation just a vector or what does it exactly do? What does the J do? Thanks for helping!
0
votes
1 answer

Reshaping a SAS Table not using IML

I am wondering if it is possible to reshape the following have table in SAS not using SAS/IML to produce the want table. Have: +--------+------+------+------+ | NAME | var1 | var2 | var3 | +--------+------+------+------+ | Q1_ID1 | 1 | 2 | …
Kermit
  • 3,112
  • 2
  • 10
  • 34
0
votes
0 answers

Translate SAS code to Python of KL-divergence plot

How does the SAS code shown below look when translated into python? /* Plot the K-L div versus lambda for a sequence of Poisson(lambda) models */ lambda = do(4, 16, 0.1); KL = j(1, ncol(lambda), .); do i = 1 to ncol(lambda); poisPDF =…
0
votes
1 answer

Force append in SAS to save missing data

I am trying to save a vector named ez product of some matrix calculations based on a group variable named ID_bloque. For each ID_bloque value my code computes a vector called ez and append it in a matrix with the same name. However, if zk is a…
0
votes
1 answer

Can SAS IML Studio find a local copy of R?

I use a SAS Enterprise Guide (7.12) that accesses to a data on a server, and a local installation of "R Open". I am trying to run R codes using SAS/IML Studio as I have the impression that this can handle the local installation of R (which proc iml…
0
votes
2 answers

Using R code to simulate data iteratively in Proc IML and then analyze in SAS procedure, a faster way?

The following codes are what I thought of, it is kind of slow, any suggestions? Thank you! The details are that first create a dataset in proc iml using R code, then transport that into regular SAS proc mixed statement to analyze it, then use proc…
Ben Z
  • 105
  • 6
0
votes
1 answer

SAS macro works with one variable but not another. Cluster 2-ols macro Error: (execution) invalid argument

Here is my macro: %MACRO clus2OLS(yvar, xvars, cluster1, cluster2, dset=); /* do interesection cluster*/ proc surveyreg data=&dset; cluster &cluster1 &cluster2; model &yvar= &xvars / covb; ods output CovB = CovI; quit; /* Do first…
Sydnee
  • 23
  • 4
0
votes
1 answer

A bug in the code - call quad

I am running the code below. However, what I got is the following error: matrix z has not been set to a value I tried to reset the "call quad(z, "fun", ylow || yhigh) peak= mid" by "call quad(z, "fun", ylow || yhigh, peak= mid)", but still got the…
Alberto Alvarez
  • 805
  • 3
  • 11
  • 20
0
votes
0 answers

Can I use a Proc step within another proc step?

I am writing an nlmixed procedure, and for the likelihood function, I want to use values generated with the iml procedure. So I am wondering if there is a way of using proc iml inside a proc nlmixed. proc nlmixed data = xxx; parms b0=0 b1=0; mu…
Paul
  • 1
0
votes
1 answer

How to perform same SAS procedure over multiple datasets

I put together a proc IML code that allows to extracts data from a specific data set - stored in the work directory - and performs a simple equation. Results are then stored in a new data set. proc iml ; use B1; read all var _ALL_ into B1; close…
user3570605
  • 593
  • 1
  • 4
  • 7
0
votes
1 answer

Convert matrix to 3-column table in SAS

I have a trouble in converting a matrix into three columns by using SAS. Here is a reference which use Excel to do that, you can see Convert matrix to 3-column table ('reverse pivot', 'unpivot', 'flatten', 'normalize') I have been google and found…
user131605
  • 117
  • 4
0
votes
1 answer

How do I find an average of values in dataset2 for each individual contained in dataset1, who have unique start and end dates?

I am looking to find the average of valueZ for each individual based on their unique start and end date. Exposure X has numerous values for each day, for each location, as such (There are actually 23 locations with over 300 values & dates per…
Danielle
  • 13
  • 5