BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Amine_Khemiri
Obsidian | Level 7

Hello,

 

I have a variable text that contains some parameters like Basophils (10^9/L) and it is displaying correctly when I open the SAS dataset but when I run proc freq or I use proc report it becomes Basophils (10/L).

 

Could you help?

Thanks a lot in advance.

 

Here is the proc report code I'm using.

 

proc report data=reportDSN missing nowindows split='@'
            style(header)=[rules=group frame=above verticalalign=top background=white font_size=9pt] 
            style(report)=[outputwidth=100% rules=group frame=hsides background=white font_size=9pt]  
            style(column)=[rules=group font_size=9pt] spanrows;
columns pagebreak param_new text visn ord2 stat ("&trt1.^S={borderbottomcolor=black borderbottomwidth=2} " aval1 chg1) 
("&trt2.^S={borderbottomcolor=black borderbottomwidth=2} " aval2 chg2)
("&trt3.^S={borderbottomcolor=black borderbottomwidth=2} " aval3 chg3);
define  pagebreak / order order=data noprint;
define  param_new / order order=data noprint;
define  text / order order=data noprint;
define  ord2 / order order=data noprint;
define  visn / order order=data noprint;
 
define stat / display style(column)=[width= 2.0cm asis=on just=l] style(hdr)=[asis=on just=l] "Parameter (unit)^n ^_^_Time Point^n ^_^_^_^_Statistic"; 
define aval1   / display style(column)=[width= 1.5cm asis=on just=c] style(hdr)=[asis=on just=c] "Value";
define chg1    / display style(column)=[width= 1.5cm asis=on just=c] style(hdr)=[asis=on just=c] "Change from^nBaseline";
define aval2   / display style(column)=[width= 1.5cm asis=on just=c] style(hdr)=[asis=on just=c] "Value";
define chg2    / display style(column)=[width= 1.5cm asis=on just=c] style(hdr)=[asis=on just=c] "Change from^nBaseline";
define aval3   / display style(column)=[width= 1.5cm asis=on just=c] style(hdr)=[asis=on just=c] "Value";
define chg3    / display style(column)=[width= 1.5cm asis=on just=c] style(hdr)=[asis=on just=c] "Change from^nBaseline";
break after pagebreak /page;
compute before text / style=[font_face="Courier New" font_style=Roman];
line @1 text $200.;
endcomp;
compute before visn / style=[font_face="Courier New" font_style=Roman];
line @1 visn vis.;
endcomp;
compute after visn;
line " ";
endcomp;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

What does the ^S= in your code mean?  Did you define ^ as the ODS escape character?

Could that have an impact on the Basophil units?

 

If you want someone to test please provide a sample version of reportDSN (in the form of a data step that can be run to create it) that demonstrates the issue.

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

What does the ^S= in your code mean?  Did you define ^ as the ODS escape character?

Could that have an impact on the Basophil units?

 

If you want someone to test please provide a sample version of reportDSN (in the form of a data step that can be run to create it) that demonstrates the issue.

Cynthia_sas
SAS Super FREQ

Hi:

  @Tom is exactly correct. You are using an ESCAPECHAR defined character for both style overrides and for variable values. This will not work as you envision. Here's code that proves that the Character value for ESCAPECHAR cannot be the same as what you use in data values.

data fakedata;
  length text $50;
  infile datalines dlm=',' dsd;
  input roword text $;
datalines;
1,Some text with ~ (tilde)
2,Some text with # (pound)
3,Some text with ^ (caret)
;
run;

ods escapechar = '~';
ods rtf file='c:\temp\try_tilde.rtf';
proc report data=fakedata;
  define roword / order;
  define text / display '~{style[color=purple] The Text}';
  title '1) Escapechar is tilde ';
run;
ods rtf close;

ods escapechar = '#';
ods rtf file='c:\temp\try_pound.rtf';
proc report data=fakedata;
  define roword / order;
  define text / display '#{style[color=purple] The Text}';
  title '2) Escapechar is pound';
run;
ods rtf close;

ods escapechar = '^';
ods rtf file='c:\temp\try_caret.rtf';
proc report data=fakedata;
  define roword / order;
  define text / display '^{style[color=purple] The Text}';
  title '3) Escapechar is caret';
run;
ods rtf close;

If you run that code, you'll see that what is visible in the data can be impacted by the value you set for ODS ESCAPECHAR.

Cynthia

Amine_Khemiri
Obsidian | Level 7
Thanks a lot Cynthia ! The issue is resolved indeed.
Amine_Khemiri
Obsidian | Level 7
Thanks a lot Tom ! Indeed I was using ^ as the ODS escape character and when I changed it, it worked ok.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 562 views
  • 0 likes
  • 3 in conversation