Good morning,
I need to insert a label with a line breack, is possible? I have to replicate an export in Excel with column headers that contain newlines like this:
"Matr.
S.I."
Please can you help me? I tried but in any case in te export results without a line breack....
many thanks to all.
Below one option.
data work.have;
col1='ABC';
col2=123;
run;
ods excel file="c:\temp\yourfile.xlsx";
%let lbl=Matr.%sysfunc(inputc(0A,hex.))S.I.;
proc print data=have label;
label col1="&lbl";
run;
ods excel close;
Need to insert line break in Excel using PROC EXPORT
Below one option.
data work.have;
col1='ABC';
col2=123;
run;
ods excel file="c:\temp\yourfile.xlsx";
%let lbl=Matr.%sysfunc(inputc(0A,hex.))S.I.;
proc print data=have label;
label col1="&lbl";
run;
ods excel close;
Good morning everyone, I have verified your solution for which I thank you, but I have a problem: if the width of the excel cell is sufficiently wide the text dos not wrap. I need an action equal the excel comand "ALT + ENTER" to insert a line break, is it possible? It's very important for me... otherwise I'll have to reorganize a rather large DB.... Tnks!!
How are you creating an Excel file? Please show us the code.
If you are using PROC REPORT or PROC PRINT, there is the SPLIT= option which causes line breaks exactly where you want them to be. To have the text wrapped, there is also the FLOW= option in ODS EXCEL and the option in ODS EXCEL tagattr='wraptext:yes'
So to modify @Patrick 's code to use the SPLIT= option
ods excel file="c:\temp\yourfile.xlsx";
proc print data=have label split='~';
label col1="Matr.~S.I";
run;
ods excel close;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.