BookmarkSubscribeRSS Feed
astha8882000
Obsidian | Level 7

 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?

5 REPLIES 5
ballardw
Super User

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.

 

 

astha8882000
Obsidian | Level 7

Thank you, that was helpful!

Astounding
PROC Star

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.

astha8882000
Obsidian | Level 7

So in the last scenario that you mentioned, proc printto trumps file print. Great point!

Thank you, that was helpful!

Astounding
PROC Star

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 993 views
  • 0 likes
  • 3 in conversation