BookmarkSubscribeRSS Feed
Aasth
Quartz | Level 8

Hi,

 

I am using the following query to filter out columns where NPI value is not missing :

 

PROC SQL;

   CREATE TABLE WORK.QUERY_FOR_PROV_000A AS

   SELECT DISTINCT t1.NPI,

          /* COUNT_of_NPI */

            (COUNT(t1.NPI)) AS COUNT_of_NPI

      FROM IDSEDWP.PROV t1

      WHERE t1.NPI NOT IS MISSING AND t1.PLAN_ID = '020'

      GROUP BY t1.NPI

      ORDER BY t1.NPI;

QUIT;

 

But i am getting the following result:

 

NPI                         COUNT_of_NPI

                                50656

0987654321         1

1003000274         2

1003000506         1

1003001553         1

1003002106         1

1003002262         1

1003002510         1

1003002700         1

1003003310         1

1003003625         2

1003003773         1

1003004284         3

1003004375         1

1003005125         1

1003005687         1

1003005752         1

1003006040         1

1003006065         1

1003006180         4

1003007840         1

 

Why am I still seeing the NPI columns count where the data is missing? Is there something I am doing wrong here?

 

Thanks,

Aastha

2 REPLIES 2
Reeza
Super User
t1.NPI NOT IS MISSING

 

should be:

 

not missing(t1.NPI) 

@Aasth wrote:

Hi,

 

I am using the following query to filter out columns where NPI value is not missing :

 

PROC SQL;

   CREATE TABLE WORK.QUERY_FOR_PROV_000A AS

   SELECT DISTINCT t1.NPI,

          /* COUNT_of_NPI */

            (COUNT(t1.NPI)) AS COUNT_of_NPI

      FROM IDSEDWP.PROV t1

      WHERE t1.NPI NOT IS MISSING AND t1.PLAN_ID = '020'

      GROUP BY t1.NPI

      ORDER BY t1.NPI;

QUIT;

 

But i am getting the following result:

 

NPI                         COUNT_of_NPI

                                50656

0987654321         1

1003000274         2

1003000506         1

1003001553         1

1003002106         1

1003002262         1

1003002510         1

1003002700         1

1003003310         1

1003003625         2

1003003773         1

1003004284         3

1003004375         1

1003005125         1

1003005687         1

1003005752         1

1003006040         1

1003006065         1

1003006180         4

1003007840         1

 

Why am I still seeing the NPI columns count where the data is missing? Is there something I am doing wrong here?

 

Thanks,

Aastha




Tom
Super User Tom
Super User

"NOT IS MISSING" seems like a strange syntax, but it looks like PROC SQL is able to interpret it as meaning the same thing as  "IS NOT MISSING" or "NOT (... IS MISSING)".

 

If your variable numeric or character?  If numeric do you have a format attached to it that is showing some values as blanks?
If it is character then perhaps the value has some other non-blank character that look like blanks in the output.  Like 'A0'X or tab or line feed or carriage return.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 4158 views
  • 0 likes
  • 3 in conversation