BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

Your dump of the hex codes looks fine, '33'x is the digit 3 and '20'x is a space.  SAS uses fixed length fields so all variables are padded with spaces.

 

Perhaps your only issue is that you are overwriting your SAS logs?

Use the -log and -print command line options to re-direct the SAS log and listing outputs to different files.

For example you might add run1, run2, etc to the filenames.

 

#!/bin/ksh
n=1
fn=myprogram
sas -sysparm $n -sysin ${fn}.sas -log ${fn}_run${n}.log -print ${fn}_run${n}.lst

 You might also want to look into the -stdio command line option which will take the program code from standard input and direct the log and listing to standard output and standard error.

sfinch
Calcite | Level 5

Thanks again for these very helpful thoughts!  The failure of:

 

%let TskID=&sysparm;
%put &TskID;

 

persists, despite my avoidance of SAS log overwriting (as of just now).  What a mystery!  I will return to this issue in a few days, but appreciate your efforts.  Maybe alternatives will arise eventually.

sfinch
Calcite | Level 5

The following paragraph:

 

LIBNAME myplace "/home/username/";
DATA myplace.x&TskID;
  LENGTH TskID $200 ;
  TskID=symget('sysparm');
  RETAIN TskID;
RUN;

 

allows me to save TskID to an appropriately-named sas7bdat file (x1, x2 or x3); the parameter value is henceforth available to me later.  This solution seems rather cumbersome.  I'm curious whether anyone can offer a more elegant way of doing this.  As discussed earlier, for some reason

 

%let TskID=&sysparm;
%put &TskID;

 

does not work for me.  Thanks very much for your guidance!

sfinch
Calcite | Level 5

Interesting.  If, in my shell script, I replace

 

#SBATCH --array=1-3

 

by

 

#SBATCH --array=1993-1995

 

(actual years rather than small indices), then the SAS commands

 

%let TskID=&sysparm;
%put &TskID;

 

suddenly work!  This is an unexpected but gratifying resolution. 

 

Might such behavior be a SAS bug?  Namely, when the environment variable $SLURM_ARRAY_TASK_ID is small, it fails to be properly passed from shell script to SAS program. 

 

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 18 replies
  • 2889 views
  • 0 likes
  • 4 in conversation