Hello
I am runnning proc tabulate.
I want to display number in millions.
Instead of see the following numbers:
Then I want to see it like that
Here is the code I run
proc tabulate data=have;
class category/order=freq;
format category ;
var category ; ;
table category=' ' All='Total',
n='Nr'*f=comma23.
pctn='PCT'*f=8.1
category=' '*(sum='Sum_X'*f=comma23.1 pctsum='PCT_X'*f=8.1)/box='X'
;
run;
What is the way to dispaly the Sum_X in millions?
Data?
Custom format. The online documentation show one way.
proc format; picture millions (round) low-high = '00,000,000,009' (mult=0.000001); run; data junk; input x; datalines; 1 11 111 1111 11111 111111 1111111 11111111 111111111 1111111111 11111111111 111111111111 1111111111111 11111111111111 111111111111111 ; proc print data=junk; format x millions.; run;
Did you even try anything that is pretty obviously a Proc Format question?
Divide SUM_X by one million.
Or create a PICTURE format to represent the value in millions. One nice thing with PICTURE formats is that they can be preceded by a $ character (if you want) and can have a suffix of M (if you want)
Example: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/n0kl9qj532rbqln187us4ao371h7.htm
Data?
Custom format. The online documentation show one way.
proc format; picture millions (round) low-high = '00,000,000,009' (mult=0.000001); run; data junk; input x; datalines; 1 11 111 1111 11111 111111 1111111 11111111 111111111 1111111111 11111111111 111111111111 1111111111111 11111111111111 111111111111111 ; proc print data=junk; format x millions.; run;
Did you even try anything that is pretty obviously a Proc Format question?
I have tried some codes and all didn't work well
picture millions (fuzz=0)
low-high='0000 M' ( mult=.000001)
;
run;
May you explain why you put 11 numbers?
00,000,000,009
May you explain why you used this number
.000001
@Ronein wrote:
I have tried some codes and all didn't work well
picture millions (fuzz=0) low-high='0000 M' ( mult=.000001) ; run;
You have to have enough space to show all the digits. Your code allows for just 4 places for digits.
May you explain why you used this number
.000001
You might remember that earlier in this thread, I suggest a simple method of getting the results you want, that was dividing by one million. Question for you: dividing by one million is the same as multiplying by ___________________.
May you explain why you put 11 numbers?
00,000,000,009
These things you can figure out for yourself by experimenting ... change the code from @ballardw and see what happens.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.