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

Im trying to add a PROC EXPORT Step in my project however when i use the following code:

 

----------------------------------------------------------------------------------------------------

%let Export=\C:\sas temp\amahert\MAHER\EXPORT STEP\CLAIMS_TREND;

 

PROC EXPORT DATA=ODBCAM.Provider
OUTFILE= "&Export\CLAIMS_TREND_DATA2.xlsx" dbms=xlsx REPLACE;
;RUN;

----------------------------------------------------------------------------------------------------

the extracted file shows a corrupted error and then opens the file with no headers

 

however if i extracted the file in TAB, CSV, TXT there is no problem with the data

also if i extracted the file as a step in project or manual from Export Wizard also there is no problem with the file.

its been very annoying trying to solve this, Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Can you get PROC EXPORT to write the dataset to a different location?  If so then the issue might be with the file or folder you are trying to write into.

Can you get PROC EXPORT to write a different dataset properly?  For example try saving SASHELP.CLASS.  If so then there might be some strange characters in your dataset.  What is your setting for the ENCODING option?

 

When you say "Export Wizard" are you talking about an Enterprise Guide tool?  That will download the file and work on it using Enterprise Guide code instead of using SAS code to export the file.

 

What about just writing the data as a dataset using the XLSX engine instead of using PROC EXPORT?

libname out xlsx "&Export\CLAIMS_TREND_DATA2.xlsx";
data out.Provider;
  set ODBCAM.Provider
run;

Again if that has issues try writing a different dataset and to a different file.

View solution in original post

10 REPLIES 10
L5ive
Obsidian | Level 7
shows an error as follows
ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.
ERROR: Connection Failed. See log for details.

Kurt_Bremser
Super User

If a fairly current version creates a corrupt Excel file, this is a case for SAS technical support, as this might be a bug in something that's been production stage for quite some time.

Tom
Super User Tom
Super User

Do you really have that extra backslash in front of the drive letter in your filename? Why?

jebjur
SAS Employee

Perhaps it would be better for you to open a track with Technical Support. Do you get any errors in the log after running the code?

 

For example: Error creating XLSX file -> C:\C:\users\<userid>\export_test\CLAIMS_TREND_DATA2.xlsx . It is either not an Excel spreadsheet or it
is damaged. Error code=80001030
Requested Output File is Invalid
ERROR: Export unsuccessful. See SAS Log for details.

 

If so, the path you have listed on the %LET statement may be incorrect. Try removing the '\' before the C drive letter:

 

Instead of: %let Export=\C:\sas temp\amahert\MAHER\EXPORT STEP\CLAIMS_TREND;

 

Change to: %let Export=C:\sas temp\amahert\MAHER\EXPORT STEP\CLAIMS_TREND;

L5ive
Obsidian | Level 7
no sorry the backlash doesn't exist in the original Code. however the error still occur
Tom
Super User Tom
Super User

Can you get PROC EXPORT to write the dataset to a different location?  If so then the issue might be with the file or folder you are trying to write into.

Can you get PROC EXPORT to write a different dataset properly?  For example try saving SASHELP.CLASS.  If so then there might be some strange characters in your dataset.  What is your setting for the ENCODING option?

 

When you say "Export Wizard" are you talking about an Enterprise Guide tool?  That will download the file and work on it using Enterprise Guide code instead of using SAS code to export the file.

 

What about just writing the data as a dataset using the XLSX engine instead of using PROC EXPORT?

libname out xlsx "&Export\CLAIMS_TREND_DATA2.xlsx";
data out.Provider;
  set ODBCAM.Provider
run;

Again if that has issues try writing a different dataset and to a different file.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 2158 views
  • 1 like
  • 5 in conversation