BookmarkSubscribeRSS Feed
tsjwolf
Fluorite | Level 6

Guten Tag.

Können Sie mir helfen ?

Warum in SAS Code unten  wir bekommen

„str_out=T\u0fcbingen Tü-bingen Baden-Württemberg“

und nicht

„str_out=Tübingen Tü-bingen Baden-Württemberg“ ?

 

 

data tmp;

str_inp='T\u00FCbingen T\u00FC-bingen Baden-W\u00FCrttemberg';

str_out =  kpropdata(str_inp,"UESC", "ASCII", "wlatin1") ;

put /str_inp= /str_out= /str_inp= $hex120. /str_out= $hex120. ;

run;

 

 

49         data tmp;

50         str_inp='T\u00FCbingen T\u00FC-bingen Baden-W\u00FCrttemberg';

51         str_out =  kpropdata(str_inp,"UESC", "ASCII", "wlatin1") ;

52         put /str_inp= /str_out= /str_inp= $hex120. /str_out= $hex120. ;

53         run;

 

 

str_inp=T\u00FCbingen T\u00FC-bingen Baden-W\u00FCrttemberg

str_out=T\u0fcbingen Tü-bingen Baden-Württemberg

str_inp=545C753030464362696E67656E20545C75303046432D62696E67656E20426164656E2D575C7530304643727474656D62657267

str_out=545C7530666362696E67656E2054FC2D62696E67656E20426164656E2D57FC727474656D626572672020202020202020202020202020202020202020

4 REPLIES 4
gamotte
Rhodochrosite | Level 12

Hello,

 

More people will be able to answer your question if you write in english.

I translate it here for you (in my bad english).

 

"Why in the given SAS code we obtain

str_out=T\u0fcbingen Tü-bingen Baden-Württemberg

instead of

str_out=Tübingen Tü-bingen Baden-Württemberg ?"

 

Your code works on my computer (SAS 9.4, windows 7) :

 

1    data tmp;
2    str_inp='T\u00FCbingen T\u00FC-bingen Baden-W\u00FCrttemberg';
3    str_out =  kpropdata(str_inp,"UESC", "ASCII", "wlatin1") ;
4    put /str_inp= /str_out= /str_inp= $hex120. /str_out= $hex120. ;
5    run;


str_inp=T\u00FCbingen T\u00FC-bingen Baden-W\u00FCrttemberg
str_out=Tübingen Tü-bingen Baden-Württemberg
str_inp=545C753030464362696E67656E20545C75303046432D62696E67656E20426164656E2D575C7530304643727474
656D62657267
str_out=54FC62696E67656E2054FC2D62696E67656E20426164656E2D57FC727474656D62657267202020202020202020
202020202020202020202020202020
NOTE: The data set WORK.TMP has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           2.20 seconds
      cpu time            0.01 seconds

tsjwolf
Fluorite | Level 6

Thank you.

It is interesting, why code works on my computer wrong...

tsjwolf
Fluorite | Level 6

data tmp2;
format str_inp str_out $50.;
str_inp='äöüßÄÖÜ';
*in Unicode;
str_out = kpropdata(str_inp,"UESC", "wlatin1", "ASCII") ;
put /str_inp= /str_out= /str_inp= $hex10.  /str_out= $hex10. ;
*from Unicode;
str_inp2 = UPCASE(str_out);
str_out2= kpropdata(str_inp2,"UESC", "ASCII", "wlatin1") ;
put /str_inp2= /str_out2= /str_inp2= $hex10. /str_out2= $hex10.;
str_inp3 = LOWCASE(str_out);
str_out3= kpropdata(str_inp3,"UESC", "ASCII", "wlatin1") ;
put /str_inp3= /str_out3= /str_inp3= $hex10. /str_out3= $hex10.;
str_inp4 = TRANWRD(UPCASE(str_out), '\U', '\u');
str_out4= kpropdata(str_inp3,"UESC", "ASCII", "wlatin1") ;
put /str_inp4= /str_out4= /str_inp4= $hex10. /str_out4= $hex10.;
run;

/*+b*/
data tmp3;
format str_inp str_out $50.;
str_inp='äböbübßbÄbÖbÜb';
*in Unicode;
str_out = kpropdata(str_inp,"UESC", "wlatin1", "ASCII") ;
put /str_inp= /str_out= /str_inp= $hex10.  /str_out= $hex10. ;
*from Unicode;
str_inp2 = UPCASE(str_out);
str_out2= kpropdata(str_inp2,"UESC", "ASCII", "wlatin1") ;
put /str_inp2= /str_out2= /str_inp2= $hex10. /str_out2= $hex10.;
str_inp3 = LOWCASE(str_out);
str_out3= kpropdata(str_inp3,"UESC", "ASCII", "wlatin1") ;
put /str_inp3= /str_out3= /str_inp3= $hex10. /str_out3= $hex10.;
str_inp4 = TRANWRD(UPCASE(str_out), '\U', '\u');
str_out4= kpropdata(str_inp3,"UESC", "ASCII", "wlatin1") ;
put /str_inp4= /str_out4= /str_inp4= $hex10. /str_out4= $hex10.;
run;

/*+tb*/
data tmp4;
format str_inp str_out $70.;
str_inp='ätbötbütbßtbÄtbÖtbÜtb';
*in Unicode;
*broke all;
str_out = kpropdata(str_inp,"UESC", "wlatin1", "ASCII") ;
put /str_inp= /str_out= /str_inp= $hex10.  /str_out= $hex10. ;
run;

ChrisHemedinger
Community Manager

A new hot fix is available that addresses a problem with KPROPDATA. Here's a link to the hot fix bulletin, and the SAS Note that describes the problem.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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