BookmarkSubscribeRSS Feed
Teju2
Calcite | Level 5


I can able to retrieve password from using below command from unix . I am trying to achieve the same using SAS
/* Try 1*/
systask command '/opt/software/dbclients/CyberArk/cark_getpwd.ksh -a XXX -s XXX -o XXX'
status=passwd;
%put &passwd. &sysrc.;
result :
&passwd. blank &sysrc. is 0
/* Try 2 */

filename tmp pipe '/opt/software/dbclients/CyberArk/cark_getpwd.ksh -a XXX -s XXX -o XXX';
data want;
length return_string $2000;
infile tmp;
input return_string $;
put return_string=;
run;

result :  return_string=/opt/software/dbclients/CyberArk/cark_getpwd.ksh[23]: /opt/CARKaim/sdk/clipasswordsdk not found

/* try 3*/

%macro pwdls;

%sysexec %str(/opt/software/dbclients/CyberArk/cark_getpwd.ksh -a XXX -s XXX -o XXX);

%mend pwdls;
%pwdls;
/* try 4*/ 
%let a=%sysexec %str(/opt/software/dbclients/CyberArk/cark_getpwd.ksh -a XXX -s XXX -o XXX);
%put &a.;

result:  ERROR: Macro keyword SYSEXEC appears as text.

 

 

1 REPLY 1
Kurt_Bremser
Super User

Try 2 is the best method. Expand it like this:

filename tmp pipe '/opt/software/dbclients/CyberArk/cark_getpwd.ksh -a XXX -s XXX -o XXX 2>&1';

data want;
length return_string $2000;
infile tmp;
input return_string $;
put return_string=;
run;

The 2>&1 redirects stderr to stdout, so that all messages will appear in the SAS log.

 

But this:

/opt/software/dbclients/CyberArk/cark_getpwd.ksh[23]: /opt/CARKaim/sdk/clipasswordsdk not found

indicates that there is a problem locating a library or module needed for the command to work. Look at line 23 of the shell script.

Make sure that your direct and SAS attempt to run the command are executed in the same environment:

  • same server
  • same user
  • same settings in environment variables (e.g. PATH, LIBPATH)

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 645 views
  • 0 likes
  • 2 in conversation