BookmarkSubscribeRSS Feed
santosh_pat69
Quartz | Level 8

Hi All,

 

I am trying to zip a csv file using x command, we have around 10 reports generated using a SAS program and the x command is working for all the 9 reports but it is not working for one of the reports generated. I have cheked the permissions on the folder and the file, and the permissons on the .csv file and the folder is 777.

 

Kindly suggest what am i missing i m using the below code to zip the file once it is created using proc export.

 

x zip /shared/Santosh/annual/publisher_id/ALL_Business_&today.
        /shared/Santosh/annual/publisher_id/ALL_Business_&today..csv;

 

Regards

Santosh...

 

 

 

7 REPLIES 7
ballardw
Super User

When you use an X command you are asking the operating system to run a program. I suspect that if you have a compression program that it is named something other than Zip. You may also need to provide the path to the executeable depending on your configuration.

 

To test the first open a command prompt and type Zip and see what happens. If you get a message similar to 'zip' is not redognized as an internal or external command, operable program or batch file then you do not have a program named zip and should look for the name of any compression program you may have installed.

Kurt_Bremser
Super User

Since you did not post any error or other message, I guess you do not get one.

 

Use the following method to catch messages returned by system commands:

filename oscmd pipe "command you want to run 2>&1";

data _null_;
infile oscmd;
input;
put _infile_;
run;

The 2>&1 reroutes stderr (standard error) output to standard output, so you get it in your data step.

After running your command like this, any messages that are returned by the system will appear in the SAS log.

 

Once you have them, and they don't provide a clue to you, post them here.

Tom
Super User Tom
Super User

If you use a pipe instead of the X command then you can examine any error messages the operating system is trying to send you and that should help you to debug your problem.

 

data _null_;
  infile "zip /shared/Santosh/annual/publisher_id/ALL_Business_&today.
        /shared/Santosh/annual/publisher_id/ALL_Business_&today..csv"
  pipe;
  input;
  put _infile_;
run;
santosh_pat69
Quartz | Level 8

Hi Tom.

 

Thank you for your quick response,

 

I tried pipe to see what is going on, i got the below eror message:

zip warning: name not matched:

zip error: Nothing to do!

 

i checked the file exists at the location and name of the file is also same.

 

Could you help me on this?

 

Regards,

Santosh

 

Kurt_Bremser
Super User

Do a google search for

zip warning: name not matched:

and follow the links (the stackoverflow ones look quite promising to me), you might get a hint that fits your situation.

Reeza
Super User

Check your case. The operation may he CASE sensitive. 

santosh_pat69
Quartz | Level 8

Hi Reeza,

 

Thank you !!!

 

I have checked the Case as well, and both file names and the Case is matching.

Kindly suggest me on this.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 3224 views
  • 0 likes
  • 5 in conversation