Can you launch a SAS program from an Access macro or VB code?

If it can be done, what is the syntax?  

Thanks!
c9k9hAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bradanelsonCommented:
Would this article help at all?  It looks like an example using VB Script.

http://www.sascommunity.org/wiki/Run_SAS_programs_from_a_scheduled_task_on_windows
0
jefftwilleyCommented:
You can give FollowHyperlink a try, otherwise you will find the shell command nested DEEP inside Brad's link would work if you construct your starting parameters correctly.

followhyperlink will work to launch most any file type that has an associated file type on your machine.

Worth a try

FollowHyperlink "path and file name with extension here"

J
0
c9k9hAuthor Commented:
Hi Jeff . . . you're still out there!  Haven't seen your name in awhile.

This is very cool!  It does open the SAS program.  This may be asking to much - but can it execute it?  Or perhaps I need to put the SAS program in a batch job and then run the batch job from Access.  Hmmm .....   Any suggestions?
Thanks,
K
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

jefftwilleyCommented:
Hi Karen,
I have lots of ideas! If you want to run a batch job with it, consider a few things. You won't be using FollowHyperlink though.

1) The environment you're in when running the app/batch. If its local then it will be easy enough to write a batch script to execute your program file. But if you're term'ing in to a citrix or some other kind of session, you'll have to work out the credentials and scheduling with an administrator.

2) Maintenance. If you create a "Fixed" batch script or Shell() script, and the location, or parameters change, then you have to stay on top of that.

3) Who else will be doing this when you go on vacation to the Bahamas? Is it relatively user-proof once its all said and done?

4) Cost vs Convenience. Is it cost effective spending the time and resources trying to set this all up to be a timed job vs doing steps manually?

5) Your skillset. It should be something you are willing to take on and learn. And we all know what happens then, you become the expert. So be prepared to become the owner of your process.

Just some things to consider. Hope all is well...and yes, I've been extremely buried for a while,  so my time out here has been and will probably still be limited. But its good to see familiar names! :o)
J
0
c9k9hAuthor Commented:
You are the best, Jeff!  Great explanations - thank you for putting those together.  (Close on the vacation - it's the Cayman Islands!)

The softward I'm launching (SAS) is on my local machine so a batch job will work for now.  This process is a 'band-aid' for the time being while we work out a long term solution.  So again, I appreciate your details to consider.

I am currently using the FollowHyperlink method and launching the batch file.  The only think I don't like with this is that I had to take it out of the code and make it a separate button because the SAS job takes about 20 minutes to run.  The code behind the button in Access doesn't care how long the job takes, as soon as it makes the connection - as far as it's concerned . . . it's done.  So it goes on to the next step and can't find the file it's looking for (because SAS is sending it in), so it throughs an error.  Once I pulled it out as a separate step it's okay, but that's not my preference.  I'd like the user to be able to click the button and not do anything again until the whole process is complete.

If you have a quick work-around for that, I'd love to hear it.  But it is working - so I'm not dead in the water.

Again - thanks for all you help!!!
K
0
jefftwilleyCommented:
Karen,
IF you want to wait for a process to finish, or for a file to appear in a specified location, you can definately be creative.

The first option I would think would be to look into a shell command that "listens" for a processed finished bit. I don't really use these as the environments I support have always been either server based or term or citrix, and that doesn't really play well.

Another thing you can do is put your app into a loop until a file appears in your directory.

Do until Dir("c:\myfile.xxx") <> ""
Sleep(3000)
loop

Use the sleep api to keep it from cycling all your CPU time waiting for the file to appear. Set the interval to whatever you want.

I might not have gotten the syntax just right, but I think you get the idea.

Put this at the top of a code module right underneath the Option statements

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim lmilliseconds As Long

IT should get you past your wait issues.

That all depends also if your app actually creates a file. So there ya go!
Enjoy, and have fun in the Caymans! lol
J
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
c9k9hAuthor Commented:
Thanks so much Jeff.  I will check this out.  I'm closing the post because you have already answered my original question.  I consider the rest a bonus!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.