The SAS Output Delivery System and reporting techniques

Gargabe Character in Flat file: Please Help

Reply
N/A
Posts: 1

Gargabe Character in Flat file: Please Help

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.
SAS Super FREQ
Posts: 8,866

Re: Gargabe Character in Flat file: Please Help

Posted in reply to Eccentric
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
Ask a Question
Discussion stats
  • 1 reply
  • 107 views
  • 0 likes
  • 2 in conversation