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
SAS Super FREQ
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
SAS Super FREQ

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

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