Hi all,
I have some '0' values in my table. When I put it in character format :
put (x,best.)
and then list in the table using Proc Report:
define var2 / " Column_name " style(header)=[cellwidth=10.5%] style(column)=[just=d posttext=' '] ;
I receive the following issue:
The column where I have just zero values and values without decimal are shifted right ( I marked green the line that should be shifted left ). I think that put '0' in the view' '0.000' will be enough to align the figures to the center. Have you ever faced the issue and what could be a solution for the case?
Thank you!
The solution was offered by one kind colleague:
define var2 / "Cohort XXXX" style(header)=[cellwidth=11.5%] style(column)=[just=c protectspecialchars=off pretext="\qj\tqdec\tx800 "] ;
Thus special 'report' code was used:
[just=c protectspecialchars=off pretext="\qj\tqdec\tx800 "]
where 800 can vary to shift the text. It is important to keep space after 800.
Are you attempting to align decimal points in character values? I don't think that is what the decimal align expects.
Also creating a character value with Put can create leading spaces which are significant when it comes to attempting to align anything.
Please look at this code:
data junk; x=0; y1= quote( put(x,best.) ); y2= quote( put(x,best3.) ); y3= quote( put(x,best5.) ); y4= quote( put(x,best. -L) ); run;
The quotes in the various Y values are to outline the resulting blanks in the created variable. Any format length longer than the value needs, except the Z format for leading 0's, will create leading blanks unless the -L option (to left justify the result) on the Put function is used.
The solution was offered by one kind colleague:
define var2 / "Cohort XXXX" style(header)=[cellwidth=11.5%] style(column)=[just=c protectspecialchars=off pretext="\qj\tqdec\tx800 "] ;
Thus special 'report' code was used:
[just=c protectspecialchars=off pretext="\qj\tqdec\tx800 "]
where 800 can vary to shift the text. It is important to keep space after 800.
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.