BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

I was trying to see how UNICODEC() converted some UTF-8 characters into strings that I could transmit with 7-bit ASCII.

When I looked at my PROC FREQ output in SAS Studio the version generated with the 'PAREN' style was gone or invisible.

Screenshot 2022-03-10 235009.jpg

But when I sent the same text to RTF, PDF, LISTING or LOG it is is visible.

 The FREQ Procedure
                                                                        Cumulative    Cumulative
 __hex__    __paren__    __esc__    __ncr__    Frequency     Percent     Frequency      Percent
 -----------------------------------------------------------------------------------------------
 E28099     <u2019>      \u2019     &#8217;           4       50.00             4        50.00  
 E289A4     <u2264>      \u2264     &#8804;           1       12.50             5        62.50  
 E289A5     <u2265>      \u2265     &#8805;           3       37.50             8       100.00  

So why is the output window not showing the <u2019> strings?

Is it because it thinks they are some type of HTML tag?  If so why?

 

Does this mean that any character string I try to print might be missing some characters if they just happen to have a < and > in that order?

 

Perhaps it is just the PROC FREQ output?
This code does not have the issue with the HTML output window that SAS/Studio uses.

data test5;
  file print;
  length char paren $10 ;
  do char='E28099'x,'E289A4'x,'E289A5'x ;
     paren=unicodec(char,'paren');
     put char= paren= ;
  end;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Yes. They are HTML tag . If you want display them , you need a special STYLE .

 

data have;
input (__hex__    __paren__    __esc__    __ncr__ ) (: $80.);
cards4;
 E28099     <u2019>      \u2019     &#8217;   
 E289A4     <u2264>      \u2264     &#8804;    
 E289A5     <u2265>      \u2265     &#8805; 
;;;;


proc report data=have nowd style(column)={protectspecialchars=yes} ;
run;

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

HTML tags are enclosed in angular brackets. Browsers treat strings like yours as "a tag I do not understand" and discard them. This is a safety measure so that older browsers don't stumble over later tags.

HTML compatible output should use &lt; and &gt; instead of the brackets.

Ksharp
Super User

Yes. They are HTML tag . If you want display them , you need a special STYLE .

 

data have;
input (__hex__    __paren__    __esc__    __ncr__ ) (: $80.);
cards4;
 E28099     <u2019>      \u2019     &#8217;   
 E289A4     <u2264>      \u2264     &#8804;    
 E289A5     <u2265>      \u2265     &#8805; 
;;;;


proc report data=have nowd style(column)={protectspecialchars=yes} ;
run;

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
  • 2 replies
  • 234 views
  • 0 likes
  • 3 in conversation