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

Its quite clear in the log, the close() is before the publish, thereforeyou get the wanring, just swap them over:

data _null_;
  set loclib.xyz end=last;
  if _n_=1 then call execute('ods package(newzip) open');
  call execute(cats('ods package(newzip) add file="<path>/',pgm_name,'";'));
  if last then do;
call execute('ods package(newzip) publish properties(archive_name="want.zip" archive_path="c:/want");');
call execute('ods package(newzip) close;');
end; 
run;
Spintu
Quartz | Level 8

thank you very much. finally the issues got resolved. all files are zipped successfully.

it's great experience for me.

However in log I am  getting  below warning messages.

 

WARNING: Package will not be published, please specify a publish type.

 

Could you please confirm me?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Specify a publish type:

data _null_;
  set loclib.xyz end=last;
  if _n_=1 then call execute('ods package(newzip) open');
  call execute(cats('ods package(newzip) add file="<path>/',pgm_name,'";'));
  if last then do;
call execute('ods package(newzip) publish archive properties(archive_name="want.zip" archive_path="c:/want");');
call execute('ods package(newzip) close;');
end; 
run;
Spintu
Quartz | Level 8

Thank you . It is working fine Now..

Spintu
Quartz | Level 8
I can say this is the complete code we can achieve dynamically to zip the files.
Tom
Super User Tom
Super User

What version of SAS are you running? Why not just use the ZIP filename engine instead of messing with ODS Package?

Spintu
Quartz | Level 8

I am using SAS EG 7.1.

Can you share me sample how to use?

 

Tom
Super User Tom
Super User

That is the version of Enterprise Guide (the Window GUI interface you using the generate/run SAS code).  What version of SAS is Enterprise Guide using to run the code?

 

https://blogs.sas.com/content/sasdummy/2014/01/29/using-filename-zip/

 

Spintu
Quartz | Level 8

Hi There,

 

I am just wondering now the same piece of code it is working for some other program. However if I am implementing in current program getting error messages. Appreciate your help.

 

ERROR: ARCHIVE transport engine encountered errors while publishing the package.

ERROR: Physical file does not exist, /n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2018-10.xlm.

 

I could see files are picking but it is not executing while zipping.

1                                                          The SAS System

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program (2)';
4          %LET _CLIENTPROJECTPATH='';
5          %LET _CLIENTPROJECTNAME='';
6          %LET _SASPROGRAMFILE=;
7          
8          ODS _ALL_ CLOSE;
9          OPTIONS DEV=ACTIVEX;
10         GOPTIONS XPIXELS=0 YPIXELS=0;
11         FILENAME EGSR TEMP;
12         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
13             STYLE=HtmlBlue
14             STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome/x86/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
15             NOGTITLE
16             NOGFOOTNOTE
17             GPATH=&sasworklocation
SYMBOLGEN:  Macro variable SASWORKLOCATION resolves to 
            "/c01/saswork/SAS_work8F5A0001CA03_lnbrsasp25/SAS_work79710001CA03_lnbrsasp25/"
18             ENCODING=UTF8
19             options(rolap="on")
20         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
21         
22         GOPTIONS ACCESSIBLE;
23         filename dmyfile "loclib.&rptname-HC3-Org-Recred-Sched-Rpt_&FILEDATE..zip";
SYMBOLGEN:  Macro variable RPTNAME resolves to PFPW0317_ND
SYMBOLGEN:  Macro variable FILEDATE resolves to 20181212
24         data _null_;
25         	if (fexist('dmyfile')) then
26         	 rc=fdelete('dmyfile');
27         run;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

28         filename dmyfile clear;
NOTE: Fileref DMYFILE has been deassigned.
29         
30         /* Open Package */
31         
32          data _null_;
SYMBOLGEN:  Macro variable LOB resolves to ND
33           set loclib.PFPW0317_filenames_&lob. end=last;
34           if _n_=1 then call execute('ods package(ZipFile) open;');
35          call execute(cats('ods package(ZipFile) add file="&rptpath.',pgm_name,'";'));
36         
37         if last then do;
38             call execute('ods package(ZipFile) publish archive
38       ! properties(archive_name="&rptname-HC3-Org-Recred-Sched-Rpt_&FILEDATE..zip" archive_path="&rptpath.");');
39             call execute('ods package(ZipFile) close;');
40         end;
41         run;

SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
2                                                          The SAS System

SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
SYMBOLGEN:  Macro variable RPTNAME resolves to PFPW0317_ND
SYMBOLGEN:  Macro variable FILEDATE resolves to 20181212
SYMBOLGEN:  Macro variable RPTPATH resolves to &path./fileout/hc3/
SYMBOLGEN:  Macro variable PATH resolves to /n04/data/provinfo/penvtest
NOTE: There were 24 observations read from the data set LOCLIB.PFPW0317_FILENAMES_ND.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

NOTE: CALL EXECUTE generated line.
1         + ods package(ZipFile) open;
3                                                          The SAS System

2         + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2018-10.xlm";
3         + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2018-11.xlm";
4         + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2018-12.xlm";
5         + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2019-02.xlm";
6         + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2019-03.xlm";
7         + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2019-04.xlm";
8         + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2019-05.xlm";
9         + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2019-09.xlm";
10        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2019-10.xlm";
11        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2019-11.xlm";
12        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2019-12.xlm";
13        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-01.xlm";
14        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-02.xlm";
15        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-03.xlm";
16        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-04.xlm";
17        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-05.xlm";
18        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-06.xlm";
19        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-07.xlm";
20        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-09.xlm";
21        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-10.xlm";
22        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2020-12.xlm";
23        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2021-01.xlm";
24        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2021-02.xlm";
25        + ods package(ZipFile) add file="/n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2021-07.xlm";
26        + ods package(ZipFile) publish archive properties(archive_name="PFPW0317_ND-HC3-Org-Recred-Sched-Rpt_20181212.zip" 
archive_path="/n04/data/provinfo/penvtest/fileout/hc3/");
ERROR: ARCHIVE transport engine encountered errors while publishing the package.

ERROR: Physical file does not exist, /n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2018-10.xlm.
27        + ods package(ZipFile) close;
42         
43         GOPTIONS NOACCESSIBLE;
44         %LET _CLIENTTASKLABEL=;
45         %LET _CLIENTPROJECTPATH=;
46         %LET _CLIENTPROJECTNAME=;
47         %LET _SASPROGRAMFILE=;
48         
49         ;*';*";*/;quit;run;
50         ODS _ALL_ CLOSE;
51         
52         
53         QUIT; RUN;
54         
RW9
Diamond | Level 26 RW9
Diamond | Level 26

 

ERROR: Physical file does not exist, /n04/data/provinfo/penvtest/fileout/hc3/PFPW0317_ND-org-recred-mail-view-2018-10.xlm.  

 I am not sure what further input I can give, the file name PFPW0317_ND-org-recred-mail-view-2018-10.xlm does not exist in that folder or is inaccessible.

 

Also, why are you using Excel macro enabled file format?  First off XLM is the old out of support binary file format from decades ago and shouldn't be being used at all anymore.  Second why a macro enable workbook, that is dangerous.

I suspect you have a typo or something, maybe you meant XML which would make sense.  Or maybe the word recred is mispelt, from recorded?

Spintu
Quartz | Level 8

These are all the legacy programs. If I changed to .xlsx I could not open the files in the directory.

No where else I have mentioned .xlm I checked it. I checked the file name it looks good to me. The same filename also pulling the information in SAS datasets. Don't know what is the cause.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

"If I changed to .xlsx I could not open the files in the directory" - makes no sense?

 

As to not being able to find that file, there is nothing we can do, you need to investigate with your IT group.  SAS is telling you that file does not exist, or it does not have access to it.  There is some problem with that file, maybe its empty, invalid, open by another process etc.

Kurt_Bremser
Super User

You DO NOT change just the filename extension, you change the filename TYPE during creation. SAS provides the proper tools for creating the (slightly less execrable) modern Excel file formats.

.xlsx can be opened with any Excel version starting with Excel 2010.

 

And if SAS tells you a file is not there, it's not there, period. Believe several decades of SAS experience talking here.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 27 replies
  • 3329 views
  • 3 likes
  • 4 in conversation