BookmarkSubscribeRSS Feed
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'
%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=;

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;
/* 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.



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=;

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)



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2 in conversation