BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
marmst10
Calcite | Level 5

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:

 

Obs PayeeID12
�0000100181�

�0000100181�

 

 I want to remove these. Please help!

1 ACCEPTED SOLUTION

Accepted Solutions
JosvanderVelden
SAS Super FREQ
Probably because of the curly quotes of the first item cause the strange character. The straight quotes of the second item don't result in a strange character. Or do they?

View solution in original post

4 REPLIES 4
JosvanderVelden
SAS Super FREQ
Probably because of the curly quotes of the first item cause the strange character. The straight quotes of the second item don't result in a strange character. Or do they?
marmst10
Calcite | Level 5

This fixed it! Thank you. I just replaced the curly quotes, “ with straight quotes " and it removed the strange character.

Reeza
Super User
You may have a different encoding on the file. Can you check what the encoding is of the file? This usually happens when you have files that have moved across OS (Unix to Windows) or working in different countries where a different encoding is standards...or manually fixing data and introducing 'smart quotes' (Google that) rather than traditional quotes. The smart quotes usually means the data was in Excel or Word at some point though the browser can also introduce those and mess up the text.
Kurt_Bremser
Super User

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.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 4 replies
  • 2704 views
  • 6 likes
  • 4 in conversation