DATA Step, Macro, Functions and more

convert flat files in PC format to Unix format

Reply
Occasional Contributor
Posts: 16

convert flat files in PC format to Unix format

Can any one please suggest a way to convert multiple(>25) flat files in PC format to Unix format in SAS?

Thanks
SAS Super FREQ
Posts: 8,743

Re: convert flat files in PC format to Unix format

HI:
I'm confused, ASCII text files are ASCII text files. Both the PC and UNIX use ASCII. Can you elaborate a bit on how you expect the format to differ between PC format and Unix format?

Whenever I FTP my ASCII flat files from the PC to Unix, or vice versa, I don't need to do anything to convert them....hence my confusion.

cynthia
Occasional Contributor
Posts: 16

Re: convert flat files in PC format to Unix format

all the .csv files are created on a PC and all have ANSI format.So before I read them into Unix SAS,I need to convert them into Unix format.Else,last variable is not getting populated properly.
Trusted Advisor
Posts: 2,113

Re: convert flat files in PC format to Unix format

The PC ASCII format uses a different end-of-line marker () from that used in Unix ASCII (). This can cause some headaches. FTP knows about this difference.

There are programs that can do the conversion and run as batch files or unix scripts. They are called dos2unix (there is also a unix2dos) and exist for both the PC and unix platforms.

Doc Muhlbaier
Duke
Occasional Contributor
Posts: 16

Re: convert flat files in PC format to Unix format

Is there a way to do it using call system or %sysexec ?
Trusted Advisor
Posts: 2,113

Re: convert flat files in PC format to Unix format

sure. Just code it like any other X-type command.
Super Contributor
Posts: 259

Re: convert flat files in PC format to Unix format

Why do you want to convert the files? Importing the text-file by using the infile-statements' termstr-option set to crlf works like charm.
Occasional Contributor
Posts: 16

Re: convert flat files in PC format to Unix format

Thanks Andreas.
Ask a Question
Discussion stats
  • 7 replies
  • 669 views
  • 0 likes
  • 4 in conversation