Hi all,
I'm using rtf commands to align values in 'Result' and 'Reference Range' columns - please see below. While using of
protectspecialchars=off pretext="\qj\tqdec\tx430 "
is working perfectly I can't do the same using 'alignment with hyphen:
protectspecialchars=off pretext="\qj\tlhyph\tx430 "
What could be the reason and why the last is not working?
Thank you!
What can be a solution of the problem?
Hi:
Well, tqdec is a TAB related command, as shown in this paper, where the author explicitly talks about TAB related tqdec: http://www.pharmasug.org/proceedings/2013/IB/PharmaSUG-2013-IB08.pdf on page 7. When I look in the RTF spec, I see that both tqdec and the tlhyph controls are TAB related controls:
Do you have tab stops in your RTF file? The thing that makes me wonder about tlhyph is that it says it is for "leader" hyphens, which makes me wonder whether it is really designed for alignment within the string or alignment to a tab stop.
I can do decimal alignment using style(column)={just=d} without using RTF control words. My tendency would be to center the cell contents and use just=c as shown below:
This does depend on the strings being the same width on both sides of the hyphen as shown in the difference between the first row and the other 3 rows.
Hope this helps. If you want to pursue the tlhyph route, you'll need to work with Tech Support.
Cynthia
Thank you, Cynthia,
Here it is the code. Now without 'pretext' for "Reference|Range". It seemed just changing 'dec' on 'lhyphn' could help.
options nobyline nodate nonumber orientation=landscape;
ods escapechar="!" ;
proc report data=final_1 nowd nowindows missing headline headskip split="|" formchar(2)='_';
column var1 var2 var3 var4 var5 var6 var7 var8;
define var1 / "ID" order order=data style(header)=[just=l] style(column)=[asis=on just=l cellwidth=7.5%];
define avisitn / noprint order order=data;
define var2 / "Timepoint" order order=data style(header)=[just=l] style(column)=[asis=on just=l cellwidth=6.5%];
define var3 / "Date and Time|of Collection" order order=data
style(header)=[just=l] style(column)=[asis=on just=l cellwidth=12%];
define var4 / "Test" style(header)=[just=l] style(column)=[asis=on just=l cellwidth=33%];
define var5 / "Result" style(header)=[just=c] style(column)=[just=c protectspecialchars=off pretext="\qj\tqdec\tx430 " cellwidth=10%];
define var6 / "Reference|Range" style(header)=[just=c] style(column)=[asis=on just=c cellwidth=10%];
define var7 / "High/Low" style(header)=[just=l] style(column)=[asis=off just=l cellwidth=7%];
define var8 / "Reason Sample|Not Collected" style(header)=[just=l] style(column)=[asis=on just=l cellwidth=13%];
run;
Data
Code
Cause? Guessing to a extent here but RTF has a decimal align ability. I suspect there hasn't been a great deal of call to force values to align on a hyphen especially since hyphens play a role in splitting line rules.
If the appearance of alignment was worth it too me I would likely have 3 variables, one for the left value, one for the hyphen and one for the right value and then play with cell border appearance options, justification (right for the first, left for the third) and cell padding values to make things appear as desired. Or possibly 2 values with a picture format to either append or prefix a hyphen with the border manipulation.
That's basically what I do to create ( 1.25, 3.4) type "confidence intervals" in Proc report/tabulate.
The rtf commands are listed, for example, here: http://www.biblioscape.com/rtf15_spec.htm.
Now I am thinking that the alignment with hypen would work if there were not spaces in the values. But anyway would be grateful for any advise.
Hi:
Well, tqdec is a TAB related command, as shown in this paper, where the author explicitly talks about TAB related tqdec: http://www.pharmasug.org/proceedings/2013/IB/PharmaSUG-2013-IB08.pdf on page 7. When I look in the RTF spec, I see that both tqdec and the tlhyph controls are TAB related controls:
Do you have tab stops in your RTF file? The thing that makes me wonder about tlhyph is that it says it is for "leader" hyphens, which makes me wonder whether it is really designed for alignment within the string or alignment to a tab stop.
I can do decimal alignment using style(column)={just=d} without using RTF control words. My tendency would be to center the cell contents and use just=c as shown below:
This does depend on the strings being the same width on both sides of the hyphen as shown in the difference between the first row and the other 3 rows.
Hope this helps. If you want to pursue the tlhyph route, you'll need to work with Tech Support.
Cynthia
Hi Cynthia,
Thank you for style(column)={just=d} and the link provided. I guess you are complitely right - it is a question of 'leader' hyphens. Actually it would be useful to add alignment using any particular symbol in a future SAS release.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.