0
votes

I was given a list of files that need to be imported into SAS, however I am struggling to import them correctly. The files are formatted as such:

There is one "Header File" that contains a few lines of metadata followed by:

RECORD 1 Header column 1 Header column 2 Header column 3 Header column 4

Record 2 Header column 1 Header column 2 Header column 3 Header column 4 Header column 5 Header column 6 . . .

RECORD 3 . . .

And then "data files" which contain no meta data (that I am aware of) and are simply column ("|") delineated.

I was told these files were generated using SAS and I believed them to be a library, however:

Proc CIMPORT data="C..." did not work.

I can import them individually using

Proc Import data="";

DBMS=DLM;

Run;

I asked this question earlier to no avail, I included more information this time. I feel like this is something that is really easy that I am just missing somehow. Thank you very much in advance.

1
How is the first file formatted? Is it also pipe delimited, because it does not look that way in your question. How do you relate a row in the first file to a specific one of the pipe delimited data files? Are the files numbered? Does the first file include the filename somewhere?Tom
PROC CIMPORT is for reading files generated by PROC CPORT. It does not read plain text files.Tom

1 Answers

0
votes

You can use PROC IMPORT to read the pipe delimited files. Use the getnames=no; statement to tell it to generate its own names. You can then use the metadata from the first file to generate RENAME statements to change the names.

PROC CIMPORT is for reading transport files generated by PROC CPORT.

For a more complete example with code please post some actual examples of the data files, especially the one with the metadata. If the metadata is complete then you could probably skip the PROC IMPORT and just use the metadata to directly write data steps to read the data files.