LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments:   To: Randall Powers <powers_r@BLS.GOV>
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!


Back to: Top of message | Previous page | Main SAS-L page