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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 860 views
  • 0 likes
  • 2 in conversation