SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
seamoh
Obsidian | Level 7

Hello all  of my friend , hope all of you are very well. I have a dataset contained German alphabets  in Customer Name column. special German alphabet is distorted in dataset and all the reports and list taken from that.(as you see in the screen shot below). I use sas studio university edition.

I am looking forward your answers..

Thank you and deeply appreciated.

seamoh_0-1591751050070.png

 

 

12 REPLIES 12
smantha
Lapis Lazuli | Level 10
There are two ways to go about this
1. Change Sas encoding option so that it supports non native characters
2. Try using varchar instead of string for column informats and formats
ChrisNZ
Tourmaline | Level 20

SAS UE uses UTF-8 encoding.

It looks like your data set uses sometime else.

1. Do you have any messages in the log?

2. Run proc contents and report.

seamoh
Obsidian | Level 7

Hello and thank you very much for your reply. I have just SAS university edition.

 

Thank you again.

ChrisNZ
Tourmaline | Level 20
seamoh
Obsidian | Level 7

Hello and thank you very much for your answer, yes the German alphabets are distorted in SAS studio tab too.

 

Thank you very much

DavePrinsloo
Pyrite | Level 9

This has happened to me, when I got data that had been previously transferred incorrectly between Latin and UTF8.

The following code fixed it for me.   


/* adjust the following to add all corrupted German char variables */
%let vars_with_corrupted_chars=name address ;

data corrected;
set has_incorrect_german_chars;
array __array_char_vars $ &vars_with_corrupted_chars.;

   /* following code using explicit special characters is a LOT faster than the 
   equivalent code below using hex values */
   __array_char_vars = prxchange('s/Ä/Ä/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/ä/ä/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/€Ã/ä/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/Ö/Ö/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/ö/ö/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/ü/ü/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/Ü/Ü/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/ÃŒ/ü/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/ß/ß/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/é/É/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/²/2/',-1,__array_char_vars);
   __array_char_vars = prxchange('s/³/3/',-1,__array_char_vars);
   __array_char_vars = prxchange("s/´/'/",-1,__array_char_vars);
run;
seamoh
Obsidian | Level 7

Hi and thank you very much for your reply

 

Where should I insert the codes?

 

Thank you again

 

DavePrinsloo
Pyrite | Level 9
Run the conversion program once now, and every time immediately after importing / reading from the source table
DavePrinsloo
Pyrite | Level 9
did this work?

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 12 replies
  • 2772 views
  • 0 likes
  • 5 in conversation