I am trying to import a .csv file which has the following format (first two observations)
PayeeID,Name,AreaID,RegionID,DistrictID,TerritoryID,TMRole,TMType,StartDate,EndDate
“0000100181”,"name",company name,30,321,3176,TM,TM,2018-01-01,2018-02-04
I use the following code to import:
proc import datafile = "C:\Users\conno\OneDrive\Desktop\DS 7900 - Data Science XLS Group\TEST.csv"
out = ds7900.data
DBMS = csv
replace;
run;
and the first column has some strange question mark symbols. For example, when printed to the results viewer:
�0000100181� |
�0000100181� |
I want to remove these. Please help!
This fixed it! Thank you. I just replaced the curly quotes, “ with straight quotes " and it removed the strange character.
You need to inquire how these curly quotes were created, they are not what should be used around values in csv files.
If you can't have it corrected at the source, you can change them by applying the translate() function on _infile_ before actually reading an observation:
input @;
_infile_ = translate(_infile_,'"','?');
input ........ ;
Replace the question mark with the curly quote you want replaced.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.