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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 498 views
  • 3 likes
  • 3 in conversation