Learning SAS? Welcome to the exclusive online community for all SAS learners.

Question about ANYSPACE function in SAS UE

Accepted Solution Solved
Reply
PROC Star
Posts: 7,492
Accepted Solution

Question about ANYSPACE function in SAS UE

Today's sasCommunity.org tip was about the ANYSPACE function. However, running the code on SAS UE produced different results than those shown in the tip.

 

I then ran the following code:

 

data test; 
  do dec=0 to 255;
   byte=byte(dec);
   hex=put(dec, hex2.);
   anyspace=anyspace(byte);
   output;
 end;
run;
proc print data=test; run;

According to the documentation: "The ANYSPACE function searches a
character string for the first occurrence of a character that is
a blank, horizontal tab, vertical tab, carriage return, line feed,
or form feed.
"

Anyone know why the function only identifies the space character on UE?

Does one get the same result with all versions of 9.4 or 9.4 using SAS Studio?

TIA,
Art



Accepted Solutions
Solution
‎11-09-2015 12:02 PM
SAS Super FREQ
Posts: 709

Re: Question about ANYSPACE function in SAS UE

It has to do with the enconding that SAS is running. SAS UE is running with UTF8.

 

Have a look here Internationalization Compatibility for SAS String Functions.

 

ANYSPACE is a I18N Level 1 function. The doc states:

 

I18N Level 1
This function should be avoided, if possible, if you are processing DBCS or MBCS data. The I18N Level 1 functions might not work correctly with DBCS or MBCS encodings under certain circumstances.
 
Bruno

View solution in original post


All Replies
Solution
‎11-09-2015 12:02 PM
SAS Super FREQ
Posts: 709

Re: Question about ANYSPACE function in SAS UE

It has to do with the enconding that SAS is running. SAS UE is running with UTF8.

 

Have a look here Internationalization Compatibility for SAS String Functions.

 

ANYSPACE is a I18N Level 1 function. The doc states:

 

I18N Level 1
This function should be avoided, if possible, if you are processing DBCS or MBCS data. The I18N Level 1 functions might not work correctly with DBCS or MBCS encodings under certain circumstances.
 
Bruno
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 402 views
  • 1 like
  • 2 in conversation