| Date: | Wed, 6 Mar 1996 14:10:00 EST |
| Reply-To: | "Gyzen, Rudy" <RGyzen@NITGNPSD.TELECOM.COM.AU> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | "Gyzen, Rudy" <RGyzen@NITGNPSD.TELECOM.COM.AU> |
| Subject: | Re: Using Parameter in PROC SQL |
|---|
Maria,
Others may have better suggestions, however here is a solution for you. The
sysparm invocation option lets you pass params into sas. You may retrieve
them using the sysparm() function or the &sysparm macro variable from within
SAS. The -log & -print switches redirect log & output to files. There are
other switches you can use to accomplish this (ALTLOG, ALTPRINT, SYSPRINT).
You can also specify a FILENAME statement from within your SAS program to
accomplish the redirection of output to a file. A lot of this is detailed
in the SAS companion for the Unix Environment.
#!/bin/sh
#
# Script to run sas_pgm.sas (hacked from someone else's script - accolades
if any
# shall be passed on!)
#
date=`date '+%d%b%y:%H:%M'`;
export date;
log="sas_pgm_$date.log";
export log;
output="sas_pgm_$date.out";
export output;
/home/sas/sas609/sas -sysin /saspgm/sas_pgm.sas \
-config /common/scripts/config.sas609 \
-log /log/$log \
-print /output/$output \
-sysparm "$date" \
-errorabend \
-memsize 128M \
-sortsize 64
Rudy Gyzen
(Contract) Snr Analyst Programmer
Telstra Corporation
Olympicity, Australia "Hindsight knows everything"
----------
>From: owner-sas-l
>To: Multiple recipients of list SAS-L
>Subject: Using Parameter in PROC SQL
>Date: Tuesday, 5 March 1996 2:09PM
>
>Hi,
>
>I'm new to SAS/UNIX. How can I do the following:
>
>1. run a sas program as part of a UNIX script
>2. pass a parameter to the sas program to use in a PROC SQL/select
> as in:
>
> select fld1, fld2, fld3 from tbl1 where dat1 = parameter-date
>
>3. save my output to an external file.
>
>What I am trying to do is run my sas program in batch, scheduled mode
>in UNIX.
>
>Thanks in advance for your help.
>
>Maria
>
|