How to select Observations which is not null or empty in SAS Enterprise Guide

Accepted Solution Solved
Reply
Contributor
Posts: 61
Accepted Solution

How to select Observations which is not null or empty in SAS Enterprise Guide

Hi ,

 

I am new to SAS Enterprise Guid. How do I write the data clause as I only want the data set where particalar observations is not null or empty.

 

For example:

 

data mydataset;

   set orion.employee;

  where <employeeName is not empty or blank>?

 

proc print data = mydataset;

run;

 

How do I write empoyeeName is not empty? what is the syntaxt for not empty for blank in SAS langauge?

 

Thanks!

Nancy


Accepted Solutions
Solution
‎06-23-2016 11:24 PM
Contributor
Posts: 61

Re: How to select Observations which is not null or empty in SAS Enterprise Guide

Okay. Thank you for your reply!

View solution in original post


All Replies
Grand Advisor
Posts: 17,321

Re: How to select Observations which is not null or empty in SAS Enterprise Guide

Where not missing(variable);

 

SAS treats null and blanks/missing the same in most cases. 

Contributor
Posts: 61

Re: How to select Observations which is not null or empty in SAS Enterprise Guide

Hi Reeze,

 

Thanks for the reply.

 

Where not missing(variable); 

does seems work; However,

 

 

Where variable ne ' ';

works.

 

 

Thank you anyway!

Nancy

 

 

Grand Advisor
Posts: 17,321

Re: How to select Observations which is not null or empty in SAS Enterprise Guide

Yes it will, for character variables. 

For numeric you use

 

where variable ne .;

 

Not Missing works for either character or numeric. 

Contributor
Posts: 61

Re: How to select Observations which is not null or empty in SAS Enterprise Guide

How about Date type variable?

Grand Advisor
Posts: 17,321

Re: How to select Observations which is not null or empty in SAS Enterprise Guide

SAS only has two data types, numeric and character.

 

Dates are numeric, with a date format applied.

A date is the number of days from Jan 1, 1960

A datetime is the number of seconds from Jan 1, 1960

 

Hope that helps.

 

There can be more data types if you're using DS2 but I'm assuming that you're not. And they only exist within the DS2 step.

Solution
‎06-23-2016 11:24 PM
Contributor
Posts: 61

Re: How to select Observations which is not null or empty in SAS Enterprise Guide

Okay. Thank you for your reply!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 512 views
  • 0 likes
  • 2 in conversation