Prev: HELP- insufficient memory when I run PROC CLUSTER on 14*15000 data
Next: A State Space Model for Multivariate Longitudinal Count Data
From: rmat on 2 Sep 2008 11:49 Hi SAS experts, I am facing a simple data manipulation issue. Somehow, I am stuck and not able to get the SAS code right to do this. My requirement is to create adstock from the GRP values I have. The governing equations are provided below. GRP Adstock 104.697 31.4 56.941 39.1 80.745 51.6 45.755 49.8 55.428 51.5 48.168 50.5 102.362 66.1 71.778 67.8 Adstock (t=1) = GRP(t=1)* (1 - 0.7); Adstock (t=2) = Adstock(t=1)*0.7 + GRP(t=2)*(1-0.7); Adstock (t=3) = Adstock(t=2)*0.7 + GRP(t=3)*(1-0.7); .. .. .. Thanks very much, Regi
From: Reeza on 2 Sep 2008 18:24 On Sep 2, 9:49 am, rmat <reg...(a)gmail.com> wrote: > Hi SAS experts, > > I am facing a simple data manipulation issue. Somehow, I am stuck and > not able to get the SAS code right to do this. My requirement is to > create adstock from the GRP values I have. The governing equations are > provided below. > > GRP Adstock > > 104.697 31.4 > 56.941 39.1 > 80.745 51.6 > 45.755 49.8 > 55.428 51.5 > 48.168 50.5 > 102.362 66.1 > 71.778 67.8 > > Adstock (t=1) = GRP(t=1)* (1 - 0.7); > Adstock (t=2) = Adstock(t=1)*0.7 + GRP(t=2)*(1-0.7); > Adstock (t=3) = Adstock(t=2)*0.7 + GRP(t=3)*(1-0.7); > . > . > . > Thanks very much, Regi use the retain variable. Code not tested!!!! data test; set have; retain adstock 0; *initialize to 0; adstock=adstock+grp*(1-0.7); .... run; Reeza
From: rmat on 2 Sep 2008 21:03 Hi Reeza, Thanks very much for your suggestion. I was able to complete it so elegantly. Regi On Sep 2, 6:24 pm, Reeza <fkhurs...(a)hotmail.com> wrote: > On Sep 2, 9:49 am, rmat <reg...(a)gmail.com> wrote: > > > > > > > Hi SAS experts, > > > I am facing a simple data manipulation issue. Somehow, I am stuck and > > not able to get the SAS code right to do this. My requirement is to > > create adstock from the GRP values I have. The governing equations are > > provided below. > > > GRP Adstock > > > 104.697 31.4 > > 56.941 39.1 > > 80.745 51.6 > > 45.755 49.8 > > 55.428 51.5 > > 48.168 50.5 > > 102.362 66.1 > > 71.778 67.8 > > > Adstock (t=1) = GRP(t=1)* (1 - 0.7); > > Adstock (t=2) = Adstock(t=1)*0.7 + GRP(t=2)*(1-0.7); > > Adstock (t=3) = Adstock(t=2)*0.7 + GRP(t=3)*(1-0.7); > > . > > . > > . > > Thanks very much, Regi > > use the retain variable. > > Code not tested!!!! > > data test; > set have; > retain adstock 0; *initialize to 0; > adstock=adstock+grp*(1-0.7); > ... > > run; > > Reeza- Hide quoted text - > > - Show quoted text -
From: hs AT dc-sug DOT org on 2 Sep 2008 21:44
On Tue, 2 Sep 2008 15:24:09 -0700, Reeza <fkhurshed(a)HOTMAIL.COM> wrote: >On Sep 2, 9:49 am, rmat <reg...(a)gmail.com> wrote: >> Hi SAS experts, >> >> I am facing a simple data manipulation issue. Somehow, I am stuck and >> not able to get the SAS code right to do this. My requirement is to >> create adstock from the GRP values I have. The governing equations are >> provided below. >> >> GRP Adstock >> >> 104.697 31.4 >> 56.941 39.1 >> 80.745 51.6 >> 45.755 49.8 >> 55.428 51.5 >> 48.168 50.5 >> 102.362 66.1 >> 71.778 67.8 >> >> Adstock (t=1) = GRP(t=1)* (1 - 0.7); >> Adstock (t=2) = Adstock(t=1)*0.7 + GRP(t=2)*(1-0.7); >> Adstock (t=3) = Adstock(t=2)*0.7 + GRP(t=3)*(1-0.7); >> . >> . >> . >> Thanks very much, Regi > >use the retain variable. > >Code not tested!!!! > >data test; > set have; > retain adstock 0; *initialize to 0; > adstock=adstock+grp*(1-0.7); >... > >run; > >Reeza I think thefirst term also requires a coefficient: adstock = adstock * 0.7 + grp * (1 - 0.7); |