Solved

Running SAS through PERL

Posted on 2006-11-05
9
271 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 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