SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to differentiate between blank space character & null value while reading from a file.

Reply
Occasional Contributor
Posts: 9

How to differentiate between blank space character & null value while reading from a file.

SAS treats Blank space as missing values . In order to distinguish between blank space character and null value while reading from job how to manage it.

Super User
Posts: 5,257

Re: How to differentiate between blank space character & null value while reading from a file.

You said it yourself, SAS treats blank as missing/null, so basically, you can't (since there is no difference).

If your source data resides in a DBMS that distinguish between NULL and blank, you coud do a SQL pass-thru query where you test this in the source.

What's your issue?

Data never sleeps
Occasional Contributor
Posts: 9

Re: How to differentiate between blank space character & null value while reading from a file.

no my source is a fixed width file

Super User
Super User
Posts: 6,502

Re: How to differentiate between blank space character & null value while reading from a file.

So if you have a fixed width file how would it be possible to have an empty field?  To make it fixed width there has to be some character in those columns of the file.

If you use $CHAR informat instead of the default $ informat for character variables then periods in the source file will not be translated to blanks.

data want;

   input id 3. sex $char1. age 3. ;

cards;

001M010

002F012

003.011

004 013

;;;

Super User
Posts: 10,506

Re: How to differentiate between blank space character & null value while reading from a file.

File format is important here and how the data set is read. When using list input blanks are delimiters and options control what may or may not be missing.

Is your data delimited or fixed column?

How are you reading it?

It may be helpful to provide some example rows of data with the issue you are having.

Some common options that address bits of this kind of issue are DLM (or Delimiter) , DSD, RECFM plus options on Input statements.

Occasional Contributor
Posts: 9

Re: How to differentiate between blank space character & null value while reading from a file.

the source is a fixed width file.

Ask a Question
Discussion stats
  • 5 replies
  • 589 views
  • 3 likes
  • 4 in conversation