BookmarkSubscribeRSS Feed
ari1981
Calcite | Level 5

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.

1 REPLY 1
Tom
Super User Tom
Super User

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 707 views
  • 0 likes
  • 2 in conversation