Help using Base SAS procedures

Help! Import .asc file to SAS

Reply
Occasional Contributor
Posts: 11

Help! Import .asc file to SAS

Hello,

I received several .asc files, but do not know how to import/read them in sas. I tried to use the code listed below, but since I do not know what variables are in that file, I cannot use "input" statement to rename and define them.

data sasdat;

infile 'C:\XX\';

run;

Log shows:

NOTE: The infile 'C:\Core.asc' is:

      Filename=C:Core.asc,

      RECFM=V,LRECL=256,File Size (bytes)=4061484384,

   

NOTE: 0 records were read from the infile 'C:Core.asc'.

NOTE: The data set sasdat has 1 observations and 0 variables.

Any suggestions are appreciated! THANKS!

Super User
Posts: 10,500

Re: Help! Import .asc file to SAS

First step would be to open the file in a plain text reader such as Notepad. I suspect that ASC as a file suffix means it is ASCII  which should be plain text.

That may give you some clues.

If the file does not have an obvious delimiter such as comma or space, or less obvious such as a Tab character, you'll likely need to find a document that specifies what columns contain what data, which would be a good idea anyway.

You don't mention the source. If someone sent them they should provide a layout document. If downloaded from a website one would hope a description is available somewhere near where you found the data.


Occasional Contributor
Posts: 11

Re: Help! Import .asc file to SAS

I also tried to open it with Notepad, but it is too large that Notepad cannot open it.

Do you mean I cannot import the data file without using the input statement?

Super User
Posts: 10,500

Re: Help! Import .asc file to SAS

Another way to look at the file would be either to open in the SAS editor or use the FSLIST command.

You'll need an input statement if trying to read with a datastep. If the file is a delimited text file Proc Import would likely read it but you need to know the delimiter. If it isn't delimited your pretty much going to have to write an input statement at some time.

Occasional Contributor
Posts: 11

Re: Help! Import .asc file to SAS

Thank you very much! I think I know how to resolve this problem!:smileylaugh:

Ask a Question
Discussion stats
  • 4 replies
  • 1686 views
  • 3 likes
  • 2 in conversation