Hi everyone - SAS newbie here. I have a question about reading in external files. I'm using the INFILE statement read in a pipe delimited file, and each column has varying widths. There are a few columns that also have missing values (which essentially means that that field looks like ||). Using the infile statement, I'm seeing that SAS is skipping over the empty field and not filling it in as null or empty, but reading from the next column. For example:
ABCDEFG||234234|456|FDSA
The missing column between the ABCDEFG and 234234 is filled in with the data from 234234, and the final column, FDSA, ends up with either garbage data in it or a "." . How can I handle this? All of the fields are of varying length, some of them longer some of them shorter than 8 characters.
Use the DSD option on the INFILE statement. This tells SAS to treated two delimiters (like ||) as representing a missing value.
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.