[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: Calling SAS from Perl
From:       kmself () IX ! NETCOM ! COM
Date:       2000-10-31 17:51:06
[Download RAW message or body]


on Tue, Oct 24, 2000 at 09:03:17AM -0700, Berryhill, Tim (TWB2@PGE.COM) wrote:
> Although I still think of myself as a mainframe SAS programmer, lately I am
> working in perl on unix.  I have to invoke a SAS session to run a job.  The
> current invocation is:
> 
>       `sas -nodms -sysparm "$account" /webrat/SASCODE/rat.sas`;
> 
> I would appreciate some thoughts from experienced unix SAS users.
> 
> Is there a way to instruct SAS V8 to use that sysparm (perl resolves
> $account into something like HJGT122301 before passing the line to the OS)
> in the log and list names, so that multiple sessions can run without
> overwriting each other's output?  I doubt it, because log and list are
> probably allocated before sysparm is evaluated, but I would be happy to be
> wrong.
> 
> Does the SAS V8 CD documentation work first time, every time for others, or
> does it occasionally glitch?  Are some underlined strings not URL's, and
> some URL's not resolveable?
> 
> Is the return code from SAS available to perl?  Is it if I use EXEC or
> SYSTEM instead of back ticks?  How is it available?

In the better-late-than-sober dept.:

You can call SAS and use it as a pipelined process by creating the
following shell script, I usually call it "saspipe":

    #!/bin/sh
    $SASROOT/sas -stdio

...where $SASROOT is the path to your local SAS installation.

You'd invoke this with some program as:

    $ saspipe <optionns> < myprog.sas

...or use any standard shell redirection to pipe your program code to
SAS.

Output is written to stdout (list) and stderr (log).  Perl has its own
internal mechanisms for handling these.  The return code should also be
available.  Not being the Perl hacker I should be, I don't know the
specifics, but it would correspond to $? in the shell.

You could do without the wrapper if you simply supplied the -stdio
option.  It would be nice if SAS simply followed standard conventions
and corresponded to GNU/Linux input/output without this switch.  While
we're at it, let's fix dd....

-- 
Karsten M. Self <kmself@ix.netcom.com>     http://www.netcom.com/~kmself
 Evangelist, Opensales, Inc.                    http://www.opensales.org
  What part of "Gestalt" don't you understand?      There is no K5 cabal
   http://gestalt-system.sourceforge.net/        http://www.kuro5hin.org

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic