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
Try LENGTHN().
And here is why:
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
Try
CMISS(FIELD1,FIELD2,FIELD3,DATE1,DATE2) = 5;
to check if all values are missing.
PG
Thanks PGStats,
I wasn't even aware this functions existed. :smileylaugh:
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.