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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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