How to change the "N's" in proc report across time

How to change the "N's" in proc report across time

Post by Jake Boo » Thu, 20 Apr 2006 20:43:38

I have a proc report using #byval(week) to create a report by week.
But since we are not using an ITT population overall for the (n=
[values]) in the header. I need a way to change the N's by week. Has
anyone encountered this situation before? I put the N's out to macro
vars by week and group, but how can I control the new N values per week
with the #byval.
I can loop through proc report with proc report encapsulated in a %do
... %end loop, but is seem that there should be a way to do this within
the proc report.

Also, can anyone answer. I can't seem to receive the GMAIL from
XXXX@XXXXX.COM , although I subscribed to this group, I have to
go to my groups to review the discussions, but it seems that I should
be able to get them in my gmail account.


How to change the "N's" in proc report across time

Post by ya.huan » Fri, 21 Apr 2006 00:38:12

You need to create a new variable to hold the 'n' for each week, then
add it to the by statement with week, also add it to the title statement.
The following sample, sex will be your week:

* add n for sex;
proc sql;
create table class as
select *, count(sex) as nsex
from sashelp.class
group by sex

options nobyline;
proc print data=class;
title "Sex #byval(sex) n=(#byval(nsex))";
by sex nsex;

Sex M n=(10) 08:27 We

Obs Name Age Height Weight

10 Alfred 14 69.0 112.5
11 Henry 14 63.5 102.5
12 James 12 57.3 83.0
13 Jeffrey 13 62.5 84.0
14 John 12 59.0 99.5
15 Philip 16 72.0 150.0
16 Robert 12 64.8 128.0
17 Ronald 15 67.0 133.0
18 Thomas 11 57.5 85.0
19 William 15 66.5 112.0