DATA Step, Macro, Functions and more

Error in Function "kpropdata"

Reply
Occasional Contributor
Posts: 5

Error in Function "kpropdata"

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

Regular Contributor
Posts: 239

Re: Error in Function "kpropdata"

[ Edited ]

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

Occasional Contributor
Posts: 5

Re: Error in Function "kpropdata"

[ Edited ]

Thank you.

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

Occasional Contributor
Posts: 5

more examples

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;

Community Manager
Posts: 2,955

Re: more examples

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.

Ask a Question
Discussion stats
  • 4 replies
  • 249 views
  • 0 likes
  • 3 in conversation