Date: Wed, 14 Nov 2007 11:43:00 -0600
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: transform data
In-Reply-To: <200711141633.lAEERcSY013907@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
On Nov 14, 2007 10:33 AM, Jerry <greenmt@gmail.com> wrote:
> There are only 3 different values for the variable "code", but a lot of
> different values (in thousands) for the variable "ID".
I think (in thousands) is important and may have been overlooked.
This example performs well with IDs close to 1M.
1807 data work.one;
1808 do id=1 to 1e6;
1809 do code = 'a','b','c';
1810 do n = 1 to rantbl(12345,.1,.5,.25,.1)-1;
1811 output;
1812 end;
1813 end;
1814 end;
1815 run;
NOTE: The data set WORK.ONE has 4501860 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 2.26 seconds
cpu time 2.07 seconds
1816 data work.counts;
1817 do until(last.id);
1818 set work.one;
1819 by id;
1820 array _c[3] code_a code_b code_c;
1821 _c[indexC('abc',code)] + 1;
1822 end;
1823 output;
1824 call missing(of _c[*]);
1825 run;
NOTE: There were 4501860 observations read from the data set WORK.ONE.
NOTE: The data set WORK.COUNTS has 998963 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 2.46 seconds
cpu time 2.46 seconds
|