I tried to extract or read .dat file in SAS Studio using SAS code but data is not coming in proper format,
Below is the code i have used to read .dat files.
* Create a SAS data set named toads;
* Read the data file ToadJump.dat using list input;
DATA toads;
INFILE 'c:\MyRawData\ToadJump.dat';
INPUT ToadName $ Weight Jump1 Jump2 Jump3;
RUN;
* Print the data to make sure the file was read correctly;
PROC PRINT DATA = toads;
TITLE 'SAS Data Set Toads';
RUN;
But this doesn't seems to be perfect, can anyone help me with the solution?
Thanks in advance!
Hi, i got the answer to it but still thanks to all of you to reply on this.
The answer is in ToadJump.dat but we cannot see ToadJump.dat from way over here.
ToadJump.dat is a data set, and i want to read the data available in ToadJump.dat data set through SAS, so the result should display on SAS.
But it's not displaying proper result, may be i am missing something in SAS code. Can you help me with the proper SAS code ?
When you say ToadJump is a dataset, what application created that dataset. The file extension .dat doesn't actually mean anything, it just stands for data. This would be text data, delimited data e.g. csv, Oracle dump file, XML etc.
For instance, what happens if you right click -> open with -> Notepad
on the file? Does it show nice text data, if so then write a datastep import program.
If it shows weird characters and such like, then it is a binary file, these are generally proprietary for instance old Excel files were proprietary format and then you need the application which created it, or some in between software.
So where does the data come from?
This is text data
How is it not perfect?
What does your data look like?
Without knowing what the 'imperfections' are we can't help.
After executing i get this data, i have attached image of data please find.
Hi, i got the answer to it but still thanks to all of you to reply on this.
Looks like you could read the data, but perhaps it is not the types of numbers you expected?
You can just have the data step dump a few records of the source file to the log to see what it looks like.
DATA toads;
INFILE 'c:\MyRawData\ToadJump.dat';
INPUT ToadName $ Weight Jump1 Jump2 Jump3;
if _n_ <= 10 then list ;
RUN;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Ready to level-up your skills? Choose your own adventure.