Hi all,
I am wondering what does Null stand for? Does it can be used to replace missing in both character and numeric data.
The background is that, the missing variable in character column is represented as " " while it is "." in numeric column.
What I mean is, for the example above, whether we can wrote ?
where Age =null;
/*or*/
where Name = null;
Thank you!
@ResoluteCarbon wrote:
Hi all,
I am wondering what does Null stand for? Does it can be used to replace missing in both character and numeric data.
The background is that, the missing variable in character column is represented as " " while it is "." in numeric column.
What I mean is, for the example above, whether we can wrote ?
where Age =null; /*or*/ where Name = null;
Thank you!
NULL does NOT mean missing - it means a variable named "null".
Try
where missing(varname);
The MISSING function works on both numeric and character variables.
The keyword NULL has meaning in SQL. It can be used to replace either numeric missing (the period) or all blank character string you would normally use in regular SAS code.
Because SAS consolidated the code/logic used to evaluate WHERE statements with the way they process SQL code you can use it in WHERE statements outside of PROC SQL.
522 data x; 523 set sashelp.class; 524 where age is null; 525 run; NOTE: There were 0 observations read from the data set SASHELP.CLASS. WHERE age is null; NOTE: The data set WORK.X has 0 observations and 5 variables.
But if you use the string NULL in regular SAS statement it is just a reference to a variable with that name.
530 data z; 531 set sashelp.class; 532 if age = null ; 533 run; NOTE: Variable null is uninitialized.
@ResoluteCarbon wrote:
Hi all,
I am wondering what does Null stand for? Does it can be used to replace missing in both character and numeric data.
The background is that, the missing variable in character column is represented as " " while it is "." in numeric column.
What I mean is, for the example above, whether we can wrote ?
where Age =null; /*or*/ where Name = null;
Thank you!
NULL does NOT mean missing - it means a variable named "null".
Try
where missing(varname);
The MISSING function works on both numeric and character variables.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.