DATA Step, Macro, Functions and more

how to find out if several fields are empty ?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

how to find out if several fields are empty ?

Hi all,

Is there a way to concatenate several fields, and if they are empty have length = 0 or nulls?

I am trying to execute the following and always comes back with length of 1, even though fields are empty..

ALLVARS = LENGTH(COMPRESS(CATS(FIELD1,FIELD2,FIELD3,DATE1,DATE2),'00'X));

the compress is there because sometimes I have binary zeroes on the dates.

I just want to execute a process in case the fields have values and another one if they don't.

how can I solve it?

Thanks

Miguel


Accepted Solutions
Solution
‎10-31-2014 06:21 PM
Respected Advisor
Posts: 3,124

Re: how to find out if several fields are empty ?


All Replies
Occasional Contributor
Posts: 12

Re: how to find out if several fields are empty ?

forgot to say, all  the fields are defined as characters.

It always comes back with a length of 1...

Not understanding why is that..

Thanks

Solution
‎10-31-2014 06:21 PM
Respected Advisor
Posts: 3,124

Re: how to find out if several fields are empty ?

Respected Advisor
Posts: 4,646

Re: how to find out if several fields are empty ?

Try

CMISS(FIELD1,FIELD2,FIELD3,DATE1,DATE2) = 5;


to check if all values are missing.


PG

PG
Occasional Contributor
Posts: 12

Re: how to find out if several fields are empty ?

Thanks PGStats,

I wasn't even aware this functions existed. :smileylaugh:

☑ This topic is SOLVED.

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

Discussion stats
  • 4 replies
  • 455 views
  • 4 likes
  • 3 in conversation