Good morning everyone.
I have a dataset with 108 observation. I also have three observation per month, and i want to create a mean variable which calculates the mean of these three values with respect to the same month. I'll post an example of the dataset to be more clear.
I thought about using a loop but I don't know how to do it.
I have a dataset with 108 observation. I also have three observation per month, and i want to create a mean variable which calculates the mean of these three values with respect to the same month. I'll post an example of the dataset to be more clear.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int year byte(month dekad) float(ndvi average) 2016 1 1 .2734 .2317 2016 1 2 .241 .2154 2016 1 3 .2141 .2017 2016 2 1 .1942 .19 2016 2 2 .1834 .182 2016 2 3 .1792 .1783 2016 3 1 .1781 .1797 2016 3 2 .1787 .1883 2016 3 3 .182 .2068 2016 4 1 .1937 .2327 2016 4 2 .2187 .2589 2016 4 3 .2556 .2797 2016 5 1 .292 .2883 2016 5 2 .3067 .2814 2016 5 3 .2954 .2616 2016 6 1 .2687 .2378 2016 6 2 .2401 .2168 2016 6 3 .2174 .2004 2016 7 1 .2027 .1898 2016 7 2 .1925 .1784 2016 7 3 .1847 .1753 2016 8 1 .1787 .1739 2016 8 2 .173 .173 2016 8 3 .1685 .1717 2016 9 1 .1658 .1701 2016 9 2 .1644 .1686 2016 9 3 .1629 .1682 2016 10 1 .1616 .1715 2016 10 2 .1618 .1817 2016 10 3 .1648 .2005 2016 11 1 .1714 .2242 2016 11 2 .1813 .2451 2016 11 3 .1929 .2581 2016 12 1 .1986 .2624 2016 12 2 .1954 .2589 2016 12 3 .187 .2482 2017 1 1 .177 .2317 2017 1 2 .1687 .2154 2017 1 3 .1623 .2017 2017 2 1 .1589 .19 2017 2 2 .158 .182 2017 2 3 .1577 .1783 2017 3 1 .1573 .1797 2017 3 2 .1568 .1883 2017 3 3 .1585 .2068 2017 4 1 .164 .2327 2017 4 2 .1732 .2589 2017 4 3 .1869 .2797 2017 5 1 .2038 .2883 2017 5 2 .2145 .2814 2017 5 3 .2111 .2616 2017 6 1 .2004 .2378 2017 6 2 .1893 .2168 2017 6 3 .1792 .2004 2017 7 1 .1721 .1898 2017 7 2 .1703 .1784 2017 7 3 .1719 .1753 2017 8 1 .1727 .1739 2017 8 2 .1716 .173 2017 8 3 .1708 .1717 2017 9 1 .1722 .1701 2017 9 2 .1739 .1686 2017 9 3 .1751 .1682 2017 10 1 .1795 .1715 2017 10 2 .1956 .1817 2017 10 3 .2279 .2005 2017 11 1 .2668 .2242 2017 11 2 .2879 .2451 2017 11 3 .2842 .2581 2017 12 1 .2633 .2624 2017 12 2 .2373 .2589 2017 12 3 .2114 .2482 2018 1 1 .188 .2317 2018 1 2 .1722 .2154 2018 1 3 .1645 .2017 2018 2 1 .1604 .19 2018 2 2 .1632 .182 2018 2 3 .176 .1783 2018 3 1 .2045 .1797 2018 3 2 .257 .1883 2018 3 3 .3333 .2068 2018 4 1 .4153 .2327 2018 4 2 .4861 .2589 2018 4 3 .5296 .2797 2018 5 1 .5274 .2883 2018 5 2 .4871 .2814 2018 5 3 .4312 .2616 2018 6 1 .3817 .2378 2018 6 2 .3451 .2168 2018 6 3 .3107 .2004 2018 7 1 .2788 .1898 2018 7 2 .2522 .1784 2018 7 3 .2324 .1753 2018 8 1 .2201 .1739 2018 8 2 .213 .173 2018 8 3 .208 .1717 2018 9 1 .2038 .1701 2018 9 2 .1993 .1686 2018 9 3 .1962 .1682 2018 10 1 .1973 .1715 end
Comment