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

I have data with an '.' in a numeric field.  I want to move a space to this field. I would like to do this in Enterprise Guide. I have tried variations of this syntax:

case when t1.AF > 0 then PUT(t1.AF) =  ''
end

 

Input

AF AM BF
. . 9
. . .
. . 2

 Output

AF AM BF
    9
     
    2
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Just change the system option to print a space instead of a period for missing numeric values.

options missing=' ';

If you do want to recode your variable to character then your CASE statement would look like this:

case
  when not missing(t1.AF) then PUT(t1.AF,best12.)
  else ' '
end

You could pick a different format to use in the PUT() function depending on how you want the values displayed.

View solution in original post

5 REPLIES 5
data_null__
Jade | Level 19

options missing=' ';

carmendee
Obsidian | Level 7

How does this syntax work in Enterprise Guide in build and advanced expression if my field name is AF?

 

 

ballardw
Super User

NO "expression" needed. The period is indicating that the value is missing. The option sets the display to show missing with a different character, a blank. The "condition" to create a character variable with a blank in a CASE statement would be

 

It looks like you may be missing an ELSE portion of your CASE statement: Else " " as BF. But you didn't show the entire case statement as the result variable isn't indicated.

carmendee
Obsidian | Level 7

My field is numeric so my else cannot be "" for a blank.  I do not want a zero.  Ideas?

Tom
Super User Tom
Super User

Just change the system option to print a space instead of a period for missing numeric values.

options missing=' ';

If you do want to recode your variable to character then your CASE statement would look like this:

case
  when not missing(t1.AF) then PUT(t1.AF,best12.)
  else ' '
end

You could pick a different format to use in the PUT() function depending on how you want the values displayed.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 1532 views
  • 4 likes
  • 4 in conversation