BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8

Is there a way to send proc compare results to a file (.txt) and append the results to the same file?

2 REPLIES 2
ballardw
Super User

@SASPhile wrote:

Is there a way to send proc compare results to a file (.txt) and append the results to the same file?


I'm not quite sure what you mean by "append results to the same file".

Proc Printto can be used to send output to a file that typically goes to the results or listing output. By default output is appended as additional procedures are run.

If you have other procedures that you do not want in the same output you can suspend output to the file and then restart later.

Pseudo code:

Proc printto  print="filename"
   new;  
run;

proc compare base=<baseset> compare=<compareset>;
run;

proc printto;
run;
<other procedures>
Proc printto  print="filename"
   ;  
run;

proc compare base=<baseset2> compare=<compareset2>;
run;
proc printto;
run;

If you don't have other procedures in the middle of the ones you want to send to text file then you only need to have the Proc Printto;run; after the last to close the output. Notice that NEW creates a new file and will replace an existing one if used.

 

Reeza
Super User
You could put a filepath on your ODS LISTING.

ods listing file='/folders/myfolders/demo.txt';

proc compare ....


run;


ods listing close;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1001 views
  • 0 likes
  • 3 in conversation