BookmarkSubscribeRSS Feed
Eccentric
Calcite | Level 5
I need some help reading a flat file which consists of a "garbabe character" in few observations.
Basically I get a text file which I ftp to a unix server. Once the file gets to the server, i use dos2unix command to change it to a unix file and then read the file with infile statement.

The flat file(testfile) before dos2unix looks like.Notice the "?" characters.

31?PHR
?PARKWAY
?PT0
DE?T
L?PHD
L?PHD
S?PT
?PO

Once i use dos2unix command the file looks as this:

31ìPHR
ìPARKWAY
ìPT0
DEìT
LìPHD
LìPHD
SìPT
ìPO

And when i read this file and create a dataset, the dataset looks as follows(same as what is seen after the intial file is converted to a unix file).

Obs name

1 31ìPHR
2 ìPARKWAY
3 ìPT0
4 DEìT
5 LìPHD
6 LìPHD
7 SìPT
8 ìPO

Here is my code for your reviewal:

filename ttt '/data/eccentric/testfilea.txt';

x dos2unix /data/eccentric/testfile /data/eccentric/testfilea.txt;

data one;
infile ttt;
input name $;
run;
proc print data=one;
run;

I was hoping when i convert the file to a unix file those special characters would disappear but it did not happen. Is there any way to delete the observation if it contains these types of garbage characters? Or is there anyway to take care of this issue?

Any help would be greatly appreciated.
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi,
This is not really an ODS question -- it is more of a DATA step/INFILE/Operating System question. Your best bet for a quick response to questions like this is to contact Tech Support. It is possible that this is not really garbage data, but is related to DBCS (double byte character set) characters or NLS encoding issues -- which is something that Tech Support is best equipped to handle.

To find out how to contact Tech Support, refer to:
http://support.sas.com/techsup/contact/index.html

Good luck,
cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 600 views
  • 0 likes
  • 2 in conversation