DATA Step, Macro, Functions and more

How to import unspecified format file to SAS EG?

Reply
Occasional Contributor
Posts: 11

How to import unspecified format file to SAS EG?

[ Edited ]

I have file with name as "NBB.YCOT010.MAY25" (semicolon as delimiter) which is output from mainframe,

Please help me how can load it to using code,

 

Note: If I load using Import wizard I can see file taken as below,

INFILE 'C:\Users\Temp\SEG8776\NBB.YCOT010-e5eca727229347ce9dab2e0cbd18c2ea.txt'

 

Super User
Super User
Posts: 7,932

Re: How to import unspecified format file to SAS EG?

No idea what your question is here. 

 

 

If you want to read a semi-colon delimited file you could try asking SAS to try to guess what is in it by using PROC IMPORT.

Or you could just write your own data step to read it.

 

But it also sounds like part of your problem is that you do not know how to find the file? If you want to reference it directly from your SAS code then the file needs to be available on the machine where SAS is running (is is most likely different than the machine you are using to run Enterprise Guide).

 

I assume that you are seeing a different name in the SAS log that what you initially said the filename was because you are using Enterprise Guide.  You might have pointed EG at a copy of the file on the PC where you are running EG and it uploaded a version of the file to the SAS server and ran a data step that EG wrote to read from the file that EG uploaded for you.  

 

 

PROC Star
Posts: 2,311

Re: How to import unspecified format file to SAS EG?

File > Import Data   then choose semicolon as the delimiter.

What's the problem?  Do you have packed decimal or other similarly unusual data to read?

Super User
Posts: 9,878

Re: How to import unspecified format file to SAS EG?

If you want to load such a file without the assistance of EG (eg because you want to run the code in batch mode), as a first step you have to make the file available to the context of the SAS session. In the case of a remote server, you either need to store the file to a shared location the server can "see", or upload it to the server with some kind of FTP process.

Then you need to write a data step that can read the file; with mainframe files, caution must be used with regards to numbers in packed decimal or binary format, or possible character set conversions (EBCDIC to ASCII).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 3 replies
  • 81 views
  • 0 likes
  • 4 in conversation