Date: Fri, 11 Jul 2008 14:02:59 -0500
Reply-To: Satindra Chakravorty <satindra@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Satindra Chakravorty <satindra@GMAIL.COM>
Subject: Re: Separating SAS output (obs) into datasets
In-Reply-To: <200807111722.m6BAn6nW006866@malibu.cc.uga.edu>
Content-Type: text/plain; charset=WINDOWS-1252
Hi Knuako, this should do the trick for the given example...
data ds1 ds2 ds3;
set {input-dataset};
if _n_<3 then output ds1; else
if _n_<5 then output ds2; else
output ds3;
run;
However, if you want to write out discontinuous observations to
different datasets, the code will look different.
Satindra.
On Fri, Jul 11, 2008 at 12:22 PM, KNuako <asom77@hotmail.com> wrote:
> Hi,
> Could someone provide me with the code to keep different observations
> in specified datasets?
>
> For instance I have this output from SAS:
>
> Obs var1 var2 var3
> 1 7 1 4
> 2 0 0 8
> 3 9 9 9
> 4 5 6 2
> 5 8 1 1
> 6 2 3 2
> 7 0 0 7
>
>
> • I want to create 3 separate new datasets and keep the observations
> there.
> eg. Dataset1 should have obs 1 and 2, dataset2 should contain obs 3 &
> 4 and
> dataset 3 should have obs 5 to7.
>
|