Import each of the worksheets in a matrix form into SAS

Reply
Frequent Contributor
Posts: 81

Import each of the worksheets in a matrix form into SAS

Hello!

I have an excel file (with 2 sheets), which rows and columns of that is equal (matrices format).  I’m looking for a code to import each of the worksheets in a matrix form into SAS format.

Any idea!


Thanks!

Super User
Posts: 9,676

Re: Import each of the worksheets in a matrix form into SAS

Check range=  option of proc import

Frequent Contributor
Posts: 81

Re: Import each of the worksheets in a matrix form into SAS

Thank you for your suggestion.

I tried the following, it worked.


libname a "C:\user\test.xls" getnames=no;

   data leg;

     set a."sheet1$"n;               

   run;

libname a clear;

But when i tried use the proc iml (for matrix operation), i am getting the following error.

ERROR: (execution) Matrix has not been set to a value.

My question is how can i import .xls file with matrix format into SAS environment.


Thank you again.


zana

Respected Advisor
Posts: 3,777

Re: Import each of the worksheets in a matrix form into SAS

It would be helpful to see the IML code that doesn't work.

Frequent Contributor
Posts: 81

Re: Import each of the worksheets in a matrix form into SAS

My matrix file is square (4*4), so i tried the following code:


Please see my array code below:


libname a "C:\user\test.xls" getnames=no;

   data leg;

     set a."sheet1$"n;              

   run;

libname a clear;



proc iml;

b=a*a;

run;



How can I call that as a matrix form?


Thanks in advance

zana

Ask a Question
Discussion stats
  • 4 replies
  • 268 views
  • 0 likes
  • 3 in conversation