## proc tabulate decimal places with dummy variable percentn

Solved
Highlighted
Super Contributor
Posts: 383

# proc tabulate decimal places with dummy variable percentn

Hi guys,

It must be very simple but I couldn't find solution online. How to achieve decimal place with percentn. format below? ob is 0 vs 1 dummy variable.

``````proc tabulate data=l.mydata order=internal;
var ob;
class durcat agecat race1 assist fam_size hh_smoking area;
tables (All agecat race1 assist fam_size hh_smoking area),
(durcat)*(ob)*(mean*f=percentn.)/nocellmerge printmiss;
where agecat=5;
run;
``````

Thanks!

Accepted Solutions
Solution
Friday
Super User
Posts: 10,546

## Re: proc tabulate decimal places with dummy variable percentn

Try percentn7.2

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

All Replies
Solution
Friday
Super User
Posts: 10,546

## Re: proc tabulate decimal places with dummy variable percentn

Try percentn7.2

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super Contributor
Posts: 383

## Re: proc tabulate decimal places with dummy variable percentn

I tried percentn5.1 , percentn5.2, percentn5.3, but never thought of 7. I don't why 7 worked but 5
Super User
Posts: 10,546

## Re: proc tabulate decimal places with dummy variable percentn

You need space for the % character, an optional sign, the decimal dot, and at least 2 digits left of the dot.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 6,921

## Re: proc tabulate decimal places with dummy variable percentn

You have to provide more detail in the format.  For example, use the format:

percentn5.1

☑ This topic is solved.