BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
shikoulitz
Calcite | Level 5

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

1 ACCEPTED SOLUTION
4 REPLIES 4
shikoulitz
Calcite | Level 5

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

PGStats
Opal | Level 21

Try

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


to check if all values are missing.


PG

PG
shikoulitz
Calcite | Level 5

Thanks PGStats,

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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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