DATA Step, Macro, Functions and more

X/SYSTEM equivalent that returns string?

Reply
Contributor
Posts: 24

X/SYSTEM equivalent that returns string?

I need to create an encrypted version of a string, but SAS doesn't provide SHA-1, which is required. SAS Tech Support recommended using openssl (this is on a Linux box). I'm working in EG, but have gotten the Allow XCMD option turned on.

However, now that I'm ready to submit the call, I see that the X statement (and, apparently, all its function/statement/etc. variants like SYSTEM, %SYSEXEC) just get the system return code. What I want is the string that my openssl command returns. Can anyone tell me how to make this happen?

TIA,
Steve
Frequent Contributor
Posts: 139

Re: X/SYSTEM equivalent that returns string?

Steve,
You will need to call the SHA-1 dll directly via the MODULE family of functions and call routines. By using the SASCBTBL attribute table you could build a prototpye and have SAS via the DATA STEP pass your string and return the updated value. Once you get the hang of it using the SASCBTBL with the MODULE family of functions and call routines can be quite usefull.

The below papers are a good start.
http://www2.sas.com/proceedings/sugi30/248-30.pdf

http://www.sas.com/offices/asiapacific/sp/usergroups/snug/archive/2006/presentations/Q106Matthews.pd...

and in the SAS Online Doc
http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#/documentation/cdl...
Frequent Contributor
Posts: 130

Re: X/SYSTEM equivalent that returns string?

Hi Steve.

Richard DeVenezia's web page is an excellent resource too, and it has an example of the call module (Darryl's suggestion) that might be a fairly close template to what you want: it calls the win MD5 dll from sas. see

http://www.devenezia.com/downloads/sas/sascbtbl/

Let us know if this apporach helps you.

Super User
Super User
Posts: 6,500

Re: X/SYSTEM equivalent that returns string?

Use a PIPE.

data _null_;

  infile 'openssl ...' pipe ;

  input ;

  call symputx('myvar',_infile_);

run;

Ask a Question
Discussion stats
  • 3 replies
  • 146 views
  • 0 likes
  • 4 in conversation