Hi, I'm calculating percentage in proc tabulate, but I need it to show up not in % (not multiplied by 100)
TABLE Transaction_Type*((AVM_Vendor_1*CI1_T)),N pctn<CI1_T all> /rts=35
How can I see pctn, in decimal format? eg. 0.35
Thanks
You never indicated what your actual number range was and the number of decimal places. My example code wouldonly cover whole numbers ranging between 1 and 100 and all possibly 10ths between those numbers.
If your range goes from 0 to 100, each with the possibility of also including a fraction less than or greater than .1, then you would have to modify the code by adding the creation of an end variable and start the loop at 0. e.g.:
data fractions;
format label 4.3;
retain fmtname 'fraction' type 'n';
do start=0 to 100 by .1;
end=start+0.0999999999;
label=start/100;
output;
end;
run;
proc format cntlin=fractions;
run;
Let us know if that works.
http://support.sas.com/kb/36/495.html
Search proc tabulate percent on support.sas.com
I can only think of one possibility (of course, there could easily be more). You could always just create a format to cover all possibilities. e.g. (I don't know your possibilities):
data fractions;
format label 4.3;
retain fmtname 'fraction' type 'n';
do start=1 to 100 by .1;
label=start/100;
output;
end;
run;
proc format cntlin=fractions;
run;
and then specify that format in your proc tabulate statement, e.g.:
pctn<CI1_T all>*f=fraction.
Thanks Art, I'll give it a try..
Hi Art, I tried running this :
data fractions;
format label 4.3;
retain fmtname 'fraction' type 'n';
do start=1 to 100 by .1;
label=start/100;
output;
end;
run;
proc format cntlin=fractions;
run;
pctn<CI1_T all>*f=fraction.
But got the same results..no errors though, but not divided by 100
You never indicated what your actual number range was and the number of decimal places. My example code wouldonly cover whole numbers ranging between 1 and 100 and all possibly 10ths between those numbers.
If your range goes from 0 to 100, each with the possibility of also including a fraction less than or greater than .1, then you would have to modify the code by adding the creation of an end variable and start the loop at 0. e.g.:
data fractions;
format label 4.3;
retain fmtname 'fraction' type 'n';
do start=0 to 100 by .1;
end=start+0.0999999999;
label=start/100;
output;
end;
run;
proc format cntlin=fractions;
run;
Let us know if that works.
Works perfectly... once again thanks Art..
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.