Solved

Running SAS through PERL

Posted on 2006-11-05
9
269 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now