BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sasuser110
Calcite | Level 5

Hi, I am using SAS University Edition and trying to import an excel file that has a variable named "group" with two strata: "< 10" and "≥ 10". I am using the lifetest procedure to compare the survival times of these two strata. On my Kaplan Meier curve, I want the legend to show the stratification of "group"; however, instead of "<", it displays "&lt;". The "≥" sign displays fine. The default text coding is set at UTF-8.

 

Is there any way to change "&lt;" so it displays properly as "<"? My code is below:

 

PROC IMPORT DATAFILE="/folders/myfolders/file.xlsx"
OUT=WORK.file
DBMS=XLSX
REPLACE;
RUN;

 

proc lifetest data=file plots=survival;
time years*censor(0);
strata group;
run;

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

There was a recent thread saying that SAS had updated the XLSX engine to avoid this.

What version of SAS are you using?

 

You should be able to fix it by just replacing the character.

data file;
  set file ;
  array _c _character_ ;
  do over _c ;
    _c=transwrd(_c,'&lt;','<');
  end;
run;

Or perhaps use the HTMLDECODE() function instead to catch other potential values.

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

There was a recent thread saying that SAS had updated the XLSX engine to avoid this.

What version of SAS are you using?

 

You should be able to fix it by just replacing the character.

data file;
  set file ;
  array _c _character_ ;
  do over _c ;
    _c=transwrd(_c,'&lt;','<');
  end;
run;

Or perhaps use the HTMLDECODE() function instead to catch other potential values.

sasuser110
Calcite | Level 5

Thank you! Your code fixed the problem. Much appreciated.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 1126 views
  • 1 like
  • 2 in conversation