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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 2243 views
  • 0 likes
  • 4 in conversation