How to standardize the xlsx, excel etc. engines

Accepted Solution Solved
Reply
Contributor
Posts: 65
Accepted Solution

How to standardize the xlsx, excel etc. engines

Hello everyone,

 

Please anyone consider this small problem and reply a solution:

 

The following codes are running:

 

libname newlib xlsx '/folders/myfolders/matrix.xlsx';

proc print data= newlib.sheet1 noobs;/*Or use, proc print data= newlib.'Sheet1$'n; if required (depending on your SAS environment*/
run;
proc print data= newlib.sheet2 noobs;
run;

 

Both are running but in sheet1 I have no variable names / column headings. But newlib.sheet1 taking first row of my sheet as headings.

So, can I control these things (as we do same in Proc Import by using option getnames=yes/no) as in sheet1 I have no headings while in sheet2 I have.

 

If anyone want to change the engine xlsx (for example, to excel etc.) then he/she can, it does not matter for me.

 

Ankit

Regards,
AG_Stats

Accepted Solutions
Solution
‎04-16-2016 07:48 AM
Super User
Posts: 17,840

Re: How to standardize the xlsx, excel etc. engines

He's on SAS UE - limited options available. 

View solution in original post


All Replies
Super User
Posts: 10,500

Re: How to standardize the xlsx, excel etc. engines

What does your output look like when you use:

proc print data= newlib.sheet1 noobs label;

run;

 

And are you running under the University Edition?

Contributor
Posts: 65

Re: How to standardize the xlsx, excel etc. engines

I have tried the following codes:

 

libname newlib xlsx '/folders/myfolders/learning/matrix.xlsx';

proc print data= newlib.sheet1 noobs label;
run;

proc print data= newlib.sheet2 noobs label;
run;

 

And  got the following output (print):

(Print of sheet1 is taking values as my variable names)

And yes I am using UE of SAS Studio.

 

2016-04-15.png

Regards,
AG_Stats
Super User
Posts: 17,840

Re: How to standardize the xlsx, excel etc. engines

You pretty much can't. 

 

You our can create a named range in Excel to import data correctly, or convert to CSV. 

 

Excel ismt a good  way to store or transfer information. See many of @RW9 post on why this is true. 

Super User
Super User
Posts: 6,500

Re: How to standardize the xlsx, excel etc. engines

I have not seen anyway to pass the equivalent of GETNAMES=NO to the XLSX libname engine.

I suspect that you will have to use PROC IMPORT to convert that sheet to a dataset.

Respected Advisor
Posts: 4,651

Re: How to standardize the xlsx, excel etc. engines

[ Edited ]

If your environment allows it, you could use

 

libname newlib Excel '/folders/myfolders/matrix.xlsx' header=no;

PG
Contributor
Posts: 65

Re: How to standardize the xlsx, excel etc. engines

No, it is giving following errors:

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56
57 libname newlib Excel '/folders/myfolders/matrix.xlsx' header=no;
ERROR: The EXCEL engine cannot be found.
ERROR: Error in the LIBNAME statement.
58
59 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
71
Regards,
AG_Stats
Respected Advisor
Posts: 4,651

Re: How to standardize the xlsx, excel etc. engines

SAS Excel engine relies on Microsoft ACE software. It cannot work unless you have Microsoft Office installed on your machine. SAS xlsx engine doesn't need ACE to work.

PG
Solution
‎04-16-2016 07:48 AM
Super User
Posts: 17,840

Re: How to standardize the xlsx, excel etc. engines

He's on SAS UE - limited options available. 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 676 views
  • 2 likes
  • 5 in conversation