Date: Thu, 7 Sep 2006 15:47:20 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Display first N lines in PROC REPORT
In-Reply-To: <1157643541.532822.72240@i42g2000cwa.googlegroups.com>
Content-Type: text/plain; format=flowed
Scott ,
Create a view that subsets your data will do essentually what you want:
Data Need ( Drop = Cnt ) / View = Need ;
Set Have ;
By Id ;
If First.Cnt then Cnt = 1 ;
Cnt + 1 ;
If Cnt <= 3 ;
Run ;
Proc Report
Darta = Need Nowd ;
Etc......
Run ;
Toby Dunn
When everything is coming at you all at once, your in the wrong lane.
A truly happy person is someone who can smile and enjoy the scenery on a
detour.
From: scott <scott.berta@GMAIL.COM>
Reply-To: scott <scott.berta@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Display first N lines in PROC REPORT
Date: Thu, 7 Sep 2006 08:39:01 -0700
I am stumped and cannot find a solution anywhere. I have a dataset
test that looks like this:
id type count
1 aa 1000
1 ab 900
1 ac 800
1 ba 200
1 bb 300
1 bc 350
1 ca 500
1 cc 800
1 af 400
2 ac 300
2 ba 800
2 cc 500
2 ha 900
2 bb 500
Now if I do the following:
proc sort data=test;
by id descending count;
run;
What I want to do is pull the first 3 records for each id and output to
a report for emailing. Can this be done with proc report (I can;t find
any way to do it)? Do I need to subset to another dataset and then
proc report from that? Any help would be appreciated.
Thanks.
Scott