Hi,
I am new to SAS ODA. I am trying to create a RTF report using ODS and PROC REPORT Procedure. Report is being created however some options are not working from below code.
Code:
Issue 1. Break after statement does not produce break, neither is SAS result window output nor in RTF file.
Issue 2. Input dataset has some Label variable values with 2 leading spaces as highlighted in blue, but those spaces are striped in output window and RTF both.
Issue 3. I am giving CENTER option for center justification in PROC REPORT statement. But all variables are left aligned. When i explicitly define CENTER justification in each define statement , then it works.
I am aware SAS ODA has some limitations, are these issues because of that, or am i making some mistake in syntax?
Many thanks in advance.
It is best practice to provide example data when wanting to get specific output. Sometimes the data needs to change and without an example data set is hard to tell what may be needed. Best is to provide a data step to create such data.
The stripping of leading spaces is default behavior in almost all output. You can try using the style override of ASIS to prevent that.
data example; text = ' sometext'; run; /* default behavior*/ proc report data=example; columns text; define text/order; run; /* override the default behavior with the style setting ASIS*/ proc report data=example; columns text; define text/order style=[asis=on]; run;
Can't test the behavior of BREAK without data. Note that the SKIP option of Break only applies in the ODS LISTING destination an will have no effect in another destinations. The default output window is likely to be ODS HTML and will not show such. Also ODS RTF will not as it is not the LISTING (which means very plain text) either.
You don't show any code for how you attempted to center the results but since you show WIDTH option I suspect that you attempted the CENTER option. Both of those option also only apply to the ODS LISTING destination.
In other than LISTING style elements are used to control such things as width of cells or other properties. To create a 2 inch wide box and center the output
proc report data=example; columns text; define text/order style=[cellwidth=2in just=c]; run;
Just stands for justification.
The online help for Proc Report has several examples of using ODS style settings as well as responses to questions on this forum.
The style settings let you control things like the background color, font properties like family, size, color, borders of the cells, space around the displayed values and many other things.
It is best practice to provide example data when wanting to get specific output. Sometimes the data needs to change and without an example data set is hard to tell what may be needed. Best is to provide a data step to create such data.
The stripping of leading spaces is default behavior in almost all output. You can try using the style override of ASIS to prevent that.
data example; text = ' sometext'; run; /* default behavior*/ proc report data=example; columns text; define text/order; run; /* override the default behavior with the style setting ASIS*/ proc report data=example; columns text; define text/order style=[asis=on]; run;
Can't test the behavior of BREAK without data. Note that the SKIP option of Break only applies in the ODS LISTING destination an will have no effect in another destinations. The default output window is likely to be ODS HTML and will not show such. Also ODS RTF will not as it is not the LISTING (which means very plain text) either.
You don't show any code for how you attempted to center the results but since you show WIDTH option I suspect that you attempted the CENTER option. Both of those option also only apply to the ODS LISTING destination.
In other than LISTING style elements are used to control such things as width of cells or other properties. To create a 2 inch wide box and center the output
proc report data=example; columns text; define text/order style=[cellwidth=2in just=c]; run;
Just stands for justification.
The online help for Proc Report has several examples of using ODS style settings as well as responses to questions on this forum.
The style settings let you control things like the background color, font properties like family, size, color, borders of the cells, space around the displayed values and many other things.
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.