| Date: | Fri, 19 Jun 2009 07:45:20 -0500 |
| Reply-To: | Joe <snoopy369@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Joe <snoopy369@GMAIL.COM> |
| Subject: | Re: outputting either the fourth or the final observation to a
new dataset |
|
| In-Reply-To: | <200906191216.n5JAq7Xh032602@malibu.cc.uga.edu> |
| Content-Type: | text/plain; charset=us-ascii; format=flowed; delsp=yes |
How about (untested):
Data b;
_n_=0;
do until (eof);
set a end=eof;
_n_+1;
if _n_ =4 then leave;
End;
Output;
Run;
Thanks,
-Joe
On Jun 19, 2009, at 7:16 AM, Randall Powers <powers_r@BLS.GOV> wrote:
> Hello all,
>
> I have a temporary dataset A that is reproduced 10 times in the run
> of a
> program. Sometimes it happens that the dataset has four or more
> observations, sometimes it has less.
>
> If there are four or more observations in A, I want to output the
> fourth
> observation to temporary dataset B. If there are less than four
> observations, I want you output the final observation of A to B.
>
> How do I do this?
>
> Thanks!
|