DATA Step, Macro, Functions and more

proc tabulate decimal places with dummy variable percentn

Accepted Solution Solved
Reply
Super Contributor
Posts: 383
Accepted Solution

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,520

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

View solution in original post


All Replies
Solution
Friday
Super User
Posts: 10,520

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

Posted in reply to KurtBremser
I tried percentn5.1 , percentn5.2, percentn5.3, but never thought of 7. I don't why 7 worked but 5
Highlighted
Super User
Posts: 10,520

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,898

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.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 61 views
  • 1 like
  • 3 in conversation