BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nicnad
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

COUNT(info1) counts non-missing info1 values. Use COUNT(*) instead. - PG

PG

View solution in original post

3 REPLIES 3
PGStats
Opal | Level 21

COUNT(info1) counts non-missing info1 values. Use COUNT(*) instead. - PG

PG
Haikuo
Onyx | Level 15

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

nicnad
Fluorite | Level 6

Thank you both for this precision.

Regards.

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!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2247 views
  • 3 likes
  • 3 in conversation