Help using Base SAS procedures

zip data ????????

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 110
Accepted Solution

zip data ????????

I need to zip big csv and then to attach to email in sas. any info please?


Accepted Solutions
Solution
‎02-22-2012 05:11 PM
Trusted Advisor
Posts: 1,301

zip data ????????

*if you use windows you may want to use the following options;

*options noxwait xsync;

x 'zip myzipfile.zip /file/to/zip.csv';

filename eml email to="somone@work" attach=("myzipfile.zip" ct="application/zip") subject="Attached File";

data _null_;

  file eml;

  put "Hi," / / "You zip file is attached" / "Thanks," / "Me";

run;

View solution in original post


All Replies
Solution
‎02-22-2012 05:11 PM
Trusted Advisor
Posts: 1,301

zip data ????????

*if you use windows you may want to use the following options;

*options noxwait xsync;

x 'zip myzipfile.zip /file/to/zip.csv';

filename eml email to="somone@work" attach=("myzipfile.zip" ct="application/zip") subject="Attached File";

data _null_;

  file eml;

  put "Hi," / / "You zip file is attached" / "Thanks," / "Me";

run;

Frequent Contributor
Posts: 110

zip data ????????

using EG in winds

Trusted Advisor
Posts: 1,301

zip data ????????

What EG connecting to is what matters with the code I posted.

Trusted Advisor
Posts: 2,116

zip data ????????

Actually, it does matter.  For Enterprise Guide use, the "x" command is disabled, by default.  If SASHARP can get the local admin to allow the x command, then FriedEgg's code will work.

You could than also put the x-command (alone) in a code node and then use the EGuide e-mail task to send it out.

Doc Muhlbaier

Duke

Frequent Contributor
Posts: 110

zip data ????????

Doc Muhlbaier

??put the x-command (alone) in a code node and then use the EGuide e-mail task to send it out??

can you elaborate more?

Trusted Advisor
Posts: 2,116

zip data ????????

you can select program --> new program to create a task that is code that you create.  That is where you could put the x-command.

However, if you just want to zip the file for e-mail purposes, the directions that FriedEgg provided are perfect.

Doc Muhlbaier

Duke

Trusted Advisor
Posts: 1,301

zip data ????????

Thanks Doc@Duke, I often forget about this default.

sassharp, you can check for this using:

proc options option=xcmd; run;

In your log you should see something to the effect of:

XCMD              The X Command is valid in this SAS session

This means you can run my example code.

When Doc@Duke says use the EGuide email task to send it out he means to do the following:

Lets say you have your SAS dataset.

You choose to use the EGuide task to export this dataset to CSV.  In this step save the results to your local computer as yourfile.csv

In EGuide in the process flow you now have that CSV file available.  Right-click on it and you will see a option like Send To -> E-mail Recipient as a Step in Project...

Select the option and the EGuide task window opens, there is a option here to 'Compress all files'  You will want to check this option and probably the additoonal option to rename the compressed file to something.

Now you can email your zipped file, code free.

Frequent Contributor
Posts: 110

zip data ????????

need to automate the process. already used EGuide email Right-click method.

thanks

Trusted Advisor
Posts: 2,116

zip data ????????

if you "e-mail recipient as a step in the project" (emphasis added), that will allow you to send the e-mail by scheduling the project, so it provides the automation piece.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 278 views
  • 6 likes
  • 3 in conversation