Dear Members,
I have revenues for customers for over 12 months, customers are about 9 millions, customers are not active thoughout the 12 months, so some months have revenues missing (.) for some customers. There have been a general revenue fall trend over the 12 months and I would want to get an indicator for each customer showing a fall and its rate. this indicator will help classify customers into 1. Revenue have decreases, 2=Revenues have stayed constant, 3=Revenues have grown.
This will help me study customers, study customers whose revenues have fallen will help me understand the reasons.
Thank you for your help
Toni
Please provide some example data in a data step, so we have something to play around with. Just enough to illustrate your issue(s).
And a fitting example of the expected results
First of all, THIS is how you provide data in a data step:
data have;
infile cards dlm=',' truncover;
input msisdn :$12. rev1-rev21;
cards;
256312101087,0,,,,,,,,,,,,,,0,,,,,,
256312106571,,,,,,,,,,,,,,,,,,,,,
256312107758,,0,,,,,,,0,,,,,,,,,,,,
256312109190,,,,,,,,,,,,,,,0,,,,,,0
256312109409,,,,,,,,0,,,,,,,,,,,,,
256312109658,,,,,,,,,,0,,,,,,,,,,,
256312109862,,,,,,,,,,,,,,,,,0,,,,
256312110324,,,,,,,,,,,,,,0,,,,,,,
256312110608,,,,,,0,,,,,,,,,,,,,,,
256312111220,,,,,,0,,,,,,,,,,,,,,,0
256312114890,,,,,,,,,,,,,,,,,,,,,0
256312165100,3240,4320,2700,2640,,2340,2340,1800,2160,1620,1320,,1800,,,,,,,,
256312165101,180,,1800,1440,540,,4320,1260,3060,3300,,960,2700,1980,2160,,2880,,180,2340,360
256312165102,,2160,720,,3240,,,,,,,,,360,360,,900,,,,
256312165104,360,1800,,1260,,540,1260,,360,3600,,,180,180,1260,,,,,,
256312165109,720,5040,1260,180,,5580,9360,4500,3060,7080,540,840,1260,1800,720,360,1260,1680,,3600,5400
256312165110,4860,2880,4860,480,,1260,,,,,,,,,,,,,,,
256312165111,5760,360,1440,,,1980,3960,3780,7920,,,,7380,5940,7020,,4320,,,3420,7560
256312165112,,1620,540,,,1080,1080,,900,720,,,,3600,180,,900,,,,1980
256312165114,1440,180,360,,,,,,,,,120,180,1800,1620,,720,,120,180,540
256312165123,180,180,,,,180,720,,180,900,,,2700,,2880,,1800,660,,900,360
256312165127,2520,900,180,,,1800,360,1260,5400,3600,,240,5580,1440,540,,1440,,,1980,3420
256312165133,1080,,,,,5760,,,360,,,,,,3960,,360,,,360,
256312165144,,,360,,360,,,,,,,,,540,180,,2040,,,180,540
256312165148,1260,,180,,,1620,3060,900,3600,2700,,,1440,5400,6480,,2160,,,5040,3060
256312165500,36502,21420,18000,900,,23760,24300,13500,17640,22680,,1620,17640,28620,30383.5,,12060,1200,,16020,27720
;
run;
This makes it possible for everyone else to recreate your data with a simple copy/paste and submit. See it as a matter of basic courtesy to the people who are supposed to help you.
Next, you have 21 revX columns. How do those map to the twelve months you need to observe? Or would you want 9 12-month rolling windows?
And can it be assumed that a missing month value represents zero?
Thank you KurtBremser,
I haved notted the advise,
I am sorry i used month, but actually they are days, 21 days of usage. so it 21 days.
Missing days means the customer did not spend on that day. so a zero (0) is appropriate
Tony
So what output do you expect? Take the sample data from my last post, and show what should be the output for every observation, and how you (logically) came to that result.
If you need more datalines to illustrate what you want, just expand the datastep with more data.
Hi KurtBremser
Below is the example of the output i want, i have added a new column slope. This is supposed to help me know customers whose revenues have fallen during the 21 days of use.
Thank you
Anthony
data have;
infile cards dlm=',' truncover;
input msisdn :$12. rev1-rev21 slope;
cards;
256312101087,0,,,,,,,,,,,,,,0,,,,,,,0
256312106571,,,,,,,,,,,,,,,,,,,,,,0
256312107758,,0,,,,,,,0,,,,,,,,,,,,,0
256312109190,,,,,,,,,,,,,,,0,,,,,,0,0
256312109409,,,,,,,,0,,,,,,,,,,,,,,0
256312109658,,,,,,,,,,0,,,,,,,,,,,,0
256312109862,,,,,,,,,,,,,,,,,0,,,,,0
256312110324,,,,,,,,,,,,,,0,,,,,,,,0
256312110608,,,,,,0,,,,,,,,,,,,,,,,0
256312111220,,,,,,0,,,,,,,,,,,,,,,0,0
256312114890,,,,,,,,,,,,,,,,,,,,,0,0
256312165100,3240,4320,2700,2640,,2340,2340,1800,2160,1620,1320,,1800,,,,,,,,,0
256312165101,180,,1800,1440,540,,4320,1260,3060,3300,,960,2700,1980,2160,,2880,,180,2340,360,-0.23
256312165102,,2160,720,,3240,,,,,,,,,360,360,,900,,,,,-0.23
256312165104,360,1800,,1260,,540,1260,,360,3600,,,180,180,1260,,,,,,,-0.23
256312165109,720,5040,1260,180,,5580,9360,4500,3060,7080,540,840,1260,1800,720,360,1260,1680,,3600,5400,-0.23
256312165110,4860,2880,4860,480,,1260,,,,,,,,,,,,,,,,-0.23
256312165111,5760,360,1440,,,1980,3960,3780,7920,,,,7380,5940,7020,,4320,,,3420,7560,-0.23
256312165112,,1620,540,,,1080,1080,,900,720,,,,3600,180,,900,,,,1980,-0.23
256312165114,1440,180,360,,,,,,,,,120,180,1800,1620,,720,,120,180,540,-0.23
256312165123,180,180,,,,180,720,,180,900,,,2700,,2880,,1800,660,,900,360,-0.23
256312165127,2520,900,180,,,1800,360,1260,5400,3600,,240,5580,1440,540,,1440,,,1980,3420,-0.23
256312165133,1080,,,,,5760,,,360,,,,,,3960,,360,,,360,,-0.23
256312165144,,,360,,360,,,,,,,,,540,180,,2040,,,180,540,-0.23
256312165148,1260,,180,,,1620,3060,900,3600,2700,,,1440,5400,6480,,2160,,,5040,3060,-0.23
256312165500,36502,21420,18000,900,,23760,24300,13500,17640,22680,,1620,17640,28620,30383.5,,12060,1200,,16020,27720,-0.23
256312165650,12420,17640,11231.5,,,23538,8100,4320,13511,4680,,,9720,7920,20707.5,,4140,,,8460,9568.5,-0.23
256312202029,,360,900,720,,7920,1620,540,540,1800,,,3600,180,180,,180,360,,,,-0.23
256312202218,,,,,,,,1080,,,,,,180,,,,,,1440,540,-0.23
256312222111,2160,900,720,540,6835,900,360,180,1620,3090,2640,5144.5,2160,2520,,,,,,,,-0.23
256312225900,3600,6120,8820,,,,,,,,,,,,,,,,86,,,-0.23
256312253500,360,1620,180,,,1260,10080,180,1080,,360,,,1800,540,1440,,,,180,360,-0.23
256312253800,1980,180,2160,2640,,180,360,,900,3900,900,,180,2340,1080,1800,540,540,,1268,540,-0.23
256312253801,3960,1980,2700,1020,,4140,5040,1620,1980,900,1260,,3600,1620,4860,180,900,6900,,5040,4140,-0.23
256312253802,5338,1800,720,,,7398,1800,,3960,360,180,,1080,2160,1620,,360,1800,,900,5983,-0.23
256312253803,540,,720,120,,2880,1800,360,1080,540,,,5400,900,3060,,,,,360,,-0.23
256312253804,3600,1260,,,,,,,,180,,,,180,1260,,3960,,,,180,-0.23
256312253805,,5040,1800,,,,720,,,,,,,720,,,,,,,,-0.23
256312253807,,,,,,,,,,,,,180,2520,2520,,18913,,,180,10061,-0.23
256312253808,540,,1260,,,3420,720,360,180,360,,,4500,1260,360,,180,480,,,540,-0.23
256312253809,,,,,,,,1080,1620,,,,,1800,540,,540,,,,1080,-0.23
256312253810,4140,6300,2520,,,,360,900,6300,1620,2940,,2340,180,2340,,2340,480,,3420,1800,-0.23
256312253811,,720,1800,,,1620,1800,5040,7560,5760,,,5040,2880,8460,,1800,,,2700,4500,-0.23
256312253812,3600,7083.5,1620,3180,,,3960,4006,3600,1980,420,,3960,6660,2880,900,,,,6120,1620,-0.23
256312253813,,,,,,180,,,,,,,,,1440,,,,,,,-0.23
256312253814,5220,4320,1260,1620,,5760,4140,1080,1620,3600,1260,,3960,540,4500,,1620,,,2700,4860,-0.23
256312253815,,,,,,10980,8100,540,,,,,,3420,3420,,3600,,,4860,5940,-0.23
256312253816,1800,7020,4680,,,1800,,360,720,,,,900,,,,,,,720,540,-0.23
256312253817,8100,7380,1020,,,5760,6480,1080,,,,,,,1620,720,2880,,,180,1260,-0.23
256312264035,5760,1980,540,,,4680,18000,6120,3060,9360,,,6120,4320,6300,,13860,1980,,29852,16920,-0.23
256312264036,1620,2160,4860,,,7740,5760,8820,3060,1980,360,,7560,5760,8820,,6660,180,,1620,0,-0.23
256312265744,,,0,,,,,0,,,,,,,,,,,,,,-0.23
256312271382,7740,9000,6660,480,,7740,3780,,,,,,,,,,,,,,,-0.23
256312271391,1440,4140,2340,300,,540,720,720,360,1440,,,1800,2160,1800,,180,,,1800,1260,-0.23
256312280959,,,,,,,,,,,,,0,,,,,,,,,-0.23
256312283211,,,,,,,,,,,,,,,,,,,,,0,-0.23
256312283570,,,,,,,0,,,,,,,,,,,,,,,-0.23
256312289210,0,,,,,,,,,,,,,,,,,,,,,-0.23
256312292336,0,,,,,,,,,,,,0,0,,,,,,,,-0.23
256312307100,46800,55276.5,28594,18746,8460,48960,42118,38880,47520,37310.5,8280,12360,52920,38700,41744,22002,42540,13260,25024,41040,,-0.23
256312307605,540,,,,,,,,,,,,,,,,,,,,,-0.23
256312307607,360,,,,,360,180,180,,900,,,,,,,,,,,,-0.23
256312307609,540,720,,,,,1440,,,,,,,,,,,,,,,-0.23
256312307610,1620,3060,180,,,720,4860,720,5940,2520,,,,,,,,,,,,-0.23
256312307613,,1080,,,,2340,720,2340,720,,,,,,,,,,,,,-0.23
256312307614,3240,11700,2520,,,4500,,,,,,,,,,,,,,,,-0.23
256312307615,540,,,,,,,,,,,,,,,,,,,,,-0.23
256312307618,1287,,,,,,,,180,,,,,,,,,,,,,-0.23
256312307620,540,,180,,,,1620,,,,,,,,,,,,,,,-0.23
256312307624,3060,1080,4860,,,2340,360,180,,,,,,,,,,,,,,-0.23
256312307625,4177.5,1620,,,,1620,2500,1620,2160,,,,,,,,,,,,,-0.23
256312307633,1260,900,,1860,,2520,,1980,360,,,,,,,,,,,,,-0.23
256312310700,4320,2700,3240,,,,540,3420,4140,0,,,1260,4100,1620,,1440,,,5940,1980,-0.23
256312310701,,,,,,,1620,,,,,,,,,,,,,,,-0.23
256312310702,,,720,,,,1620,,,,,,,,,,,,,,,-0.23
256312310703,,,,,,,,,,,,,540,,,,,60,,,,-0.23
256312310704,,,,,,,,,,,,,,,,,,,,0,,-0.23
256312310705,1080,,3060,,,5400,2880,4860,1440,1620,,,1080,5220,3420,,4500,,,1800,360,-0.23
256312310707,360,360,,,,,360,3780,1260,,,,720,540,2160,,13320,,,5580,1440,-0.23
256312310708,,180,2160,,,,720,3420,360,,,,540,360,,,180,,,1080,720,-0.23
256312310709,,,,,,,,,3240,900,,,5040,,,,,,,2700,2340,-0.23
256312310710,2873.5,,,,,,180,3960,,1402.5,,,,,,,,,,,,-0.23
256312310711,,,,,,,,,,,,,,,180,,1848,,,,,-0.23
256312310712,1260,2520,2520,60,,1080,,1260,,360,,,1620,180,900,,1260,,,1080,1800,-0.23
256312310713,,3780,1080,,,,,,,,,,,180,,,,,,,180,-0.23
256312310714,1260,,8460,,,,486.5,,,2160,,,,720,,,5040,,,5220,1800,-0.23
256312310715,,,,,,,,,,,,,,0,,,,,,0,,-0.23
256312310716,7740,,,,,,,,,,,,,,,,,,,,,-0.23
256312310717,1080,3960,1380,60,,720,720,3600,1260,900,1380,,3600,5040,720,,1440,60,,7200,2700,-0.23
256312310718,,,,,,,,,,,,,1800,,360,,900,,,2340,1260,-0.23
256312310719,,,360,,,540,,,540,,,,,180,,,,,,1440,,-0.23
256312310720,,,,,,540,360,180,,360,,,,,,,,,,2700,1800,-0.23
256312310721,,,,,,,,,,,,,,,,,,,,,360,-0.23
256312310722,1800,360,720,,,8520,180,1980,1620,180,,,900,180,,900,,660,,360,540,-0.23
256312310728,,,,,,,0,,,,,,,,,,,,,,0,-0.23
256312320600,4680,4860,13500,1800,,8540,2160,900,10620,3240,,,12600,1080,5580,,2160,540,,9820,4680,-0.23
256312370157,1800,540,1260,,,,1260,1080,1620,2360,,,1980,1800,540,,1980,,,1440,1620,-0.23
256312372008,1440,540,,,,,,,,,,,,,540,,900,,,540,720,-0.23
256312372751,8640,11880,,,,2520,1620,4320,,,,,,360,3600,,2340,,,4860,900,-0.23
256312372756,,900,,,,900,3960,5940,1440,180,,,540,540,1080,,1800,,,8460,1980,-0.23
256312374156,180,720,,,,,2160,360,,,,,,,,,,,,,,-0.23
256312393800,900,,5040,,,,5940,5040,,,,,,,,,,,,,,-0.23
256312393801,,,,,,,,,180,1164,,,,,,,540,,,180,,-0.23
256312393803,540,4320,5400,,,2700,,2340,,720,,,2880,1800,4320,,360,,,3420,1080,-0.23
256312393808,,2880,,,,720,,1620,1080,1980,,,360,4320,,,1800,,,3240,1980,-0.23
256312393809,540,540,180,,,180,,540,5040,7740,,,2160,3581.5,3662,,2520,,,540,2700,-0.23
256312393810,180,6480,1800,,,5400,,,540,,,,,,,,,,,,,-0.23
256312393813,,540,900,,,,,,3600,3060,,,1620,3060,,,1080,,,720,540,-0.23
256312393814,1260,2700,540,,,1260,1440,,,2520,,3060,3060,7560,,,,,,,,-0.23
256312393815,540,720,720,,,,,,,1620,,,,,,,,,,,1080,-0.23
256312393817,7020,2160,,,,360,900,,360,3600,240,,,15566.5,,,12600,,,4680,3960,-0.23
256312393818,,,,,,,2160,,,,,,,,,,,,,720,,-0.23
256312393819,1800,1440,360,,,2520,2520,2700,1620,1440,,,1440,540,720,,,,,1440,1800,-0.23
256312393820,360,1800,180,,,360,1260,360,1800,360,,,360,540,900,,,,,2340,180,-0.23
256312393821,3060,,900,,,1800,1980,540,2160,1260,,,4320,1980,2880,,720,,,1260,3780,-0.23
256312393822,900,4500,1680,,,1440,360,180,180,3780,840,,1260,900,5760,,2880,,,1080,1620,-0.23
256312393823,6480,1260,3024,,,3600,360,,,,,,,,,,,,,,,-0.23
256312393900,2160,7200,2880,1860,,4320,3600,3420,1080,3600,300,,3420,2102,,,,,,3600,360,-0.23
256312514764,,,,,,,,,,0,,,,0,,,,,,,,-0.23
256312515100,,,,,,,,,,,,,,,,,,,,,0,-0.23
256312515262,,,,,,,,,,,,,0,,,,,,,,,-0.23
256312516903,,,,,,0,0,,,,,,,,,,,,,,,-0.23
256312517064,,,,,,,,,,,,,0,,,,,,,,,0.45
256312517179,0,,,,,,,,,,,,,,,,,,,,,0.45
256312532532,,5220,2340,,,3060,4500,3960,3960,5040,2220,3840,2880,8460,3960,7740,12840,8340,9600,5400,5760,0.45
256322200137,1980,180,,5040,,20948,1800,900,540,5580,,,1800,,360,,3780,,,1260,900,0.45
256322200241,5121.9,,1317.06,,,1317.06,10975.5,4975.56,,3658.5,,,1170.72,878.04,1756.08,2780.46,,,,731.7,6219.24,0.45
256322200242,,,,,,585.36,1609.74,3512.16,3073.14,6585.3,,,5560.92,585.36,,439.02,,,,2634.12,439.02,0.45
256322200243,,3146.1,2780.46,97.56,,585.36,1170.72,,439.02,,,97.56,439.02,2341.44,3365.82,,,,,1170.72,585.36,0.45
256322200546,,,,,,,,,,,,,,,,,,60,1791,3420,,0.45
256322200857,,,,,,,,,,0,,,0,,,,,,,,,0.45
256322201100,13140,12240,11160,,,11700,10440,13860,15171,5400,,,13140,11700,7020,,10980,,,10620,,0.45
256322201103,20160,10800,24402,,,13320,1800,12960,7584,1440,,,11571,14580,6480,,11700,,,23940,15300,0.45
256322201244,,,180,,,180,,,,,,,,,,,,,,,,0.45
256322201313,,,180,,,,180,,2520,,,,360,3420,540,,,,,2584,,0.45
256322203151,,,,,,,,,,,,,,,,180,,,,,,0.45
256322203866,,180,,,,180,1800,180,1620,,,,,,2160,,360,,,180,360,0.45
256322315500,360,,,,,,,,,,,,,400,,,,,,,,-0.23
256322400003,3420,,180,,240,,,,2152,,360,,,,,,,,,,,-0.23
256322400004,,100,,,,,,,,0,,,,,,,,,,,,-0.23
256322400019,,,540,,,,,100,2340,,,,900,,,,1580,3360,,,,-0.23
256322400020,,,,,540,,,,,,780,1920,,,,,,4371,2820,,,-0.23
256322400021,180,5760,1800,2400,,3060,3060,,4140,,780,,2340,1980,2340,1260,180,,2580,2160,1440,-0.23
256322400025,,,,,,,,,3240,,360,1920,1440,6120,2700,,,1980,540,10800,1800,-0.23
256322400027,9460,14040,28520,14880,420,8640,26820,4860,,4680,9900,3840,10260,17820,,9900,5040,7500,780,24120,7920,-0.23
256322400028,5940,,10260,900,,9411,19440,1980,5220,,300,9060,2700,,13500,5940,8460,4620,,3420,4900,-0.23
256322400029,180,1520,360,300,,,360,,,15171,,115.5,,3665,,,6840,120,,180,,-0.23
256322400030,,,540,,,6570,720,,,360,,540,900,1260,180,3521.5,3160,,,,,-0.23
256322400032,,,,,,,,,,,3420,2400,,,,,,420,300,1800,3420,-0.23
256322400049,,,,,,,,360,,,,,,,,,,,,,,-0.23
256322400051,,,,60,,1080,,540,,,540,120,,,,1080,,,,540,,-0.23
256322400056,540,1865,,3500,1131,2700,900,,900,1260,900,0,5400,1180,6840,2880,2520,,4140,3240,2160,-0.23
256322400061,7920,540,180,965,600,180,,,0,,600,2765,5502,3260,2520,2880,3060,1860,2640,1820,2620,-0.23
256322400079,,,,,,,,,,,,,,,,,1180,,,,,-0.23
256322400085,360,100,1080,660,385,180,0,640,0,,1680,0,100,1200,1980,2700,1440,1260,900,720,180,-0.23
256322400086,3960,0,4680,2040,4920,2340,900,720,1080,1260,1800,420,8820,,1800,,540,120,5340,3240,180,-0.23
256322400097,720,1260,360,4320,4630,4270,4090,900,1260,3780,2040,6080,6480,720,540,1080,180,1860,1080,720,540,-0.23
256322400105,900,1080,6840,300,2760,2880,540,180,2880,2880,1080,2650,3780,4191,1800,,,60,,,,-0.23
256322400112,100,,,,,,,,,1180,60,300,,,,1260,,,,5040,1620,-0.23
256322400117,1080,2700,3060,,2460,,180,,180,3600,,,,,,180,7560,,,,,-0.23
256322400118,,,,,,,,,,,,,,,,,,,,,180,-0.23
256322400122,,0,0,,,,,,,360,180,540,5760,0,720,,2700,,1140,,,-0.23
256322400128,0,3060,2160,540,480,720,3060,3240,,2640,1200,3780,2340,640,2520,1620,4140,1020,3120,1440,3060,-0.23
256322400141,1440,720,6925,3240,1920,1260,3780,2520,3370,,605,60,1080,4320,360,360,1685,1020,2220,2520,3060,0.34
256322400143,2340,1620,,,1320,1980,,,,,,420,1440,,,,,,240,8640,3240,0.34
256322400148,1800,4680,1080,1620,1740,1080,1440,1080,7200,2660,5160,1740,,2140,,5760,5285,8400,,,2700,0.34
256322400150,4860,1800,2520,420,1860,1620,1260,900,,540,120,1800,,,900,,1260,300,2340,180,,0.34
256322400163,,,,0,540,0,3780,720,,,,60,900,,1620,,360,,240,3600,,0.34
256322400168,,,,3180,,1180,,,,,3120,,,,,,,5585,,,,0.34
256322400174,,,0,180,,,,,,,,,,,,,,,,,,0.34
256322400177,17380,30780,5580,1500,780,0,3240,9360,6531,5220,1560,4380,1980,7380,4860,3240,7020,8100,6240,2700,4500,0.34
256322400192,,2340,6120,2820,,5580,,9180,,3240,1320,1800,10440,2700,14760,,7920,480,2580,2520,,0.34
256322400194,,,,120,180,360,360,1851,,1260,180,120,,,180,,540,120,,,180,0.34
256322400195,,180,2160,4500,3660,7200,10440,540,,1800,1740,4080,9900,12780,1080,3780,0,1740,3000,8100,1440,0.34
256322400209,180,180,1000,,,360,,490,,,245,840,,17460,540,,,,,,1080,0.34
256322400210,,540,180,4980,7200,900,540,360,540,0,6240,9420,1440,1980,1440,1080,3960,3660,6180,,900,0.34
256322400216,1800,3600,720,1020,,900,3060,,720,,240,300,360,6300,2520,1980,2160,960,120,,180,0.34
256322400218,,,,240,,180,0,,,0,0,420,,,540,,,60,300,,540,0.34
256322400219,1440,900,1620,,3960,,,900,,1080,780,,,,1800,1440,0,1020,,1080,900,0.34
256322400221,2700,540,2520,2700,2220,5760,3240,3240,720,4320,6120,0,5400,7200,900,5220,1260,6360,4620,6300,8640,0.34
256322400226,180,180,1080,120,,,,,,,1140,,,360,180,,360,,,,180,0.34
256322400228,,0,,1260,1500,,,180,,,1860,960,,,1260,540,,720,1980,,,0.34
256322400230,5220,,,,,,,,180,900,4260,4260,4860,720,,180,1620,,,5760,3420,0.34
256322400232,540,13140,,120,,,,900,8820,,360,2280,0,,0,3305,,0,,,,0.34
run;
And what is the formula you used to get that slope?
Yes KurtBremser,
The column i have added was an example, it is not based on any formula,
My ploblem is I dont know what i should use to classify customers whose revenues have fallen during the 21 days,
Really i dont know which formula i should use. it is my problem
Toni
Ok, now we're getting somewhere.
The simplest thing would be to compare the first half against the second:
data want;
set have;
array revs {*} rev1-rev21;
do i = 1 to dim(revs); /* set missing to zero */
if missing(revs{i}) then revs{i} = 0;
end;
drop i;
if sum(of rev1-rev21) ne 0; /* don't calculate when there's no revenue at all */
sum_start = sum(of rev1-rev10);
sum_end = sum(of rev12-rev21);
slope = (sum_end - sum_start) / (sum_end + sum_start);
run;
This method could be expanded to calculate more smaller groups and the individual differences between them.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.