SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Good morning.
I would like to know if it is possible to display a percent format with a comma. Like this for example: 12,5% and not 12.5%
The percentw.d format always displays the period, not the comma.
Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @mariopellegrini,

 

You can also use the NLPCTw.d format:

options locale=IT_IT; /* This might be your default value. */

data _null_;
input p q;
put p nlpct6.1 q nlpct8.2;
cards;
0.125 -0.125
1      1.5678
;

Result:

 12,5% -12,50%
100,0% 156,78%

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

I don't think it exists out-the-box. Though, you can always roll out your own like this

 

proc format;
   picture PercentC low-high = '000.009,9%' (multiplier = 1000);
run;

data _null_;
   a = 0.125;
   put a = PercentC.;
run;
mariopellegrini
Pyrite | Level 9

I am interested in the format, not informat. I would visualize on the table 12,5% with comma

PeterClemmensen
Tourmaline | Level 20

That's exactly what my code does?

mariopellegrini
Pyrite | Level 9

@PeterClemmensen thank you. It's correct. How do I increase a decimal? 

FreelanceReinh
Jade | Level 19

Hello @mariopellegrini,

 

You can also use the NLPCTw.d format:

options locale=IT_IT; /* This might be your default value. */

data _null_;
input p q;
put p nlpct6.1 q nlpct8.2;
cards;
0.125 -0.125
1      1.5678
;

Result:

 12,5% -12,50%
100,0% 156,78%
Ksharp
Super User
proc format;
   picture PercentC low-high = '009,999%' (decsep=',' multiplier = 100000);
run;

data _null_;
   a = 0.125;
   put a = PercentC.;
run;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 3290 views
  • 1 like
  • 4 in conversation