```Date: Mon, 3 Oct 2005 13:28:18 -0400 Reply-To: Ya Huang Sender: "SAS(r) Discussion" From: Ya Huang Subject: Re: how to make one formula from diferent records? Comments: To: Adriano Rodrigues Content-Type: text/plain; charset=ISO-8859-1 data xx; input Obs diff COUNT PERCENT; cards; 1 0 6 27.2727 2 1 11 50.0000 3 2 3 13.6364 4 3 2 9.0909 ; proc sql; create table demo as select *, max(case when diff=0 then percent else . end) as a, max(case when diff=1 then percent else . end) as b, max(case when diff=2 then percent else . end) as c, max(case when diff=3 then percent else . end) as d, (calculated a)/(calculated b)+(calculated c)*(calculated d) as x1, ((calculated a)+(calculated b))/((calculated c)-(calculated d)) as x2, ((calculated a)-(calculated b))/((calculated a)+(calculated b)+(calculated c) + (calculated d)/2) as x3 from xx ; proc print; run; Obs diff COUNT PERCENT a b c d x1 x2 x3 1 0 6 27.2727 27.2727 50 13.6364 9.0909 124.513 16.9998 -0.23810 2 1 11 50.0000 27.2727 50 13.6364 9.0909 124.513 16.9998 -0.23810 3 2 3 13.6364 27.2727 50 13.6364 9.0909 124.513 16.9998 -0.23810 4 3 2 9.0909 27.2727 50 13.6364 9.0909 124.513 16.9998 -0.23810 Kind regards, Ya Huang On Mon, 3 Oct 2005 13:22:40 -0300, Adriano Rodrigues wrote: >Hi all? > >suposse this data (i finally got and exported after many calculations): > >Obs diff COUNT PERCENT > >1 0 6 27.2727 > >2 1 11 50.0000 > >3 2 3 13.6364 > >4 3 2 9.0909 > > > >Now i need make varoius formulas for X, like: > > > >1) X1=a/b +c*d > >2) X2=(a+b) / (c-d) > >3) X3=(a-b) / (a+b+c+d/2) > > > >etc... > > > >where: > >a= percent of record where diff=0 > >b= percent of record where diff=1 > >c= percent of record where diff=2 > >d= percent of record where diff=3 > > > >my variable diff is always ordened > > > >its possible? > > > >thx in advance, > >Adriano > > > > > >--------------------------------- > Novo Yahoo! Messenger com voz: ligações, Yahoo! Avatars, novos emoticons e muito mais. Instale agora! ```

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