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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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