How can we distinguish a " " (blank) value with a null (missing) value for a character variable. Suppose I have a field in my input file with a field that can accept blank as a valid value:
Name (length = 20), At 25 Salary, Flag, Date of Birth (DDMntYY format),
Joe Williams, 70000, ,17Apr80
David Coleman, 91000,Y,29Nov70
Terrin Larson, 65000,F,01Jan00
Mathew Richardson, 85000,,02May78
There are number of missing values in this file. The last record has a missing value for the field "Flag", but the first record has a " " (blank) and valid value for this field. How can one read this file and capture the missing value distinguished from " " value?
I tried the below code for handling the subsequent ",". But don`t know how to know that the first record has a valid " " value for flag and the last record does not.
infile EmpFile dlm=',' firstobs=3 MissOver DSD;
length name $ 20.;
input name salary flag $ DoB Date7.;
Thanks in advance for your taking time on this question.
I see your point. But if you want to store your flag as a character value, SAS does NOT distinguish between blank an MISSING/NULL, it's the same. In this case, would you consider to store any other value for your valid blank data?
If so, consider to read your whole record into one long string, and then use SAS character functions to find out if there is a blank or not between your delimeters.