turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Dividing sum of boolean by number of obs in a peri...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-29-2012 10:09 AM

I have a problem with quite a simple proc step.

**proc tabulate data=some_data;**

**class time;**

**var boolean1;**

**table time, n boolean**

Time | Number of obs in a given time (n) | sum of boolean variable | What i want |
---|---|---|---|

1 | 100 | 10 | (10/100)*100% |

2 | 200 | 50 | (50/200)*100% |

3 | 300 | 60 | (60/300)*100% |

4 | 400 | 80 | (80/400)*100% |

... | .. | ... |

But actually, I want to get the percent of the sum of boolean variable over a number of observations in a given period.

I tried boolean*rowpctn, different denominators for pctn<>, but none of this worked.

Could you please help me?

Accepted Solutions

Solution

12-29-2012
11:45 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-29-2012 11:45 AM

To me, it looks like you're asking for

TABLE time, boolean1 * (N Sum Mean);

Tom

All Replies

Solution

12-29-2012
11:45 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-29-2012 11:45 AM

To me, it looks like you're asking for

TABLE time, boolean1 * (N Sum Mean);

Tom

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-29-2012 11:55 AM

Thanks. I tried this before, but somehow I didn't notice that I have to apply "percent" format and I thought the figures are wrong .