BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Eileen1496
Obsidian | Level 7

Hi all,

 

I got a 4gb SAS dataset with company information. The company name column is very important to me. However, I found though most of the observations are in normal format, e.g. "Birly Co", there are many rows has values like "ÃÂ". Do you know if this is a problem in the original dataset that I cannot solve as a data user, or it is a problem of encoding on my computer?  

I actually tried encoding it to utf-8 or utf-16le, utf-16be in python, but still I got such weird characters.

 

Thank you!

1 ACCEPTED SOLUTION
8 REPLIES 8
Eileen1496
Obsidian | Level 7
Hi Kurt, what do you mean by "session encoding"? I tried utf-8, utf-16le,
utf-16be in python. In sas I just open the file directly because it is
originally in sas7bdat format. And it also shows the abnormal chars.
Eileen1496
Obsidian | Level 7

Hi Kurt! It return the following to me:

SAS (r) Proprietary Software Release 9.4 TS1M6

Option Value Information For SAS Option ENCODING
Value: WLATIN1
Scope: SAS Session
How option value set: Config File
Config file name:
C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg

 

Should I change anything so this problem can be fixed?

 

Eileen1496
Obsidian | Level 7

Dear Kurt, thanks for pointing out the problem! I would never realize that alone probably, I will talk with them.

Eileen1496
Obsidian | Level 7

Dear Kurt, thanks for pointing out the problem! I would never realize that alone probably, I will talk with them.

GPatel
Pyrite | Level 9

You can try :

Suppose your abnormal characters in SAS file is in "Comments" column/field. 

Use code below to remove/replace weird/abnormal characters.

 

Comments=KCVT(compress(Comments,,'kw'), 'wlatin1', 'UTF-8');
or

Comments =compress(Comments, , 'kw');

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 8 replies
  • 1714 views
  • 0 likes
  • 3 in conversation