Date: Thu, 25 Jan 2007 07:33:43 -0800
Reply-To: yxd10@PSU.EDU
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: yxd10@PSU.EDU
Organization: http://groups.google.com
Subject: Re: Help with dataset
In-Reply-To: <018601c73fdd$5724cba0$6600a8c0@IBMA9A4F058C42>
Content-Type: text/plain; charset="iso-8859-1"
data temp;
set test;
here is another one.
yxd
data test;
input a b c d;
datalines;
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
;
Run ;
data temp;
set test;
a1=a*lag(a);
b1=b*lag(b);
c1=c*lag(c);
d1=d*lag(d);
if mod(_n_,2) ne 0 then delete;
keep a1 b1 c1 d1;
run;
On Jan 24, 12:30 pm, sba...@sbbworks.com (Scott Barry) wrote:
> Here's one approach of many.
>
> Scott Barry
> SBBWorks, Inc.
>
> data ;
> input numvar1 ;
> if not mod(_n_,2) then do;
> xprd1 = p_numvar1 * numvar1;
> output;
> end;
> retain p_numvar1 0; drop p_: ;
> p_numvar1 = numvar1;
> cards;
> 100
> 200
> 300
> 400
> run;
>
> __________________
>
> On 24 jan, 16:58, Alireza.Nav... wrote:
>
> Hello all,
>
> I am working with a large data set (6000 rows by 100 columns). I am
> trying to write a SAS code that generates a new data set in which the
> first row is the product of the first two rows in the original data set,
> the second row is the product of the 3rd and 4th rows .... And so on.
>
> Any thoughts how could this be done?
>
> Thanks
>
> Alireza Navabi
> University of Alberta
|