|
I'd like to create a score comprised of points earned for annual giving
increases by a donor over a five-year period. I.e., a donor gets a point for each year in which his giving total increases from the previous year. No points are awarded for static giving, and -1 point is issued for a year-to-year decrease. My data file is wide: ID ... 2002GIVING 2003GIVING 2004GIVING 2005GIVING 2006GIVING 2007GIVING How might I best compute this using SPSS15? It seems like something the VECTOR/LOOP combo might be well suited to, but I wanted to get some general feedback on the matter at hand before barking up any wrong trees, syntax-wise. Thank you. Mark ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Hi Mark,
I'm sure that my reply will be followed by a much more elegant solution. My dad would refer to this syntax approach as the brute force method...but, it seems to work and shouldn't be too bad unless you have 50 years of donation history to work with. Hope this helps, Ari DATA LIST LIST/ ID Giving2002 Giving2003 Giving2004 Giving2005 Giving2006 Giving2007. BEGIN DATA 1 20 50 50 80 100 50 2 30 50 10 50 50 500 3 0 0 500 1000 1000 0 END DATA. VECTOR Points (5). IF Giving2003>Giving2002 Points1=1. IF Giving2003=Giving2002 Points1=0. IF Giving2003<Giving2002 Points1=-1. IF Giving2004>Giving2003 Points2=1. IF Giving2004=Giving2003 Points2=0. IF Giving2004<Giving2003 Points2=-1. IF Giving2005>Giving2004 Points3=1. IF Giving2005=Giving2004 Points3=0. IF Giving2005<Giving2004 Points3=-1. IF Giving2006>Giving2005 Points4=1. IF Giving2006=Giving2005 Points4=0. IF Giving2006<Giving2005 Points4=-1. IF Giving2007>Giving2006 Points5=1. IF Giving2007=Giving2006 Points5=0. IF Giving2007<Giving2006 Points5=-1. COMPUTE PointsTotal = SUM(Points1 TO Points5). EXE. On Tue, Apr 8, 2008 at 2:36 PM, Mark Palmberg <[hidden email]> wrote: > I'd like to create a score comprised of points earned for annual giving > increases by a donor over a five-year period. > > I.e., a donor gets a point for each year in which his giving total > increases > from the previous year. No points are awarded for static giving, and -1 > point is issued for a year-to-year decrease. > > My data file is wide: > > ID ... 2002GIVING 2003GIVING 2004GIVING 2005GIVING 2006GIVING 2007GIVING > > How might I best compute this using SPSS15? It seems like something the > VECTOR/LOOP combo might be well suited to, but I wanted to get some > general > feedback on the matter at hand before barking up any wrong trees, > syntax-wise. > > Thank you. > > Mark > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Mark Palmberg
At 03:36 PM 4/8/2008, Mark Palmberg wrote:
>I'd like to create a score comprised of points earned for annual >giving increases by a donor over a five-year period. I.e., a donor >gets a point for each year in which his giving total increases from >the previous year. No points are awarded for static giving, and -1 >point is issued for a year-to-year decrease. > >My data file is wide: > >ID ... 2002GIVING 2003GIVING 2004GIVING 2005GIVING 2006GIVING 2007GIVING > >It seems like something the VECTOR/LOOP combo might be well suited to You're right about VECTOR/LOOP. Something like the following (not tested): NUMERIC GivngPts (F3). COMPUTE GivngPts = 0. VECTOR YearGift=GIFT2002 TO GIFT2007. LOOP #Year = 2 TO 5. . COMPUTE #ThisYr = YearGift(#Year). . COMPUTE #LastYr = YearGift(#Year-1). . IF #ThisYr GT #LastYr GivngPts = GivngPts + 1. . IF #ThisYr LT #LastYr GivngPts = GivngPts - 1. END LOOP. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
