Help using Base SAS procedures

NULL RECORDS

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 145
Accepted Solution

NULL RECORDS

I Have a dataset with 5 variables a, b, c, d and e

I have to write a program to find out if the variable is null(individual vaaribles) for all recs. If so, then output ‘NULL’ to Comment column.


Accepted Solutions
Solution
‎06-12-2014 11:31 AM
Trusted Advisor
Posts: 1,204

Re: NULL RECORDS

data want;

set have;

if cmiss(of a,b,c,d,e)=5 then comment='NULL';

run;

View solution in original post


All Replies
Contributor
Posts: 29

Re: NULL RECORDS

null for all fields or null for any? are all variables numeric? char? mix?

Frequent Contributor
Posts: 145

Re: NULL RECORDS

Null for any and variables are mix.....

Respected Advisor
Posts: 3,124

Re: NULL RECORDS

Check out CMISS function.

Solution
‎06-12-2014 11:31 AM
Trusted Advisor
Posts: 1,204

Re: NULL RECORDS

data want;

set have;

if cmiss(of a,b,c,d,e)=5 then comment='NULL';

run;

Super User
Super User
Posts: 6,500

Re: NULL RECORDS

Note that you have used the OF styntax wrong.  Since you also included commas the OF only applies to the variables listed up until the first comma.

So  CMISS(of A,B,C,D,E) is the same as CMISS(A,B,C,D,E) .

The power of the OF syntax is when you want to use variable lists or just eliminate the annoying commas.

CMISS(of A B C D E)

or

CMISS(of _ALL_)

☑ This topic is SOLVED.

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

Discussion stats
  • 5 replies
  • 438 views
  • 2 likes
  • 5 in conversation