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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.