Hello ,
Thank you for the the previous reply for my question on How to Run Shell Script inside SAS?
I tried using the following piece of code but would like to describe my issue in detail
filename oscmd pipe "/users/smith/report.sh 2>&1";
data _null_;
infile oscmd;
input;
put _infile_;
run;
filename oscmd clear;
The main purpose of running the shell script is to decrypt a particular variable within SAS.
Let me be clear.
I have a database_test in which I have a particular table Table_ABC which contains the var1 that has the encrypted value.
I need to read this encrypted_value using SAS and then put it into the shell script inside SAS to get the decrypted_value and store it in another variable var2 in the same database_test .
In short I need to do all this decryption process from within the SAS.
As I am a beginner to SAS I dont know how to approach this situation .
Please help
Thanks in advance
You are talking about 2 different, independent problems:
- seeing the result of a system command in SAS
- decrypting an encrypted variable
What do these 2 questions have to do with each other? What is the actual problem you want solved?
Hello,
Thank you for your reply.
- I asked if it is possible to run shell script is because the library used for the encryption of the variable is a simple wrapper for the standard ruby OpenSSL library. Since I do not want to use ruby inside my SAS I converted them into a shell script without any ruby libraries and want to run it on SAS.
-Now for decryption-- I need to pass the encrypted value into my shell script and get the decrypted output from inside SAS itself.
This is the actual problem that I need to get solved
Can you just decrypt everything ahead of running the SAS program? That would simplify things a lot and would likely be substantially faster than an entry by entry decryption as well.
I think you're going to have to extract the encrypted value from your SAS data set and pass that as a parameter to your shell script, have the output written to a file then read that back into SAS.
I must say if the variable has to be encrypted it must be confidential and none of this process seems terribly secure to me.
So you need something like this?
data WANT;
set TABLEABC;
FILEVAR='/users/smith/decrypt.sh '||VAR1;
infile DUMMY pipe filevar=FILEVAR;
input;
put _infile_;
run;
where your script reads an ecrypted value and writes back a decrypted value.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.