How to use sas to download,extract and send email

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

How to use sas to download,extract and send email

Hi,all!

        I have a small project , how can I use SAS to  download a gz file from website:http://ftp.sas.com/techsup/download/hotfix/HF2/DataFlux_Patches.html, then extract it and email it to 5 friends automatically.


3 step:(1)download 16908-aix64.gz

             (2)using rar command lines to extract the file ,and read  the contents of README.fix16908 into SAS

             (3)send  the README contents to 5 friends' email.


Thank you all.


Accepted Solutions
Solution
‎05-07-2014 12:22 AM
Super Contributor
Posts: 644

Re: How to use sas to download,extract and send email

You can send email from within SAS using the email filename option, see

SAS(R) 9.4 Companion for UNIX Environments, Third Edition (I think the process is the same for Windows environments)

There has been some suggestion in recent posts that sending email from SAS might be blocked by administrators, so it would be wise to test that you can successfully send test emails from SAS to the teachers before investing energy on the rest of your solution.   An alternative is to locate a file folder that both you and the teachers can access on your server, and post the results there.

If you have the syntax for using rar to unzip your files you can call rar from an X command in SAS

There have been recent posts about downloading data from the internet - I can't help.

HOWEVER, I would suggest finding out where that data comes from within your systems and tapping into that data directly or worst case asking for a feed as a text file when the web pages are updated.

Richard

View solution in original post


All Replies
Regular Contributor
Posts: 217

Re: How to use sas to download,extract and send email

Hi WilsonSAS,

I am not familiar with "rar commands" so I am monitoring your post to educate myself.  I hope to see how your problem is solved.  If this is a small project, why not manually send your 5 friends the link and then tell them to download the file?  Or, why not manually download and unzip and save the pertinent information yourself and email it from there?  I am imagining that the SAS code needed to do the work that you want will take more time to write than the time it will take for you to manually do the work.

Occasional Contributor
Posts: 7

Re: How to use sas to download,extract and send email

Hi jwillis!

           Thank you for you monitoring, all of these work i can do manually,the prolbem is  i must do it everyday ,sometimes i am so busy and these work are so timeconsuming. The example above is just a example,you can read the detailed information from my reply to  RichardinOz

Super User
Posts: 6,927

Re: How to use sas to download,extract and send email

Use wget or ftp to download the files, and any reasonable email client to send the mail. Do it in a shell script and let that run via cron. NO reason to do it in SAS. Screws need a screwdriver and not a hammer.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 7

Re: How to use sas to download,extract and send email

Hi KurtBremser

         Thanks a lot.

Super User
Posts: 6,927

Re: How to use sas to download,extract and send email

wget for windows can be downlaoded here:

Wget for Windows

If you want to use windows as a computing platform (and not just as an app-starter), then learn how to do scripting there. NOW. IMMMEDIATELY. DON'T ASK TWICE. I mean it. There's also a scheduler included in windows: Windows Task Scheduler - Wikipedia, the free encyclopedia

Naturally, being a UNIX guy, I could only give you advice for that group of platforms (which, IMHO, are more powerful as a server platform than windows will ever be, by a mile).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super Contributor
Posts: 644

Re: How to use sas to download,extract and send email

  1. You can do those 3 steps without involving SAS.  What is the point?  Unless you want to automate a process somehow.
  2. You can probably find the contents of the readme file in SAS Documentation, without having to download the hotfix.
  3. Please assure us you are not trying to find a way to send spam using SAS

Richard

Occasional Contributor
Posts: 7

Re: How to use sas to download,extract and send email

Hi RichardinOz

extract , and then i need to sum and count the data ,fianlly i send the result to 10 teachers.

         3.As i say above ,I just do a small project to save time,please help me ,thank you so much.

Solution
‎05-07-2014 12:22 AM
Super Contributor
Posts: 644

Re: How to use sas to download,extract and send email

You can send email from within SAS using the email filename option, see

SAS(R) 9.4 Companion for UNIX Environments, Third Edition (I think the process is the same for Windows environments)

There has been some suggestion in recent posts that sending email from SAS might be blocked by administrators, so it would be wise to test that you can successfully send test emails from SAS to the teachers before investing energy on the rest of your solution.   An alternative is to locate a file folder that both you and the teachers can access on your server, and post the results there.

If you have the syntax for using rar to unzip your files you can call rar from an X command in SAS

There have been recent posts about downloading data from the internet - I can't help.

HOWEVER, I would suggest finding out where that data comes from within your systems and tapping into that data directly or worst case asking for a feed as a text file when the web pages are updated.

Richard

☑ This topic is SOLVED.

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

Discussion stats
  • 8 replies
  • 621 views
  • 4 likes
  • 4 in conversation