Running SAS through PERL

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
     
sudAsked:
Who is Participating?
 
TintinConnect With a Mentor Commented:
#!/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
 
TintinCommented:
Same as you run an other program via Perl.

system "/path/to/sasprog $var1 $var2" and die "Can not run sasprog $!\n";
0
 
sudAuthor Commented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
TintinCommented:
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
 
mjcoyneCommented:
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
 
sudAuthor Commented:
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
 
sudAuthor Commented:
Thanks,

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

Thanks,

Sudhir
0
 
mjcoyneCommented:
Now, sas by itself *is* and executable file...:)
0
 
sudAuthor Commented:
Yes Tintin,

that works.

Sudhir
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.