Hi,
I am trying to read a .dat file into SAS. Have done this before using the DATA step, but for some reason, it am unable to read this particular file. Opened it with a text file, and the data looks like a tab-delimited, so tried using PROC IMPORT. That didn't work either. Attaching a screenshot of the data file.
Data screen shot:
DATA step code snippet:
data tv.alco; infile "/folders/myfolders/Trial/alcohol.dat" firstobs= 22; input Region $ Alcohol Tobacco ; run;
PROC IMPORT snippet:
proc import datafile="/folders/myfolders/Trial/alcohol.dat" out = tv.alco dbms=dlm replace ; delimiter= '09'x ;startrow=22; run;
Any help is appreciated 🙂
Thanks! That worked. Also got to learn about the DSD option.
The log in case of the DATA step is below. Basically a bunch of invalid reads from the file.
The Notepad++ screenshot with all the hidden characters:
Thanks for your help! 🙂
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.