Hello SAS Experts,
I have been looking through many tutorials and whitepages but how to get a number without decimal points to show a thousand seperator I have not figured out so far.
Example 2346 should look like 2.456 (dot seperated)
31543 should look like 31.543
I tried this:
DEFINE EB_P / 'B' format=7.2;
DEFINE SB_N / 'N' format=nlnum20.;
but it did not help.
Can someone point me in the right direction?
Thanks
Use the COMMAX format.
Hi PaigeMiller,
Thanks for your hint!
That was a great help.
I have to admit, there are some column which I have where there is no decimal number(s).
The numbers are just whole numbers like 2343 or 56992. Which format do I appl
to "just" create a thousand seperator? I tried commax10. but that moved the decimal seperator and did not eliminate it.
The NLNUM format honors your national language setting. The COMMAX should just do the reverse of the COMMA format. You can test.
data _null_;
length value 8 format $32 display $20 ;
do value=2346, 31543 ;
do format='COMMA20.','NLNUM20.','COMMAX20.';
display = putn(value,format);
put value format display ;
end;
end;
run;
2346 COMMA20. 2,346
2346 NLNUM20. 2,346
2346 COMMAX20. 2.346
31543 COMMA20. 31,543
31543 NLNUM20. 31,543
31543 COMMAX20. 31.543
How are you viewing the results? If you wrote it to an EXCEL file then perhaps Excel has changed the format, or attached it's own default format to the numeric values?
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.