BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ruther
Calcite | Level 5

bonjour,

n'étant pas un fin connaisseur de SAS/IML, j"aimerais savoir dans un premier temps quelle est la différence entre SAS/IML et SAS/IML studio.

Par ailleurs, je souhaiterais utiliser la fonction sample et un message d'erreur apparaît m'indiquant qu'elle n'est pas disponible dans ma version de SAS/IML STUDIO (3.4).

Existerait elle donc dans SAS/IML? (je dispose de la version 9.3 de sas?

merci pour vos retours

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Hello,

Please excuse me for not responding in French. I do not know the language well.

For a description of SAS/IML Studio, see the 2008 paper or the Introduction to the 2010 paper at         SAS/IML and SAS/IML Studio Papers and Presentations      Briefly,  SAS/IML is the product that you license. It is also the name of a matrix language. PROC IML implements the matrix languiage on the SAS server.  SAS/IML Studio is a development environment that enables SAS/IML programmers to develop SAS/IML programs. SAS/IML Studio runs on a Windows PC. It runs programs in IMLPlus, which is a language that includes SAS/IML syntax plus a Java-like syntax for creating dynamically linked graphics.

The SAMPLE function was introduced in SAS/IML 12.1 (See SAS/IML(R) 12.1 User's Guide).  For SAS/IML 9.3, you can use a function from the book Statistical Programming with SAS/IML Software. See the links in the first paragraph of the article   Sampling with replacement: Now easier than ever in the SAS/IML language - The DO Loop

View solution in original post

7 REPLIES 7
Rick_SAS
SAS Super FREQ

Hello,

Please excuse me for not responding in French. I do not know the language well.

For a description of SAS/IML Studio, see the 2008 paper or the Introduction to the 2010 paper at         SAS/IML and SAS/IML Studio Papers and Presentations      Briefly,  SAS/IML is the product that you license. It is also the name of a matrix language. PROC IML implements the matrix languiage on the SAS server.  SAS/IML Studio is a development environment that enables SAS/IML programmers to develop SAS/IML programs. SAS/IML Studio runs on a Windows PC. It runs programs in IMLPlus, which is a language that includes SAS/IML syntax plus a Java-like syntax for creating dynamically linked graphics.

The SAMPLE function was introduced in SAS/IML 12.1 (See SAS/IML(R) 12.1 User's Guide).  For SAS/IML 9.3, you can use a function from the book Statistical Programming with SAS/IML Software. See the links in the first paragraph of the article   Sampling with replacement: Now easier than ever in the SAS/IML language - The DO Loop

ruther
Calcite | Level 5

Merci Rick! so, i wiill try to speak in english.

First, because of you, i have perfectly understood what IML is. However, i´ve tryed to follow the steps described in your topic about the sampling with and without remplacement by using the sample´s function and it doesn't work ,while it should be possible with sas 9.3

For example, i have this message in the log:

598  proc IML;

NOTE: IML Ready

599  x=1:5;

600  call randseed(325);

601  s_1=sample(x);

ERROR: Invocation of unresolved module SAMPLE.

statement : ASSIGN at line 601 column 1

602  print s_1;

ERROR: Matrix s_1 has not been set to a value.

statement : PRINT at line 602 column 1

Rick_SAS
SAS Super FREQ

I should have sent you the direct link to the SAS/IML 9.3 module for sampling with replacement: Sampling with replacement in SAS

Your program will look like this:

proc iml;
/* Define module for random sampling with replacement and uniform probability.
  A is row vector with n elements and each sample contains k elements.
  The result is an nSamples x k matrix. Each row contains one sample. */
start SampleReplaceUni(A, nSamples, k);
  results = j(nSamples, k);         /* allocate result matrix */
  call randgen(results, "Uniform"); /* fill with random U(0,1) */
  n = ncol(A);                      /* number of elements */
  results = ceil(n*results);        /* convert to integers 1,2,...n */
  return(shape(A[results], nSamples)); /* reshape and return from A */
finish;

call randseed(1234);
/* Draw 5 elements with replacement from {1,2,...,8}; Repeat 10 times */
s = SampleReplaceUni(1:8, 10, 5);
print s;

ruther
Calcite | Level 5

MERCI BEAUCOUP!;)Smiley Happy

Rick_SAS
SAS Super FREQ

Je vous en prie. Bonne chance.

ruther
Calcite | Level 5

Hello Rick. I have a last question. I'm starting with sas and i have no experience  to do  programs. What would the program be without remplacement?Thanks

Rick_SAS
SAS Super FREQ

Your version of SAS is now almost 3 years old. There have been three releases of SAS/IML software since then. If you want the newer features, I encourage you to upgrade your version of SAS.

To gain experience with SAS/IML programming, I recommend the book Statistical Programming with SAS/IML Software.

I do not have a module that does sampling without replacement that works for SAS/IML 9.3. You can use the SURVEYSELECT procedure in SAS/STAT, as shown in this article: Sample without replacement in SAS - The DO Loop

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 2147 views
  • 5 likes
  • 2 in conversation