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

Please can someone tell me how I can exclude the missing row from my proc sql table? The code that I have got is as follows, so the output should only show the names (and no blank row in the output).

 

proc sql;
        create table Records as 
        select distinct Name
                from Test
                where "01May2021"d<=MONTH<="31May2021"d
        except
        select distinct Name
                from Test
                where "01Apr2021"d<=MONTH<="30Apr2021"d
       ;
quit;
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
proc sql;
        create table Records as 
        select distinct Name
                from Test
                where "01May2021"d<=MONTH<="31May2021"d and not missing(name)
        except
        select distinct Name
                from Test
                where "01Apr2021"d<=MONTH<="30Apr2021"d 
       ;
quit;
--
Paige Miller

View solution in original post

3 REPLIES 3
SASKiwi
PROC Star

You need to explain what you mean by "blank" or "missing" row. What defines such a row?

Justin9
Obsidian | Level 7

My output, 'Records' (see code above) gives the following, so it's row 1 in my example that I would like to exclude (i.e. I only want the distinct Name values to be in the output).

 

Justin9_0-1624829880393.png

 

 

PaigeMiller
Diamond | Level 26
proc sql;
        create table Records as 
        select distinct Name
                from Test
                where "01May2021"d<=MONTH<="31May2021"d and not missing(name)
        except
        select distinct Name
                from Test
                where "01Apr2021"d<=MONTH<="30Apr2021"d 
       ;
quit;
--
Paige Miller

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

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1641 views
  • 1 like
  • 3 in conversation