Reputation: 869
I am trying to do a Check Sum on a file and I thought using the X command was a good idea.
x 'CertUtil -hashfile U:\Programs\test\example.xml MD5';
I have looked all over the web to find out if I can print the output from this to the SAS Log, or even better to ODS PDF, but can't find anything.
I did explore using the DM statement but again I am unsure whether I can use CMD with this.
How do I print the CMD output to the SAS Log?
FINAL CODE AFTER ANSWER
filename fn pipe "CertUtil -hashfile U:\Programs\test\example.xml MD5";
data _NULL_;
infile fn MISSOVER DSD TRUNCOVER;
input
VAR1 $200. ;
put _infile_;
IF _N_ = 2 THEN CALL SYMPUT("HASH",VAR1);
run;
ods pdf text = "CheckSum for example.xml: &HASH";
Upvotes: 3
Views: 2128
Reputation: 1792
You can use the pipe
filename engine instead of an x
statement:
filename fn pipe `CertUtil -hashfile U:\Programs\test\example.xml MD5';
data _null_;
infile fn;
input;
put _infile_;
run;
In the data step, the infile
statement executes the system command, the input
statement reads in the output of the command one line at a time and the put _infile_
statement writes each line to the log.
Upvotes: 4