I'm having an issue with PROC EXPORT where my Excel file isn't being updated with new data. Even though I'm using the REPLACE option, the output file remains in its previous version. Here's my code:
proc export
data=ESPORTA.STOCK_RU
outfile='/sas/SRSK0/prod/Projects/SASAppCRM/14298/Stock_RU.xlsx'
dbms=xlsx
replace
label
;
sheet="Stock_RU";
run;
I've confirmed that:
The program seems to run successfully, but when I check the output file, it contains old data from a previous execution.
Has anyone encountered a similar issue? Could there be a file locking problem, caching issue, or permissions constraint I'm not aware of?
Any suggestions would be greatly appreciated!
I think maybe there could be an issue with the file name.
NOTE: "/sas/SRSK0/prod/Projects/SASAppCRM/14298/Stock_RU.xlsx" file was successfully created.
Be sure that you are opening the file from the NOTE: Exact spelling including upper and lower case.
I could also be that you are not actually using the input data you think you are.
data=ESPORTA.STOCK_RU
Are you sure that ESPORTA.STOCK_RU is what you think it is. But since you say the " file timestamp doesn't change, " I expect there is spelling error.
Show us the log. We need the entire log for PROC EXPORT, not just any potential error messages.
1 The SAS System 11:09 Wednesday, May 14, 2025 1 ;*';*";*/;quit;run; 2 OPTIONS PAGENO=MIN; 3 %LET _CLIENTTASKLABEL='STOCK_RU_NEW'; 4 %LET _CLIENTPROCESSFLOWNAME='NEW_Stock_RU Rettifiche_RU'; 5 %LET _CLIENTPROJECTPATH='Z:\Users\drondine\OneDrive - Capgemini\Documents\Analisi Crediti\Analisi_Credito_CONSO.egp'; 6 %LET _CLIENTPROJECTPATHHOST='SCCTXSEP0649'; 7 %LET _CLIENTPROJECTNAME='Analisi_Credito_CONSO.egp'; 8 %LET _SASPROGRAMFILE=''; 9 %LET _SASPROGRAMFILEHOST=''; 10 %LET DATA_PERIO = 31Dec2024; 11 %LET DATA_PERIO_label = 31 dicembre 2024; 12 %LET COL_INI_STOCK_RU = B; 13 %LET COL_FIN_STOCK_RU = CF; 14 %LET riga_ini_esp_lorde = 20; 15 %LET riga_fin_esp_lorde = 38; 16 %LET RIGA_INI_RETTIFICHE = 39; 17 %LET RIGA_FIN_RETTIFICHE = 57; 18 19 ODS _ALL_ CLOSE; 20 OPTIONS DEV=SVG; 21 GOPTIONS XPIXELS=0 YPIXELS=0; 22 %macro HTML5AccessibleGraphSupported; 23 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) >= 0 %then ACCESSIBLE_GRAPH; 24 %mend; 25 FILENAME EGHTML TEMP; 26 ODS HTML5(ID=EGHTML) FILE=EGHTML 27 OPTIONS(BITMAP_MODE='INLINE') 28 %HTML5AccessibleGraphSupported 29 ENCODING='utf-8' 30 STYLE=HTMLBlue 31 NOGTITLE 32 NOGFOOTNOTE 33 GPATH=&sasworklocation 34 ; NOTE: Writing HTML5(EGHTML) Body file: EGHTML 35 36 proc export 37 data=ESPORTA.STOCK_RU 38 outfile='/sas/SRSK0/prod/Projects/SASAppCRM/14298/Stock_RU.xlsx' 39 dbms=xlsx 40 replace 41 label 42 ; 43 sheet="Stock_RU"; 44 run; NOTE: The export data set has 82 observations and 36 variables. NOTE: "/sas/SRSK0/prod/Projects/SASAppCRM/14298/Stock_RU.xlsx" file was successfully created. NOTE: PROCEDURE EXPORT used (Total process time): real time 0.02 seconds user cpu time 0.01 seconds system cpu time 0.00 seconds memory 2997.21k OS Memory 40764.00k Timestamp 14/05/2025 02:30:59 p. Step Count 29 Switch Count 0 Page Faults 1 Page Reclaims 688 2 The SAS System 11:09 Wednesday, May 14, 2025 Page Swaps 0 Voluntary Context Switches 7 Involuntary Context Switches 28 Block Input Operations 1176 Block Output Operations 40 45 46 %LET _CLIENTTASKLABEL=; 47 %LET _CLIENTPROCESSFLOWNAME=; 48 %LET _CLIENTPROJECTPATH=; 49 %LET _CLIENTPROJECTPATHHOST=; 50 %LET _CLIENTPROJECTNAME=; 51 %LET _SASPROGRAMFILE=; 52 %LET _SASPROGRAMFILEHOST=; 53 54 ;*';*";*/;quit;run; 55 ODS _ALL_ CLOSE; 56 57 58 QUIT; RUN; 59
The log shows:
NOTE: The export data set has 82 observations and 36 variables.
NOTE: "/sas/SRSK0/prod/Projects/SASAppCRM/14298/Stock_RU.xlsx" file was successfully created.
But when I check the Excel file, it still contains old data from previous executions. The file timestamp doesn't change, and none of my latest data modifications appear in the output file.
I think maybe there could be an issue with the file name.
NOTE: "/sas/SRSK0/prod/Projects/SASAppCRM/14298/Stock_RU.xlsx" file was successfully created.
Be sure that you are opening the file from the NOTE: Exact spelling including upper and lower case.
I could also be that you are not actually using the input data you think you are.
data=ESPORTA.STOCK_RU
Are you sure that ESPORTA.STOCK_RU is what you think it is. But since you say the " file timestamp doesn't change, " I expect there is spelling error.
Since the Excel file resides on a UNIX system, how do you check it?
Also be aware that
Stock_RU.xlsx
and
Stock_Ru.xlsx
will be two different files existing next to each other on UNIX. And a Windows-based client tool can only access one of them, as such a situation is impossible there.
Hi,
Thanks for sharing the code and listing what you have tried.
I know you said no error messages appear in the log, but please also post the log as there might be other clues in it.
Does the modified date of the output file match the time you ran the proc export?
Thanks & kind regards,
Amir.
Edit: Grammar.
Hi,
Also, try using a different output file name and see if it appears in the same file location. If it doesn't then there might be a mix up with the location you're looking at.
Thanks & kind regards,
Amir.
Edit: Typo.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.