BookmarkSubscribeRSS Feed
jjames1
Fluorite | Level 6

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

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

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?

jjames1
Fluorite | Level 6

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

Sven111
Pyrite | Level 9

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.

ChrisBrooks
Ammonite | Level 13

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. 

ChrisNZ
Tourmaline | Level 20

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.

 

 

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1648 views
  • 0 likes
  • 4 in conversation