BookmarkSubscribeRSS Feed
Helannivas
Quartz | Level 8

I have used coalescec function

(coalescec(Name,' ' )) for this.But it is not working.KIndly help me on this.

6 REPLIES 6
Ksharp
Super User

How about:

if name = 'Null' then name=' ';

Helannivas
Quartz | Level 8

In the Expression column I have given this.

I cannot validate this expression.Its throwing error.

I am using SAS DI studio 4.21.

Ksharp
Super User

OK. Try this:

ifc(name='null',' ',name)

Tom
Super User Tom
Super User

What do you mean?

In SAS character variables are stored as fixed length and are padded on the right with spaces.  I am not sure there is any difference between the terms "null" and "empty string".

dyan
Calcite | Level 5

try function

tranwrd (name, "null" , " " )

mariosegal
Calcite | Level 5

I will present this and other things at NESUG this year

the following macro converts all nulls to zeros (that is what I needed) for eitehr a set of variables or for all numeric ones

you can easilly modify it to convert string 'null' to '' (blank) without typing multiple lines of code, even if here was a function this is better as you do not need to write 100 of lines to process 100's of variables

I attached a small  text file, for some reason I could nto paste code from my sas editor

sas-innovate-2024.png

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.

 

Register now!

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
  • 6 replies
  • 7235 views
  • 0 likes
  • 5 in conversation