## percentage but not % format

Solved
Super Contributor
Posts: 409

# percentage but not % format

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

Accepted Solutions
Solution
‎02-19-2012 12:41 AM
PROC Star
Posts: 8,169

## percentage but not % format

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.

All Replies
Super User
Posts: 23,778

## percentage but not % format

http://support.sas.com/kb/36/495.html

Search proc tabulate percent on support.sas.com

PROC Star
Posts: 8,169

## percentage but not % format

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.

Super Contributor
Posts: 409

## percentage but not % format

Thanks Art, I'll give it a try..

Super Contributor
Posts: 409

## percentage but not % format

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

Solution
‎02-19-2012 12:41 AM
PROC Star
Posts: 8,169

## percentage but not % format

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.

Super Contributor
Posts: 409

## percentage but not % format

Works perfectly... once again thanks Art..

🔒 This topic is solved and locked.

Discussion stats
• 6 replies
• 199 views
• 0 likes
• 3 in conversation