Hi,
I have a table that contains only alphanumerical values. The column Info1 contains value that are blank (empty).
I usually use the following procedure to count null values in a table, but for this table the result returned is 0, but I see that some values are blank.
proc sql;
select count(Info1) as i from table1
where Info1 is null
;quit;
I also tried this but it also return 0 :
proc sql;
select count(Info1) as i from table1
where Info1=''
;quit;
What am I doing wrong?
Thank you for your help.
COUNT(info1) counts non-missing info1 values. Use COUNT(*) instead. - PG
COUNT(info1) counts non-missing info1 values. Use COUNT(*) instead. - PG
PG is dead on this. Count() has tricked me when I first started using Proc SQL. In comparison, sum() is more predictable.
proc sql;
select sum(missing(Info1)) as i from table1
;quit;
Haikuo
Thank you both for this precision.
Regards.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.