BookmarkSubscribeRSS Feed
upadhi
Quartz | Level 8

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.

5 REPLIES 5
LinusH
Tourmaline | Level 20

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
Tom
Super User Tom
Super User

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

;;;

ballardw
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 3989 views
  • 3 likes
  • 4 in conversation