BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Piyanka
Calcite | Level 5

I have already used this piece of code to get the password for one of DB id. But I cannot define the output of the below %sysexec to a variable so that I can used the same in later part of my sas code.

 

%macro pwdls;

%sysexec %str(/opt/CARKaim/sdk/clipasswordsdk GetPassword -p AppDescs.AppID=DIAL -p Query="safe=chbs_test;Folder=Root;Object=Test-XXXXXXX-XXX-XXX" -p FailRequestOnPasswordChange=false -o Password);

 %mend pwdls;

As soon as I call the macro I am getting the as below:

%pwdls;
TDFR6_67fuuwr91

But I want this output to be captured inside a variable. How can I do that.

I tried using the below piece but I am getting error as below:

 

 42?  %macro pwdls;
 43?  %let a=%sysexec %str(/opt/CARKaim/sdk/clipasswordsdk GetPassword -p AppDescs.AppID=DIAL -p Query="safe=chbs_test;Folder=Root;Object=Test-XXXX-XXX-XXX" -p FailRequestOnPasswordChange=false -o Password);

ERROR: Macro keyword SYSEXEC appears as text.
ERROR: A dummy macro will be compiled.

 

Please help

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Read the return string into a dataset using infile and a pipe, for instance:

filename tmp pipe '/opt/CARK... GetPassword...';

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

Then you have a dataset with the required information, and if needed you can call symput from that datastep to get it into a macro variable.

 

I suppose the one question I would ask is why your changing passwords via SAS, using command line?  Surely the application in question is better suited to doing such tasks, or linking active directory or something similar to do consolidated password management.

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Read the return string into a dataset using infile and a pipe, for instance:

filename tmp pipe '/opt/CARK... GetPassword...';

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

Then you have a dataset with the required information, and if needed you can call symput from that datastep to get it into a macro variable.

 

I suppose the one question I would ask is why your changing passwords via SAS, using command line?  Surely the application in question is better suited to doing such tasks, or linking active directory or something similar to do consolidated password management.

Piyanka
Calcite | Level 5
Thanks a lot. I could get the desired result.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 1635 views
  • 1 like
  • 2 in conversation