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

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
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

He's on SAS UE - limited options available. 

View solution in original post

8 REPLIES 8
ballardw
Super User

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?

AG_Stats
Quartz | Level 8

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
Reeza
Super User

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. 

Tom
Super User Tom
Super User

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.

PGStats
Opal | Level 21

If your environment allows it, you could use

 

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

PG
AG_Stats
Quartz | Level 8

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
PGStats
Opal | Level 21

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
Reeza
Super User

He's on SAS UE - limited options available. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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