BookmarkSubscribeRSS Feed
s100
Calcite | Level 5

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!

4 REPLIES 4
ballardw
Super User

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.


s100
Calcite | Level 5

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?

ballardw
Super User

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.

s100
Calcite | Level 5

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 6364 views
  • 3 likes
  • 2 in conversation