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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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