Desktop productivity for business analysts and programmers

How to create an excel file using SAS EG on server?

Reply
Frequent Contributor
Posts: 122

How to create an excel file using SAS EG on server?

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!

Super User
Posts: 3,237

Re: How to create an excel file using SAS EG on server?

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. 

Frequent Contributor
Posts: 122

Re: How to create an excel file using SAS EG on server?

[ Edited ]

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;

Super User
Posts: 11,134

Re: How to create an excel file using SAS EG on server?

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.

Frequent Contributor
Posts: 122

Re: How to create an excel file using SAS EG on server?

[ Edited ]

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

Super User
Posts: 19,167

Re: How to create an excel file using SAS EG on server?

What does your log say?

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

Frequent Contributor
Posts: 122

Re: How to create an excel file using SAS EG on server?

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):

SAS Super FREQ
Posts: 306

Re: How to create an excel file using SAS EG on server?

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.)

SAS Super FREQ
Posts: 306

Re: How to create an excel file using SAS EG on server?

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.

 

Ask a Question
Discussion stats
  • 8 replies
  • 499 views
  • 0 likes
  • 5 in conversation