BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
david27
Quartz | Level 8

I have this existing code. But it does not display negative values.

All negative values show up as positive value.

 

What can be an alternative way here?

 

	proc Format ;
		picture  NumFmt
			0 = ' '
			other = '000,000,009'
		;Quit;
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Negative values falls under "Other".


Try this:

 

proc format ;
    picture numfmt
        low-<0='0,000,000,009' (prefix='-')
        0 = ' '
        0<-high= '000,000,009';
run;

 

 

That should work, but you don't really need picture formats here.

 

proc format;
    value numfmt 0=' ' other=[comma12.0];
run;
--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Negative values falls under "Other".


Try this:

 

proc format ;
    picture numfmt
        low-<0='0,000,000,009' (prefix='-')
        0 = ' '
        0<-high= '000,000,009';
run;

 

 

That should work, but you don't really need picture formats here.

 

proc format;
    value numfmt 0=' ' other=[comma12.0];
run;
--
Paige Miller
david27
Quartz | Level 8

Thank You @PaigeMiller 

 

What is 

'0,000,000,009'

anyways? 

Reeza
Super User

9 prints zeroes, zeroes print blanks.

 

It's called a digit selector in SAS.

 

See page 6/7 of this document for an example that clarifies it more:

https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/243-31.pdf

 

 

david27
Quartz | Level 8

Thank You @Reeza 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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