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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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 lock in 2025 pricing—just $495!

Register now

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
  • 1731 views
  • 1 like
  • 3 in conversation