04-10-2015 04:42 AM
I have a problem importing a delimited text file into SAS. I get an error message about invalid string. I have seen that one sollution of this problem could be to change the session character encoding in SAS from wlatin1 to utf-8. I have tried to change the sasv9.cfg file line "-ENCODING wlatin1" to "-ENCODING utf-8", but this is not working. Infact nothing is working after that change, error message about connection failure to local server is given. How do I change the session character encoding?
Thank you for any help!
04-10-2015 05:01 AM
Since you could change the sasv9.cfg file, you have direct access to wherever the SAS system is installed. I recommend starting SAS from the commandline and watch what happens (error message(s)).
I suspect that you have SBCS SAS installed, which cannot handle utf-8. You will need to install DBCS SAS.
04-10-2015 08:28 AM
Most recent versions of SAS (desktop) are installing the SBCS and DBCS alongside. The only change using the correct entrypoint to start.
Check that as the old approach of changing config-files should be avoided to the minimum. Then sbcs start is pointing to an ..\en\.. naming and there should be one similar with an ..\u8\...
When that is not there only the SBCS has been installed and a reinstall with u8 is needed.
04-10-2015 09:14 AM
Be careful, in order to natively process SAS tables encoded in UTF-8 (or UTF-16), you need to use another sas launcher, which means another SAS engine & another character functions (KSCAN , KSUBSTR etc.).
Unfortunately, SAS Foundation is installed in dual mode ISO (default) and UTF (called DBCS). Starting with DBCS has strong implications further.
for instance, on Linux, the command line to lauch SAS DBCS with UTF-8 is the following :
$SASROOT/SASFoundation/9.2/bin/sas_u8 -encoding utf-8
Back to your problem, using a Unicode SAS session might be unnecessary. You can try, in your default SAS (ISO) session assigning your Filename with the option ENCODING=utf8.
SAS can transcode UTF to ISO (e g WLATIN1) at the import step and let you then code as usual. The target tables are then stored in ISO (WLATIN1), of course.
FILENAME myfile 'my pathname' ENCODING=utf8;