BookmarkSubscribeRSS Feed
awmk1
Calcite | Level 5

I am doing a permutation test and i have gone as far as getting difference of the means using proc ttest. My next step is proc iml and thats where am stuck.

i keep getting the following error message on the log:

 

106         ods output off;

107 ods exclude all;
108 *borrowed code from internet ... randomizes observations and creates a matrix ... one row per randomization ;
109 proc iml;
NOTE: IML Ready
110 use pocketcash;
110 ! * change data set name here to match your data set name above;
111 read all var{school cash} into x;
WARNING: Variable cash excluded because of type mismatch with x.
111 ! *change varibale names here ... make sure it is class then var ... in that order.;
112 p = t(ranperm(x[,2],1000));
ERROR: (execution) Invalid subscript or subscript out of range.
 
operation : [ at line 112 column 17
operands : x, , *LIT1002
x 30 rows 1 col (character, size 😎
 
*LIT1002 1 row 1 col (numeric)

 

What am i doing wrong?

thanks

 

4 REPLIES 4
Reeza
Super User

Fix your errors in the order they come, since errors cascade. 

 

WARNING: Variable cash excluded because of type mismatch with x.

 

Fix this first, likely the variable 'cash' is character when it should be numeric. 

 

awmk1
Calcite | Level 5

No "cash" is numeric. and school is a character variable.

 

Reeza
Super User

Post the actual code you're referencing. Make sure it runs with their data and then switch to your data. 

awmk1
Calcite | Level 5

 

*borrowed code from internet ... randomizes observations and creates a matrix ... one row per randomization ;
 proc iml;                                                                                                                                                                                                                   
 use pocketcash;                        * change data set name here to match your data set name above;                                                                                                                             
 read all var{school  cash} into x;      *change varibale names here ... make sure it is class then var ... in that order.;                                                                                                 
 p = t(ranperm(X[,2],1000));            *Note that the "1000" here is the number of permutations. ;                                                                                                                                   
 paf = x[,1]||p;                                                                                                                                                                                                             
 create newds from paf;                                                                                                                                                                                                      
 append from paf;                                                                                                                                                                                                            
 quit;

 

Not sure why its posting with the breaks but i hope it makes sence to you,
 
                            

 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1072 views
  • 0 likes
  • 2 in conversation