Some places I've seen proc printto print= option being used which sends the output to the necessary location and sometimes I've seen FILE PRINT statement being utilized. Are there any rules for when either of these are to be used?
Main difference is duration.
File Print output is for a single data step.
Proc Printto output continues sending all of the specified type(s) of output to the destination(s) until canceled.
Thank you, that was helpful!
PROC PRINTTO controls the output for subsequent procedures, such as reports from PROC FREQ and PROC MEANS.
FILE controls messages written by subsequent PUT statements within the same DATA step. It has no impact on reports from SAS procedures.
Now that you've started me thinking, I will have to test what happens when both PROC PRINTTO and a FILE PRINT statement are in effect. Where will the PUT messages go?
************ TEST RESULTS:
When both PROC PRINTTO and FILE PRINT are used, the PUT statements in the DATA step write to the PROC PRINTTO destination.
So in the last scenario that you mentioned, proc printto trumps file print. Great point!
Thank you, that was helpful!
In that last scenario, PROC PRINTTO and FILE PRINT are actually working together. The FILE statement can still override by specifying a different destination such as:
file 'path-to-a-hardcoded-file-name';
It's only the use of FILE PRINT that uses the PRINTTO destination.
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.