BookmarkSubscribeRSS Feed
SWEETSAS
Obsidian | Level 7

The following program works perfectly well; it gives me what I want for just one sample. But I want multiple samples. However, in data step, I can easily create sample ID  using a do "rep=1 to m" statement and analyze by that sample ID. By sample ID, I mean replicate. How do I generate the sample ID (replicate) in IML so that I can analyze my data by sample ID?

 

Thanks in advance:

 

proc iml;
call randseed(1);

sigma = 0.5; /* scale parameter */
E = j(1000, 1);
call randgen(E, "Exponential", sigma); /* E ~ Expo(0.5) */
G = j(1000, 1);
call randgen(G, "Gamma", 2, sigma); /* G ~ Gamma(2, 0.5) */

 

create test var {E G}; append; close;

quit;

2 REPLIES 2
SWEETSAS
Obsidian | Level 7

Great! Thanks everyone. I see it's in page 69, section 4.5.2 (Reshaping Matrices) of "Simulating Data with SAS"

 

Best,

 

J

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 2 replies
  • 955 views
  • 0 likes
  • 2 in conversation