BookmarkSubscribeRSS Feed
4john
Calcite | Level 5
Can any one please suggest a way to convert multiple(>25) flat files in PC format to Unix format in SAS?

Thanks
7 REPLIES 7
Cynthia_sas
SAS Super FREQ
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
4john
Calcite | Level 5
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.
Doc_Duke
Rhodochrosite | Level 12
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
4john
Calcite | Level 5
Is there a way to do it using call system or %sysexec ?
Doc_Duke
Rhodochrosite | Level 12
sure. Just code it like any other X-type command.
andreas_lds
Jade | Level 19
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.
4john
Calcite | Level 5
Thanks Andreas.

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2836 views
  • 0 likes
  • 4 in conversation