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!
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.
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?
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.
Thank you very much! I think I know how to resolve this problem!:smileylaugh:
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.
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.