LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 18 Jan 2011 21:45:26 -0500
Reply-To:     Scott Bass <sas_l_739@YAHOO.COM.AU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Scott Bass <sas_l_739@YAHOO.COM.AU>
Subject:      Unix scripting question: keeping -sysparm quoted

Hi,

This question is specific to Unix. If you're not working with SAS on Unix just hit delete or ignore.

Summary: I have a series of Unix scripts nested about 4 deep. I need to set the -sysparm parameter from the top level script to control the processing of the SAS program. The quoting of -sysparm is not being maintained properly, and SAS issues an error.

Details: I have the following scripts:

RunAll_DDB.sh: This is the top level script ("one liner"):

./RunAll.sh RunAllUnix_DDB.sas "$@"

RunAll.sh: This is used for a variety of SAS prgrams:

pgm=$1 shift

if [[ $# -gt 0 ]]; then sysparm="-sysparm \"$@\""; else sysparm=""; fi

print \ sas -sysin $pgm $sysparm -rsasuser -noterminal sas -sysin $pgm $sysparm -rsasuser -noterminal

The "sas" script: This is a local script:

#!/usr/bin/ksh [[ $TERM = "vt220" ]] && TERM="vt220-nam" if [[ $SAS_ROOT != "/sas913" ]] then echo "SAS directory $SAS_ROOT is invalid for this server" exit 1 fi SAS_CONFIG="$SAS_ROOT/sasv9.cfg" if [ ! "$DISPLAY" ] then SAS_OPTIONS=$SAS_OPTIONS" -NODMS" fi echo $@ SAS_WORK="$(saswork)"

#export SAS_ROOT SAS_WORK

echo "$SAS_ROOT/sas $SAS_OPTIONS -work $SAS_WORK $@" $SAS_ROOT/sas $SAS_OPTIONS -work $SAS_WORK $@

(Note: I've also overridden that "sas" script with my own, trying:

$SAS_ROOT/sas $SAS_OPTIONS -work $SAS_WORK "$@" $SAS_ROOT/sas $SAS_OPTIONS -work $SAS_WORK $* $SAS_ROOT/sas $SAS_OPTIONS -work $SAS_WORK "$*"

$SAS_ROOT/sas is SAS's script. At my site it is installed in /sas913/sas. I won't print the entire file, but it contains the line:

# This is a generated script. Do not edit this file.

then later, the business end of the script...

exec $SAS_INSTALL_ROOT/hotfix/sasexe/sas "$@"

Sorry for all the details - hopefully it makes sense to someone out there!!!

The various "echo" commands display this in my shell:

RunAllUnix_DDB.sh d4* (I want to run all the d4* programs) sas -sysin RunAllUnix_DDB.sas -sysparm "d4xxxx.sas d4yyyy.sas d4zzzz.sas" -rsasuser -noterminal \-sysin RunAllUnix_DDB.sas -sysparm "d4xxxx.sas d4yyyy.sas d4zzzz.sas" -rsasuser -noterminal /sas913/sas -autoexec /proj/some/pharma/company/autoexec.sas -work /saswork/tmp7 -sysin RunAllUnix_DDB.sas -sysparm "d4xxxx.sas d4yyyy.sas d4zzzz.sas" -rsasuser -noterminal ERROR: Invalid file, /proj/some/pharma/company/programs/d4zzzz.sas".sas.

Everything *looks* OK in the shell output - sysparm stays quoted throughout the script invocations (or at least the "echo" statements). But, the final error message is indicative of -sysparm not being "really" quoted.

If I cut-and-paste the final SAS command line and submit it directly in the shell, the command works fine.

Does anyone know how to maintain the quoting of the -sysparm argument throughout a series of nested scripts?

Thanks, Scott


Back to: Top of message | Previous page | Main SAS-L page