Hi,
Is there a way to wrap long text in:
for example: data a;
x="aaaaaaaaaa";
run;
i want the output of the cell in the data will be like :
aaaaa
aaaaa
Thanks in advanced
Hi:
The FLOW option of PROC REPORT is only a LISTING destination option. Most ODS destinations ignore the FLOW option (among others). If you adjust cellwidth, and if your text string has a place to break, you can sometimes use only cellwidth (as shown in SHORTVAR2 and with both the LONGVAR and LONGVAR2 columns in the program output below. But, notice how with SHORTVAR, even with a ridiculously small value for CELLWIDTH, the text string does not wrap. You can control EXACTLY where your string will wrap in a cell, by inserting a "carriage return/line feed" ODS ESCAPECHAR command, as shown for the SHORTVAR_NL variable. See the attached screenshot for how the output looks.
cynthia
data longtxt;
length longvar $270
shortvar $12 shortvar2 $13 shortvar_nl $25;
set sashelp.class(obs=2);
shortvar = 'aaaaaaaaaaaa';
shortvar2 = 'aaaaaa aaaaaa';
shortvar_nl = 'aaaaaa~{newline 1}aaaaaa';
longvar = catx(' ','Twas brillig and the slithy toves.',
'Did gyre and gimble in the wabe',
'All mimsy were the borogroves',
'And the mome raths outgrabe.',
'Beware the Jabberwock my son',
'The jaws that bite, the claws that snatch.',
'Beware the jubjub bird and shun',
'the frumious Bandersnatch.');
longvar2 = longvar;
run;
ods listing close;
ods html file='c:\temp\use_cellwidth.html'
style=sasweb ;
ods escapechar='~';
proc report data=longtxt nowd;
column name shortvar shortvar2 shortvar_nl longvar longvar2;
title '1) Really LONG char var wraps based on cellwidth';
define name / display style(column)={just=c};
define shortvar/ display
style(column)={cellwidth=.10in};
define shortvar2/ display
style(column)={cellwidth=.10in};
define shortvar_nl/display;
define longvar/ display
style(column)={cellwidth=2in};
define longvar2/display
style(column)={cellwidth=4in};
run;
ods _all_ close;
title; footnote;
Hi Cynthia,
Thank you very much for your detailed answer that you provide with great generosity
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.