| Date: | Sun, 13 Jan 2008 09:37:51 -0500 |
| Reply-To: | "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET> |
| Organization: | Internet News Service |
| Subject: | Re: New problem with data manipulation. Thanks!!! |
|
toby dunn wrote:
> This is one way:
>
> Data Need ;
> Set Have ;
> By ID Visit ;
> Retain NewX1 NewX2 NewX3 ;
>
> If First.Visit Then Do ;
> NewX1 = X1 ;
> NewX2 = X2 ;
> NewX3 = X3 ;
> End ;
> Else Do ;
> NewX1 = NewX1 * X1 ;
> NewX2 = NewX2 * X2 ;
> NewX3 = NewX3 * X3 ;
> End ;
>
> If Last.Visit Then Output ;
>
> Run ;
>
>
> Personally Id restructure your data and the problem becomes even
> easier to solve:
And if SAS SQL had a new function named PROD, things would be even easier
Proc SQL;
create table summary as
select id, visit, name, PROD(value) as value
from HAVE_VECTOR
group by id, visit
;
quit;
--
Richard A. DeVenezia
http://www.devenezia.com/
|