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.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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