Help using Base SAS procedures

automated job

Accepted Solution Solved
Reply
Super Contributor
Super Contributor
Posts: 440
Accepted Solution

automated job

Hi ,

is it possible to create a batch in SAS that picks up a file from a  particular UNIX location and emails  it to myself for example?

 

I dont have certain dates when that file will be in UNIX

 

pls advise

Thanks


Accepted Solutions
Solution
‎02-11-2016 03:23 PM
Super User
Posts: 17,960

Re: automated job

Use the Fexist or FileExist functions.

https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000210912.htm

The example is pretty much what you want, except you want more stuff to happen in the IF/THEN sections. You may have to use different parts from different questions but the solutions are on here.

View solution in original post


All Replies
Super User
Posts: 17,960

Re: automated job

Yes, it's possible. You'll have to schedule the script to run and check if the file exists, if it exists then do A, otherwise stop. There are code samples on here if you search.
Super User
Posts: 3,115

Re: automated job

Yes. Assuming that SAS is running on the Unix server and that it is configured to work with an email server.

 

Why do you want to use email? What happens if the file is too large to send as an email attachment? Most email systems have restrictions on this.

 

Also there are schedulers that can check for the existence of a file and then run a batch job. 

Super Contributor
Super Contributor
Posts: 440

Re: automated job

thanks guys,

I usually pick up the file from our server manually and load it to another server which is not owned by us but now the guys asked me  if i can  pick it up  and email it to them directly instead of loading it to their server.

Can you please point where on here i can get the samples  of those scripts or even the scheduler that check for existence?

 

thanks,

Super User
Posts: 17,960

Re: automated job

Does it have to be a SAS script, there are a lot more Unix scripts out there I would imagine, and it's probably more efficient.
Super Contributor
Super Contributor
Posts: 440

Re: automated job

i dont know how to  write scripts in UNIX

Super User
Posts: 3,115

Re: automated job

Here is a link that has some code example for sending emails with attachments:

 

http://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/viewer.htm#p1hl3t66coao7bn18v...

 

You should talk to your SAS administrator to confirm your site's email settings if any.

Super Contributor
Super Contributor
Posts: 440

Re: automated job

thanks SaSKiwi,

i did try one of the codes  from the link  you sent me and looks like my SAS is not set up to talk to SMTP yet.

 

Can you also point to some codes that check to see if a  file exists in  a particular server  and then picks it up before sending it via email?

Solution
‎02-11-2016 03:23 PM
Super User
Posts: 17,960

Re: automated job

Use the Fexist or FileExist functions.

https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000210912.htm

The example is pretty much what you want, except you want more stuff to happen in the IF/THEN sections. You may have to use different parts from different questions but the solutions are on here.
🔒 This topic is solved and locked.

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

Discussion stats
  • 8 replies
  • 464 views
  • 3 likes
  • 3 in conversation