06-14-2016 05:02 PM
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.
06-14-2016 06:26 PM
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.
06-14-2016 06:34 PM - edited 06-14-2016 06:35 PM
Sorry I mean PROC EXPORT.
Here is my code:
PROC EXPORT DATA= WORK.TEMP01
06-14-2016 06:53 PM
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.
06-15-2016 12:04 PM
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):
06-15-2016 04:59 PM
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.)
06-15-2016 10:43 AM
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.