07-31-2012 11:12 PM
You probably will have to provide an example. As you can see, with the following, you can always identify characters according to their actual byte value. A space would be a 32, while a null would be a zero. e.g.:
put "Now is the time";
put "The time was then";
do i=1 to length(_infile_);
08-01-2012 01:32 AM
if I enter the following code, :
IF FLDA = ' ' THEN FLDA = 'N' ;
SAS interprets this as ==> if flda is null then flda = 'N' what I want to do is put in a command so SAS interprets it as
if flda = space then flda = 'N'
08-05-2012 06:12 AM
In the SAS world a blank is treated as NULL. There is no specific NULL value and a character variable has also always a length of at least '1'.
For your requirement to work you would have to replace these "blanks" with 'N' before you map a SAS variable against it - or if you read the data from an external file you could determine the blanks by checking how much the pointer has moved for reading the next value as done in sample code below.
filename source temp;
put "Blank, ,it is";
put "NULL,,it is";
put "it is,blank, ";
put "it is,NULL,";
put " ";
put ", ";
put " ,";
infile source dsd truncover col=CurCol dlm=',';
input a:$10. @;
if _PrevCol+1>=CurCol then a='N';
input b:$10. @;
if _PrevCol+1>=CurCol then b='N';
input c:$10. ;
if _PrevCol+1>=CurCol then c='N';
08-05-2012 10:20 AM
SAS character variables are fixed length and padded on the right with spaces. So there is no concept of a NULL character variable.
If you are talking about testing input from a text file or a macro variable then you might be able to distinguish between a field with nothing in it versus a field with a space in it.