Hello SAS Community!
I'm having an issue importing a csv file with data from different sites around the world. If I don't set the encoding file to UTF-8 then my log is clean but the variable with the site name imports incorrectly. When I set encoding to UTF-8 my site names look good, but the investigator name causes a WARNING to my log, which gets caught in my companies log checker. I'm supposed to produce a clean log. I created a sample csv file with 3 rows and 3 variables of data.
In my sample csv file it's the data in TestField1 that is causing the warning, and the variable TestField2 contains the site names that I need to be imported correctly.
Reading file without UTF-8...
proc import file="U:\sas\encoding_test.csv"
out=csv_1
dbms=csv
replace;
GUESSINGROWS = MAX;
run;
results in a dataset that looks like this...
Importing it with encoding set to UTF-8...
filename fname "U:\sas\encoding_test.csv" encoding="utf-8" ;
proc import file=fname
out=csv_2
dbms=csv
replace;
GUESSINGROWS = MAX;
run;
Results in a data set that looks like this (correct TextField2, TextField1 is still not quite correct)...
The warning in the log looks like this:
TextField1 is a variable I don't use, so I'm not worried about it being read in correctly, I would just like a clean log. I've attached my sample csv file (and this screenshot).
Any suggestions are appreciated.
Thank you
If you are using UTF-8 encoding SAS, that would not be a problem.
Thanks for the reply. I am choosing my companies "Unicode Support" SAS session...
I'll check with my IT department and ask them to check the SAS install since it doesn't appear to be working properly.
Thanks again
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!
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.
Ready to level-up your skills? Choose your own adventure.