Help using Base SAS procedures

PROC PRINT no paging

Reply
N/A
Posts: 0

PROC PRINT no paging

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.
Super Contributor
Super Contributor
Posts: 3,174

Re: PROC PRINT no paging

Posted in reply to deleted_user
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.
SAS Super FREQ
Posts: 8,864

Re: PROC PRINT no paging

Posted in reply to deleted_user
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
Contributor
Posts: 47

Re: PROC PRINT no paging

Posted in reply to deleted_user
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
SAS Super FREQ
Posts: 8,864

Re: PROC PRINT no paging

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]
Contributor
Posts: 47

Re: PROC PRINT no paging

Posted in reply to deleted_user
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.
SAS Super FREQ
Posts: 8,864

Re: PROC PRINT no paging

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
Super Contributor
Super Contributor
Posts: 3,174

Re: PROC PRINT no paging

Posted in reply to Cynthia_sas
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.
Contributor
Posts: 47

Re: PROC PRINT no paging

Posted in reply to deleted_user
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
SAS Super FREQ
Posts: 8,864

Re: PROC PRINT no paging

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
Contributor
Posts: 47

Re: PROC PRINT no paging

Posted in reply to deleted_user
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
Contributor
Posts: 47

Re: PROC PRINT no paging

Posted in reply to deleted_user
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.
SAS Super FREQ
Posts: 8,864

Re: PROC PRINT no paging

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]
Contributor
Posts: 47

Re: PROC PRINT no paging

Posted in reply to deleted_user
Perfect - many thanks.
Contributor
Posts: 47

Re: PROC PRINT no paging

Posted in reply to deleted_user
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.
Ask a Question
Discussion stats
  • 16 replies
  • 3322 views
  • 0 likes
  • 5 in conversation