BookmarkSubscribeRSS Feed
renjithr
Quartz | Level 8

Hi All,

 

I am trying to create an Excel file ( .xlsx) file programattically in SAS EG. I tried using PROC IMPORT with DBMS=XLSX , even though I did not get any error the file that got created is not able to open. I am wondering if I am using the right options to achieve this.

 

 

Please advise.

 

Thank you!

8 REPLIES 8
SASKiwi
PROC Star

Please supply the code you are using. You need to use PROC EXPORT, not IMPORT to create an Excel workbook, and you need to have a server folder location where you have write access. 

renjithr
Quartz | Level 8

Sorry I mean PROC EXPORT.

 

Here is my code:

%let data_path=%str(/apps/sas/datasets/dataf/);

PROC EXPORT DATA= WORK.TEMP01
OUTFILE= "&data_path./email.xlsx"
DBMS=xlsx REPLACE;
SHEET="TEST";
RUN;

ballardw
Super User

There are two possible issues I see. First is do you have write permission to that folder on the SERVER as that is likely the relative path location.

Second is the path usually works best if you describe everything from a mount point as the location SAS is actually running in may not have that relative path subordinate.

renjithr
Quartz | Level 8

I do have write permission because I was able to write a .CSV file to the same location.

Reeza
Super User

What does your log say?

Please post log and version of SAS, not EG version. 

renjithr
Quartz | Level 8

Reeza/Casey,

 

Please see my log notes:

 

NOTE: The export data set has 94 observations and 24 variables.
NOTE: "/apps/sas/datasets/data7/email.xlsx" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):

CaseySmith
SAS Employee

Thanks @renjithr. That confirms the .xlsx file was created.  So, back to my previous question...

 

When you say, "the file that got created is not able to open", do you mean the xlsx file cannot be opened in Excel?  Or, the xlsx file is created, but not added to the EG project?  (If the second case, EG does not automatically add files exported via code to the EG project.)


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

CaseySmith
SAS Employee

When you say, "the file that got created is not able to open", do you mean the xlsx file is created, but cannot be opened in Excel?  Or, the xlsx file is created, but not added to the EG project?  If the second case, EG does not automatically add files exported via code to the EG project.

 

As suggested by others, looking at the log to determine if the xlsx was actually created is the first step.  For example, do you see notes similar to the ones below in your log?

 

NOTE: The export data set has 19 observations and 5 variables.

NOTE: "\\d79879\c$\users\cassmi\desktop\\email.xlsx" file was successfully created.

 


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

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!

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