What is the best strategy for applying the different units types of SAS ODS mentioned in SAS Help Center: Units of Measurement?
I mainly use the PT and CM units but my results may look very different i different ODS destinations, e.g. ODS Excel, ODS PDF and ODS HTML. I've also tried to use % and it seems to work even if I do not understand what the % relates to. I've also seen some user omit the unit specifiation and it also seems to work.
I know this is a very open question. However, I would consider it solved if someone provides me with a link to good paper that explains everything about the units of measurment in SAS ODS.
It can seriously depend on where you are using the unit specified.
Sometime apparent "differences" such as appearance in PDF will turn out to be a display program using a different amount of display. Anything other than 100% display settings can make things appear smaller or larger even for theoretically identical output. If you send the same output to RTF and PDF they may appear different for that reason just because of different programs doing the display.
My general idea is Fonts are about the only thing I expect to work as expected when specifying a PT unit as that is a printers "point" and will generally correspond with the font size setting of most fonts.
Area, such as cell sizes then I use one of the MM, CM or IN depending on comfort level or possibly the paper to be printed on if such is expected.
PX, or pixels, is extremely display device dependent and I would expect anything I wrote that appeared nice on my system to look worse on a random different device and doesn't have a natural correspondence to anything physically printed.
Thank, you ballardw, for your answer!
What kind of measurement would your consider to use when deciding on the thicknes of lines in a proc report table? E.g. between the column headers and the actual data cells?
Probably MM as the units and a value around 0.1 or 0.2 as a starter for this. A 1 MM line is pretty thick in terms of cell borders. If I want some emphasis compared to the basic lines I would look at the active style definition and see what is used and provide an override in the report code.
@Multipla99 wrote:
Thank, you ballardw, for your answer!
What kind of measurement would your consider to use when deciding on the thicknes of lines in a proc report table? E.g. between the column headers and the actual data cells?
Thanks again, ballardw! Especially I liked your advise to look at the active style defintion.
I need to ask one more question under this subject.
The following code that gives me exactly what I want also shown below in a picture of Excel. For transparancy reasons, I would also like to put the unit of measurement int the code. However, I cannot find the unit that gives exactly the same result. I've tried with CM, IN, MM, PCT, PX, PT.
What unit am I using when I don't specify?
libname RESULTS "C:\Temp";
goptions device=png;
ods excel
file="%sysfunc(pathname(RESULTS))\Exempel SASdata.xlsx"
;
ods excel
options(sheet_name = "Tabell 1"
sheet_interval='none'
flow='header,data'
start_at = "B2"
absolute_column_width = "6,15,6,6,10,10")
;
proc odstext;
p 'Tabell 1. Class'
/ style =[fontsize=8pt fontfamily=roboto fontweight=bold];
run;
%let dsid=%sysfunc(open(sashelp.class));
%let nobs=%sysfunc(attrn(&dsid.,nlobs));
%let dsid=%sysfunc(close(&dsid.));
proc report
data = sashelp.class
style(header)=[foreground= #1E00BE
bordertopcolor = #1E00BE
bordertopstyle = solid
bordertopwidth = 10
borderbottomcolor = #1E00BE
borderbottomstyle = solid
borderbottomwidth = 10
backgroundcolor= #ffffff
fontsize=8pt fontfamily=roboto]
style(column)=[fontsize=8pt fontfamily=roboto
vjust=c
foreground= #1E00BE]
;
columns Name Sex Age Height Weight;
define Name
/ display
style(header)={just=l
borderrightcolor = #1E00BE
borderrightstyle = solid
borderrightwidth = 5}
style(column)={just=l
borderrightcolor = #1E00BE
borderrightstyle = solid
borderrightwidth = 5};
define Sex
/ display
style(header)={just=l
borderrightcolor = #1E00BE
borderrightstyle = solid
borderrightwidth = 5}
style(column)={just=l
borderrightcolor = #1E00BE
borderrightstyle = solid
borderrightwidth = 5};
define Age
/ analysis
style(header)={just=r
borderrightcolor = #1E00BE
borderrightstyle = solid
borderrightwidth = 5}
style(column)={just=r
borderrightcolor = #1E00BE
borderrightstyle = solid
borderrightwidth = 5};
define Height
/ analysis
style(header)={just=r
borderrightcolor = #1E00BE
borderrightstyle = solid
borderrightwidth = 5}
style(column)={just=r
borderrightcolor = #1E00BE
borderrightstyle = solid
borderrightwidth = 5};
define Weight
/
analysis
style(header)={just=r}
style(column)={just=r};
compute weight;
count+ 1;
if count^= &nobs then
do;
if mod(count,2)=0 then
do;
call define(_row_, "style", "style={background=#EDEDFF}");
end;
end;
else if count= &nobs then
do;
if mod(count,2)=0 then
do;
call define(_row_, "style", "style={background=#EDEDFF borderbottomcolor= #1E00BE borderbottomwidth=10}");
end;
else if mod(count,2)^=0 then
do;
call define(_row_, "style", "style={borderbottomcolor= #1E00BE borderbottomwidth=10}");
end;
end;
endcomp;
run;
ods excel close;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.