Solved

Running SAS through PERL

Posted on 2006-11-05
9
273 Views
Last Modified: 2010-03-05
Hi Expert,
            I am trying to work on managiang some SAS filesand I have following question.

 1.    How can I run SAS program through PERL ?
 2. How can I pass parameter to SAS program from PERL ?

Any comment or suggestion will be greatly appreciated.

Thanks you,

Sudhir
     
0
Comment
Question by:sud
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 17877352
Same as you run an other program via Perl.

system "/path/to/sasprog $var1 $var2" and die "Can not run sasprog $!\n";
0
 

Author Comment

by:sud
ID: 17877649
Hi Tintin,
     It just open the program but does not run it ?

in my case SAS is installed on B drive while I am on A drive.

Here is the program that i am trying to write,

#!/usr/local/bin/perl -w
use strict;
print "Hello World\n";
system "D:/Program Files/SAS/SAS 9.1/temp.sas" and die "Can not run sasprog $!\n";
0
 
LVL 48

Expert Comment

by:Tintin
ID: 17877667
What do you mean by "it just opens the program, but does not run it"?
How do you normally run SAS programs?  
I assume you need to invoke it with some type of SAS executable/interpreter.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:mjcoyne
ID: 17877691
temp.sas is not an executable file.  You'll need to call the program itself, with parameters, perhaps in a file...

If SAS is not able to be run from the command line, or at least passed a data file from the command line, it might not be possible to do it in Perl.
0
 

Author Comment

by:sud
ID: 17877778
They way to run SAS is

sas temp.sas

The program opens the SAS viewer so i can edit the program. But does not run it.

Thanks,

Sudhir
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 17877819
#!/usr/local/bin/perl -w
use strict;
print "Hello World\n";
system "sas D:/Program Files/SAS/SAS 9.1/temp.sas" and die "Can not run sasprog $!\n";

You may need to put the full path to 'sas' if it isn't in your PATH.
0
 

Author Comment

by:sud
ID: 17878243
Thanks,

I have not tried it yet but will let u know the result.

Thanks,

Sudhir
0
 
LVL 17

Expert Comment

by:mjcoyne
ID: 17878796
Now, sas by itself *is* and executable file...:)
0
 

Author Comment

by:sud
ID: 17881491
Yes Tintin,

that works.

Sudhir
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
pattern matching in perl 2 111
Perl troubleshooting error. Base64 bootstrap parameter 5 76
syslog unix file 20 79
Insert Text into odbc.ini file 15 71
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question