BookmarkSubscribeRSS Feed
mmohotsi
Obsidian | Level 7

I have a table win which one of the cells has an entry (mg/L as SO4). How do I express the 4 in the cell entry as a subscript with the PRC REPORT Statement. See attached file. I tried the code below but it does not get me the right information

 
Libname tested 'C:\Users\Test_LIBR';
ods pdf file="&tested\Filename.pdf";
ods escapechar="^";
DATA test2;
SET test;
format United $35.;Informat United $35.;
Format Position $4.;
Position = Index(Units,'4)');
If Position gt 0 Then United = Trim(Substr(Units,1,Position-1)||'^{Sub 4}')||')';
Else United = Units;
run;
Proc report data = work.test2;
Column Determinand_Grouping Determinand United units;
define Determinand_Grouping / group order = data noprint;
Define Determinand / style(column)=[fontstyle=italic];
Define Units / style(column)=[fontstyle=italic];
run;
ods _all_ close;

 

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

What "does not work"? You have posted code which creates a PDF file, and yet your example output is Excel? The escapechar and sub works fine using PDF destination output (note I can only paste text at the mo):

---

ods pdf file="s:\temp\rob\test.pdf";

data temp;

  a="abc ^{sub 4}";

run;

 

ods escapechar="^";

 

proc report data=temp nowd;

 columns a;

run;

ods pdf close;

---

Works fine. Also please note how formatting of the code is very important to reading, mixed case and no indetation makes reading code so much harder.

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
  • 1 reply
  • 3041 views
  • 0 likes
  • 2 in conversation