BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I frequently have to produce outputs which contain no titles, headers or page breaks. I there a way to turn off all paging in PROC PRINT. The best I have been able to do so far is to set the lines in OPTIONS to a high number, however some data listings exceed even those line limits and I still get page breaks.
16 REPLIES 16
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
None that I am aware of, other than setting PAGESIZE=MAX (as you indirectly mentioned). A SAS DATA step using PUT to a non-print (FILE fileref NOPRINT) destination is one option. Or, possibly, consider using ODS CSV with RS=NONE, and parse your generated output data, may be another option.

Scott Barry
SBBWorks, Inc.
Cynthia_sas
SAS Super FREQ
Hi:
If you do make a CSV file from your procedure output, then your limitation on the number of report rows that you can have are limited by your spreadsheet program limit.

Other options to a DATA step program writing to a file are:
--investigate the use of the FORMDLIM option, which does not remove page break characters, but would let you replace the usual page break character with something like a line of dashes, for example:
http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000279106.htm

It is possible that some combination of FORMDLIM with PROC PRINTTO will give you a LISTING version of your output that does not have page breaks.

--make an ODS HTML file with style=minimal. There are no page breaks in an HTML file you will get one huge table with all the report rows. Page breaks are only inserted in an HTML file when the browser needs to print the file. The viewer for an HTML file is a web browser or any HTML viewer.

--avoid "paged" destinations, like PDF and RTF. Those destinations DO insert page break characters or instructions, as appropriate to the destination.

I'm just wondering what the purpose of no page breaks is -- without any kind of pause or reader break in the output, it will be very hard for someone to review the output. If all you want is an archive or record of the output and you don't intend to look at the output file after the fact, then the page break characters and page numbers don't add -that- much to the size of the file (and you can turn the titles and page numbers off). You could just use ODS or PROC PRINTTO to do the equivalent of taking a snapshot of the LISTING file output and then store the file on disk.

Just a few more suggestions.

cynthia
anjgupta
Calcite | Level 5
Hello,

I'm also seeking the abilty to print to the output window with no breaks.

I need to copy output from the SAS output window in Unix and paste into Excel in Windows. I'm really struggling to make this 'easy'. (No, open office isn't allowing cut and paste, sigh). And I can't share data between platforms.

I've used ODS to save the output to a sas dataset. But when I print the dataset with proc print - it breaks up the dataset with titles and extra lines. The more I can eliminate this - the easier I can copy to Excel and use 'text to columns' in one fell swoop.

Second problem: For some reason, the header row that lists the variable names isn't always left justified. Any way to force the variable names to print left-justified? It seems to be centering variable names that take up 2 rows. When I use 'text to columns' with a space as the delimiter - it throws off everything because it thinks the space+title represent 2 columns.

This has been exhausting - any help is appreciated. My hands are somewhat tied as I can't get open office to copy/paste to windows excel w/ any success.

Thanks
Cynthia_sas
SAS Super FREQ
Hi:
ODS CSV creates an ASCII text file that you should be able to FTP from Unix to Windows and open directly in Excel, especially if you give the file an extension of .CSV.

The PROC PRINT in this instance, creates a comma-separated file, without any page breaks or titles. As long as you have SAS 8.2 or later, you should be able to use the ODS CSV destination to create a comma separated file that Excel can open and render. Your other alternatives are PROC EXPORT or the LIBNAME engine (to export a SAS dataset to an Excel binary file format) or ODS HTML (to create an HTML file that Excel can open and render (without page breaks, but with titles, if you have a SAS TITLE statement) or ODS TAGSETS.EXCELXP (to create a Spreadsheet Markup Language XML file) that Excel can open and render.

cynthia
[pre]
ods csv file='comma_sep.csv';

proc print data=sashelp.shoes label;
var region product subsidiary stores sales returns inventory;
run;

ods csv close;
[/pre]
anjgupta
Calcite | Level 5
Thank you for the reply. For certain reasons - I cannot use FTP. So I must rely on copying and pasting from SAS to Excel. Any additional tips are welcomed.
Cynthia_sas
SAS Super FREQ
Hi:
The ODS CSV file is an ASCII file without page breaks or titles. You should be able to open it in a text editor (such as VI) on UNIX and do your copy and then paste to Excel on Windows.

cynthia
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You may also consider using SAS-generated EMAIL with your CSV file as an attachment or imbedded in the EMAIL body.

Scott Barry
SBBWorks, Inc.
anjgupta
Calcite | Level 5
Thanks for the clarification, Cynthia -

Both the csvall and csv file worked well. I made the pico window large enough so I could copy all output. Probably a more swift way to copy all - but I'm relearning unix after many years away.

The only issue with the csvall was a lot of extra space between titles and data - but I can live with that. Unless there's a trick, of course.

Best
Cynthia_sas
SAS Super FREQ
Since your ORIGINAL post said "no titles" that would indicate the use of ODS CSV -- which does not use SAS titles.

ODS CSVALL will cause SAS titles and BY lines and Procedure titles to show in the CSV file. The way to avoid titles is to use ODS CSV.

cynthia
anjgupta
Calcite | Level 5
Hello,

Thanks. Ideally, I'd have the titles print once per proc - and your suggestion of printing to CSV worked (for titles, I use CSVALL). There's a blank line after every title - ideally I'd supress it, but don't know if I can.

The main problem of having the output broken up has been solved.

Anjali
anjgupta
Calcite | Level 5
Somewhat related - is there any way to append to a csvall file? I'm running a macro that recreates files under different conditions - and I'd like one file of results in the end.

I'm trying to reset the file to itself - if it's been created ... but appending to a csvall file would be grand.
Cynthia_sas
SAS Super FREQ
Hi:
For ODS HTML and ODS CSV (as far as I've tested the code), you can use the MOD option on the FILENAME statement to append to an existing file...as shown in the program below.

cynthia
[pre]
** start by making CSV file of male students;
filename newcsv 'c:\temp\new.csv';

ods csv file=newcsv;

proc print data=sashelp.class;
where sex = 'M';
run;
ods csv close;

** Now add 12-year old students to existing file;
filename newcsv 'c:\temp\new.csv' mod;

ods csv file=newcsv;

proc print data=sashelp.class;
where age = 12;
run;
ods csv close;

** Now add Females to existing file;
filename newcsv 'c:\temp\new.csv' mod;

ods csv file=newcsv ;

proc print data=sashelp.class;
where sex = 'F';
run;
ods csv close;
[/pre]
anjgupta
Calcite | Level 5
Perfect - many thanks.
anjgupta
Calcite | Level 5
Hopefully, one last task. I use PICO - but might have access to other editors. Do any offer 'select all' as a text option? I've messed around with Emacs just now but can't grab the entire contents.

Thanks.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 16 replies
  • 8114 views
  • 0 likes
  • 5 in conversation