BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DmytroYermak
Lapis Lazuli | Level 10

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!

 

1.jpg

What can be a solution of the problem?

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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:

tqdec_hyphen.png

 

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:

center_hyphen.png

 

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

View solution in original post

6 REPLIES 6
Cynthia_sas
SAS Super FREQ
Hi: Did you draw the line for Result and Reference Range? Is Reference Range a character string? That's what I would expect. It looks like you are passing the RTF control string via a style override. Are you doing this on the DEFINE statement for the Reference Range? My guess is that you'll have to work with Tech Support on this one.

Cynthia
DmytroYermak
Lapis Lazuli | Level 10

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;

 

ballardw
Super User

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.

DmytroYermak
Lapis Lazuli | Level 10

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.

 

 

Cynthia_sas
SAS Super FREQ

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:

tqdec_hyphen.png

 

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:

center_hyphen.png

 

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

DmytroYermak
Lapis Lazuli | Level 10

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1863 views
  • 0 likes
  • 3 in conversation