LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 30 Apr 2008 15:38:54 -0400
Reply-To:   Mike Rhoads <RHOADSM1@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Mike Rhoads <RHOADSM1@WESTAT.COM>
Subject:   Re: Printing Carriage Returns
Comments:   To: Wing9897@hotmail.com
In-Reply-To:   <dc461526-eb7f-4140-b552-c93d1ea45117@y38g2000hsy.googlegroups.com>
Content-Type:   text/plain; charset="us-ascii"

If you have to use the old-fashioned "listing" output, either of the responses you've received already will work.

However, your output will look much nicer in one of the newer ODS destinations, such as HTML, PDF, or RTF. You can use ODS ESCAPECHAR to insert a string into your variable that these destinations will recognize as a new line:

ods escapechar='^';

data test (drop=line1-line3); length text $ 30; line1= 'line1'; line2= 'line2'; line3= 'line3'; text= catx('^n', of line1-line3); run;

ods listing close; ods html file='C:\junk.html'; proc print data=test; run; ods html close; ods listing;

For an excellent discussion of the ODS ESCAPECHAR functionality, see Cynthia Zender's paper at http://www2.sas.com/proceedings/forum2007/099-2007.pdf.

Mike Rhoads Westat RhoadsM1@Westat.com

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Wing9897@hotmail.com Sent: Wednesday, April 30, 2008 1:54 PM To: sas-l@uga.edu Subject: Printing Carriage Returns

Hello,

I would like to print a variable that contains 2 carriage returns and have it actually execute the carriage returns so that there are 3 lines for that 1 observation. How can this be accomplished? Thanks.

data test;

line1= 'line1'; line2= 'line2'; line3= 'line3';

text= cat(line1,'0D0A'x,line2,'0D0A'x,line3,'0D0A'x);

run;

proc print data=test; run;


Back to: Top of message | Previous page | Main SAS-L page