Link to home
Start Free TrialLog in
Avatar of sud
sud

asked on

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
     
Avatar of Tintin
Tintin

Same as you run an other program via Perl.

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

ASKER

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";
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.
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.
Avatar of sud

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sud

ASKER

Thanks,

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

Thanks,

Sudhir
Now, sas by itself *is* and executable file...:)
Avatar of sud

ASKER

Yes Tintin,

that works.

Sudhir