I came across two issues when using ODS EXCEL with PROC ODSTEXT
1) why absolute_column_width doesn't apply in the below cases.
2) Long text in Proc odstext is not displayed properly.
When I tested text with length ~143 is displayed without warping, but longer text is being hidden.
ods excel file="test1.xlsx"
options(absolute_column_width="100" ) style=Excel;
ods text="SAS was developed at North Carolina State University";
ods text="Wikipedia: SAS (previously 'Statistical Analysis System') is a software suite developed by SAS Institute for advanced analytics, multivariate analyses, business intelligence, data management, and predictive analytics.";
ods excel close;
ods excel file="test2.xlsx"
options(absolute_column_width="100" ) style=Excel;
proc odstext;
p "SAS was developed at North Carolina State University";
p "Wikipedia: SAS (previously 'Statistical Analysis System') is a software suite developed by SAS Institute for advanced analytics, multivariate analyses, business intelligence, data management, and predictive analytics.";
run;
ods excel close;
Using width and tagattr= (merge cells) can better control the the text flow.
style={width=3in tagattr='mergeacross:5'}
ods excel file="test2.xlsx"
style=Excel;
proc odstext;
p "SAS was developed at North Carolina State University";
p "Wikipedia: SAS (previously 'Statistical Analysis System') is a software suite developed by SAS Institute for advanced analytics, multivariate analyses, business intelligence, data management, and predictive analytics." / style={width=3in tagattr='mergeacross:5'};
run;
ods excel close;
The ABSOLUTE_COLUMN_WIDTH= option is for the columns within the table. The TEXT= option is simply floating text which is a good use of PROC ODSTEXT.
I don't know why this trick works, but it does. Set width=1000% for the really long text.
%let path=/folders/myfolders/ODS Excel examples;
ods excel file="&path/test2.xlsx" style=Excel;
proc odstext;
p "SAS was developed at North Carolina State University";
p "Wikipedia: SAS (previously 'Statistical Analysis System') is a software suite developed by SAS Institute for advanced analytics, multivariate analyses, business intelligence, data management, and predictive analytics."
/ style={width=1000%};
run;
ods excel close;
The screen shot below shows what test2.xlsx looks like for me.
Set width=1000% on really long text in PROC ODSTEXT to force it to display
This is weird, I will open SAS Technical Support track and see if they come up with something.
Using width and tagattr= (merge cells) can better control the the text flow.
style={width=3in tagattr='mergeacross:5'}
ods excel file="test2.xlsx"
style=Excel;
proc odstext;
p "SAS was developed at North Carolina State University";
p "Wikipedia: SAS (previously 'Statistical Analysis System') is a software suite developed by SAS Institute for advanced analytics, multivariate analyses, business intelligence, data management, and predictive analytics." / style={width=3in tagattr='mergeacross:5'};
run;
ods excel close;
The ABSOLUTE_COLUMN_WIDTH= option is for the columns within the table. The TEXT= option is simply floating text which is a good use of PROC ODSTEXT.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.