BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi Friends,

I tried with Format negparen6.2 for numeric column. If the field is wide enough, NEGPARENw.d places parentheses around a number to represent a negative value. But i need to be negative sign. Please help me. Very urgent.

Thanks,
Selvi.
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Try making your width value -smaller- in order to get the parentheses to go away and show a negative sign (with negparen format) or simply use a w.d format as shown below. For more help with formatting numbers, there is extensive documentation in the SAS on-line doc or you can always call on Tech Support for help with a user-defined PICTURE format of your own.
cynthia
[pre]
data fmtnum;
input num;
return;
datalines;
-1
-.045
4
.065
;
run;

ods listing;
proc print data=fmtnum;
title 'with negparen format -- format cannot be too big';
format num negparen5.3 ;
run;

proc print data=fmtnum;
title 'with simple w.d format';
format num 5.3 ;
run;
[/pre]
Smora0713
Calcite | Level 5

How would you go about having both parentheses and a dollar sign? e.g. ($20.01).

 

Is there a present format that I can use if not would I need to create one with Proc Format?

 

Cynthia_sas
Diamond | Level 26

Hi:

  Rather than piggyback on such an old posting, you might want to start a new post. I nearly didn't read this when I saw how old the original post was.

 

  I think your only choice is a PICTURE format, as shown in example #3:

Cynthia_sas_0-1591141821700.png

 

 

Hope this helps,

Cynthia

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
  • 3 replies
  • 5572 views
  • 0 likes
  • 3 in conversation