Help using Base SAS procedures

infile with varying columns lengths and missing values

Reply
N/A
Posts: 1

infile with varying columns lengths and missing values

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.

Super User
Super User
Posts: 7,039

infile with varying columns lengths and missing values

Use the DSD option on the INFILE statement. This tells SAS to treated two delimiters (like ||) as representing a missing value.

Ask a Question
Discussion stats
  • 1 reply
  • 127 views
  • 0 likes
  • 2 in conversation