<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Macro for proc univariate statistic from overlapping time periods in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638182#M189764</link>
    <description>&lt;P&gt;Macros are not needed. If you search the Internet for "rolling window regression" you can find code to do this without macros. It's the same concept, you can do this as "rolling window PROC UNIVARIATE".&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Tue, 07 Apr 2020 22:26:02 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-04-07T22:26:02Z</dc:date>
    <item>
      <title>Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638177#M189760</link>
      <description>&lt;P&gt;Hello&amp;nbsp; SAS community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to build a macro (using SAS 9.4) that will generate the coefficient of variation from PROC UNIVARIATE for overlapping time periods (annual data, so blocks consist of multiple years). For example, say a block of years is 1988-1991, then the next block will be 1989-1992 .... ending with 2015-2018. Big idea is to build a data set where each observation contains a block ID, N (# obs) and CV (Coeff of Variation for a block say 1988-1991).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with the attached macro (where I credit another author, as I am borrowing his/her code as a starting point for this project), then added my own modifications.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A subset of 100 obs from my data set appears below where the columns represent firm_id, year, quarter and cash_flow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As written, the SAS log generates no errors, and the results appear annually rather than as a group or block of years (e.g., each obs reports the CV for a single year instead of CV for a group of years).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am grateful for any insight you might have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;datalines;&lt;BR /&gt;001003 1988 1 -1.611&lt;BR /&gt;001003 1988 2 -0.821&lt;BR /&gt;001003 1988 3 0.814&lt;BR /&gt;001003 1988 4 -0.482&lt;BR /&gt;001003 1989 2 .&lt;BR /&gt;001003 1989 4 .&lt;BR /&gt;001003 1990 1 -0.367&lt;BR /&gt;001003 1990 2 -0.146&lt;BR /&gt;001003 1990 3 0.128&lt;BR /&gt;001004 1988 1 .&lt;BR /&gt;001004 1988 2 -0.163&lt;BR /&gt;001004 1988 3 -2.961&lt;BR /&gt;001004 1988 4 4.214&lt;BR /&gt;001004 1989 1 -6.536&lt;BR /&gt;001004 1989 2 7.916&lt;BR /&gt;001004 1989 3 5.385&lt;BR /&gt;001004 1989 4 12.606&lt;BR /&gt;001004 1990 1 9.051&lt;BR /&gt;001004 1990 2 2.079&lt;BR /&gt;001004 1990 3 29.324&lt;BR /&gt;001004 1990 4 -3.563&lt;BR /&gt;001004 1991 1 -0.546&lt;BR /&gt;001004 1991 2 -4.623&lt;BR /&gt;001004 1991 3 -0.884&lt;BR /&gt;001004 1991 4 14.867&lt;BR /&gt;001004 1992 1 -0.701&lt;BR /&gt;001004 1992 2 0.98&lt;BR /&gt;001004 1992 3 5.248&lt;BR /&gt;001004 1992 4 11.279&lt;BR /&gt;001004 1993 1 6.462&lt;BR /&gt;001004 1993 2 2.21&lt;BR /&gt;001004 1993 3 -16.931&lt;BR /&gt;001004 1993 4 14.956&lt;BR /&gt;001004 1994 1 -8.87&lt;BR /&gt;001004 1994 2 -5.816&lt;BR /&gt;001004 1994 3 11.472&lt;BR /&gt;001004 1994 4 18.469&lt;BR /&gt;001004 1995 1 7.026&lt;BR /&gt;001004 1995 2 -2.574&lt;BR /&gt;001004 1995 3 9.293&lt;BR /&gt;001004 1995 4 11.015&lt;BR /&gt;001004 1996 1 10.242&lt;BR /&gt;001004 1996 2 0.871&lt;BR /&gt;001004 1996 3 -7.131&lt;BR /&gt;001004 1996 4 5.549&lt;BR /&gt;001004 1997 1 1.489&lt;BR /&gt;001004 1997 2 -19.391&lt;BR /&gt;001004 1997 3 7.739&lt;BR /&gt;001004 1997 4 32.986&lt;BR /&gt;001004 1998 1 15.101&lt;BR /&gt;001004 1998 2 -9.49&lt;BR /&gt;001004 1998 3 18.175&lt;BR /&gt;001004 1998 4 4.739&lt;BR /&gt;001004 1999 1 -20.67&lt;BR /&gt;001004 1999 2 15.123&lt;BR /&gt;001004 1999 3 11.214&lt;BR /&gt;001004 1999 4 4.384&lt;BR /&gt;001004 2000 1 -7.743&lt;BR /&gt;001004 2000 2 17.893&lt;BR /&gt;001004 2000 3 -8.235&lt;BR /&gt;001004 2000 4 44.178&lt;BR /&gt;001004 2001 1 -26.131&lt;BR /&gt;001004 2001 2 9.186&lt;BR /&gt;001004 2001 3 1.333&lt;BR /&gt;001004 2001 4 -17.703&lt;BR /&gt;001004 2002 1 4.796&lt;BR /&gt;001004 2002 2 4.343&lt;BR /&gt;001004 2002 3 2.749&lt;BR /&gt;001004 2002 4 22.845&lt;BR /&gt;001004 2003 1 9.035&lt;BR /&gt;001004 2003 2 25.139&lt;BR /&gt;001004 2003 3 -32.777&lt;BR /&gt;001004 2003 4 13.175&lt;BR /&gt;001004 2004 1 5.552&lt;BR /&gt;001004 2004 2 3.019&lt;BR /&gt;001004 2004 3 19.458&lt;BR /&gt;001004 2004 4 22.909&lt;BR /&gt;001004 2005 1 -21.698&lt;BR /&gt;001004 2005 2 -1.618&lt;BR /&gt;001004 2005 3 -38.759&lt;BR /&gt;001004 2005 4 21.593&lt;BR /&gt;001004 2006 1 -1.851&lt;BR /&gt;001004 2006 2 6.256&lt;BR /&gt;001004 2006 3 -3.505&lt;BR /&gt;001004 2006 4 -22.139&lt;BR /&gt;001004 2007 1 2.06&lt;BR /&gt;001004 2007 2 -51.21&lt;BR /&gt;001004 2007 3 22.402&lt;BR /&gt;001004 2007 4 43.674&lt;BR /&gt;001004 2008 1 -10.499&lt;BR /&gt;001004 2008 2 18.626&lt;BR /&gt;001004 2008 3 -16.055&lt;BR /&gt;001004 2008 4 72.379&lt;BR /&gt;001004 2009 1 34.122&lt;BR /&gt;001004 2009 2 24.014&lt;BR /&gt;001004 2009 3 36.511&lt;BR /&gt;001004 2009 4 58.509&lt;BR /&gt;001004 2010 1 7.218&lt;BR /&gt;001004 2010 2 22.594&lt;BR /&gt;001004 2010 3 30.09&lt;BR /&gt;001004 2010 4 48.696&lt;BR /&gt;001004 2011 1 -25.612&lt;BR /&gt;001004 2011 2 30.411&lt;BR /&gt;001004 2011 3 13.432&lt;BR /&gt;001004 2011 4 75.986&lt;BR /&gt;001004 2012 1 33.2&lt;BR /&gt;001004 2012 2 27.1&lt;BR /&gt;001004 2012 3 27.5&lt;BR /&gt;001004 2012 4 75.1&lt;BR /&gt;001004 2013 1 27.5&lt;BR /&gt;001004 2013 2 38.8&lt;BR /&gt;001004 2013 3 10.4&lt;BR /&gt;001004 2013 4 63.1&lt;BR /&gt;001004 2014 1 15&lt;BR /&gt;001004 2014 2 16&lt;BR /&gt;001004 2014 3 -22&lt;BR /&gt;001004 2014 4 -52&lt;BR /&gt;001004 2015 1 -63.7&lt;BR /&gt;001004 2015 2 47.8&lt;BR /&gt;001004 2015 3 2&lt;BR /&gt;001004 2015 4 46&lt;BR /&gt;001004 2016 1 -1.1&lt;BR /&gt;001004 2016 2 -0.1&lt;BR /&gt;001004 2016 3 -10&lt;BR /&gt;001004 2016 4 33&lt;BR /&gt;001004 2017 1 -20.6&lt;BR /&gt;001004 2017 2 10.7&lt;BR /&gt;001004 2017 3 42.8&lt;BR /&gt;001004 2017 4 31.4&lt;BR /&gt;001004 2018 1 -27&lt;BR /&gt;001004 2018 2 -8.5&lt;BR /&gt;001004 2018 3 60&lt;BR /&gt;001009 1988 4 .&lt;BR /&gt;001009 1989 1 0.615&lt;BR /&gt;001009 1989 2 -0.118&lt;BR /&gt;001009 1989 3 0.184&lt;BR /&gt;001009 1989 4 1.545&lt;BR /&gt;001009 1990 1 0.504&lt;BR /&gt;001009 1990 2 -0.218&lt;BR /&gt;001009 1990 3 1.362&lt;BR /&gt;001009 1990 4 0.427&lt;BR /&gt;001009 1991 2 .&lt;BR /&gt;001009 1991 3 1.216&lt;BR /&gt;001009 1991 4 1.749&lt;BR /&gt;001009 1992 1 1.241&lt;BR /&gt;001009 1992 2 -0.928&lt;BR /&gt;001009 1992 3 2.947&lt;BR /&gt;001009 1992 4 2.764&lt;BR /&gt;001009 1993 1 -0.822&lt;BR /&gt;001009 1993 2 1.492&lt;BR /&gt;001009 1993 3 0.187&lt;BR /&gt;001009 1993 4 2.59&lt;BR /&gt;001009 1994 1 0.858&lt;BR /&gt;001009 1994 2 1.495&lt;BR /&gt;001009 1994 3 -0.354&lt;BR /&gt;001009 1994 4 -0.074&lt;BR /&gt;001009 1995 1 -2.266&lt;BR /&gt;001009 1995 2 1.74&lt;BR /&gt;001009 1995 3 -4.336&lt;BR /&gt;001010 1988 4 .&lt;BR /&gt;001010 1989 1 -0.416&lt;BR /&gt;001010 1989 2 50.204&lt;BR /&gt;001010 1989 3 13.26&lt;BR /&gt;001010 1989 4 37.784&lt;BR /&gt;001010 1990 1 6.117&lt;BR /&gt;001010 1990 2 5.8&lt;BR /&gt;001010 1990 3 11.777&lt;BR /&gt;001010 1990 4 4.683&lt;BR /&gt;001010 1991 1 5.861&lt;BR /&gt;001010 1991 2 13.584&lt;BR /&gt;001010 1991 3 20.175&lt;BR /&gt;001010 1991 4 8.949&lt;BR /&gt;001010 1992 1 11.835&lt;BR /&gt;001010 1992 2 6.896&lt;BR /&gt;001010 1992 3 29.445&lt;BR /&gt;001010 1992 4 14.032&lt;BR /&gt;001010 1993 1 9.624&lt;BR /&gt;001010 1993 2 -17.979&lt;BR /&gt;001010 1993 3 -32.509&lt;BR /&gt;001010 1993 4 49.569&lt;BR /&gt;001010 1994 1 23.222&lt;BR /&gt;001010 1994 2 19.236&lt;BR /&gt;001010 1994 3 14.442&lt;BR /&gt;001010 1994 4 -20.7&lt;BR /&gt;001010 1995 1 46.4&lt;BR /&gt;001010 1995 3 .&lt;BR /&gt;001010 1995 4 20.5&lt;BR /&gt;001010 1996 1 16.6&lt;BR /&gt;001010 1996 2 -2.2&lt;BR /&gt;001010 1996 3 44.2&lt;BR /&gt;001010 1996 4 21.4&lt;BR /&gt;001010 1997 1 14.1&lt;BR /&gt;001010 1997 2 48&lt;BR /&gt;001010 1997 3 17.9&lt;BR /&gt;001010 1997 4 10.9&lt;BR /&gt;001010 1998 1 50.4&lt;BR /&gt;001010 1998 2 1.6&lt;BR /&gt;001010 1998 3 9&lt;BR /&gt;001010 1998 4 31.4&lt;BR /&gt;001010 1999 1 26.5&lt;BR /&gt;001010 1999 2 15.4&lt;BR /&gt;001010 1999 4 .&lt;BR /&gt;001010 2000 1 30.6&lt;BR /&gt;001010 2000 2 -2.1&lt;BR /&gt;001010 2000 3 -13.9&lt;BR /&gt;001010 2000 4 22.5&lt;BR /&gt;001010 2001 1 16.1&lt;BR /&gt;001010 2001 2 26.2&lt;BR /&gt;001010 2001 3 21.3&lt;BR /&gt;001010 2001 4 50.6&lt;BR /&gt;001010 2002 1 34.3&lt;BR /&gt;001010 2002 2 -1.5&lt;BR /&gt;001010 2002 3 12&lt;BR /&gt;001010 2002 4 120.5&lt;BR /&gt;001010 2003 1 72.6&lt;BR /&gt;001010 2003 2 -28.5&lt;BR /&gt;001010 2003 3 28.6&lt;BR /&gt;001010 2003 4 -118.4&lt;BR /&gt;001010 2004 1 -48.2&lt;BR /&gt;001010 2004 2 89.1&lt;BR /&gt;001011 1988 4 .&lt;BR /&gt;001011 1989 1 -0.223&lt;BR /&gt;001011 1989 2 0.086&lt;BR /&gt;001011 1989 3 0.042&lt;BR /&gt;001011 1989 4 -0.43&lt;BR /&gt;001011 1990 1 -0.32&lt;BR /&gt;001011 1990 2 -0.236&lt;BR /&gt;001011 1990 3 0.012&lt;BR /&gt;001011 1990 4 -0.237&lt;BR /&gt;001011 1991 1 0.092&lt;BR /&gt;001011 1991 2 -0.276&lt;BR /&gt;001011 1991 3 -0.009&lt;BR /&gt;001011 1991 4 -0.05&lt;BR /&gt;001011 1992 1 -0.398&lt;BR /&gt;001011 1992 2 -0.393&lt;BR /&gt;001011 1992 3 0.225&lt;BR /&gt;001011 1992 4 -0.375&lt;BR /&gt;001011 1993 1 -0.326&lt;BR /&gt;001011 1993 2 -0.055&lt;BR /&gt;001011 1993 3 -0.765&lt;BR /&gt;001011 1993 4 0.329&lt;BR /&gt;001011 1994 1 -1.71&lt;BR /&gt;001011 1994 2 -1.453&lt;BR /&gt;001011 1994 3 0.58&lt;BR /&gt;001011 1994 4 5.302&lt;BR /&gt;001011 1995 1 1.144&lt;BR /&gt;001011 1995 2 -1.703&lt;BR /&gt;001012 1988 4 .&lt;BR /&gt;001012 1989 1 -0.422&lt;BR /&gt;001012 1989 2 0.487&lt;BR /&gt;001012 1989 3 3.143&lt;BR /&gt;001012 1989 4 -0.473&lt;BR /&gt;001012 1990 1 -0.32&lt;BR /&gt;001013 1988 1 .&lt;BR /&gt;001013 1988 2 4.555&lt;BR /&gt;001013 1988 3 8.855&lt;BR /&gt;001013 1988 4 9.31&lt;BR /&gt;001013 1989 1 2.9&lt;BR /&gt;001013 1989 2 7.216&lt;BR /&gt;001013 1989 3 2.682&lt;BR /&gt;001013 1989 4 5.102&lt;BR /&gt;001013 1990 1 7.139&lt;BR /&gt;001013 1990 2 5.233&lt;BR /&gt;001013 1990 3 9.903&lt;BR /&gt;001013 1990 4 12.42&lt;BR /&gt;001013 1991 1 7.194&lt;BR /&gt;001013 1991 2 3.232&lt;BR /&gt;001013 1991 3 11.157&lt;BR /&gt;001013 1991 4 15.12&lt;BR /&gt;001013 1992 1 3.759&lt;BR /&gt;001013 1992 2 7.628&lt;BR /&gt;001013 1992 3 11.771&lt;BR /&gt;001013 1992 4 11.597&lt;BR /&gt;001013 1993 1 9.565&lt;BR /&gt;001013 1993 2 0.021&lt;BR /&gt;001013 1993 3 12.19&lt;BR /&gt;001013 1993 4 7.672&lt;BR /&gt;001013 1994 1 20.251&lt;BR /&gt;001013 1994 2 1.941&lt;BR /&gt;001013 1994 3 15.75&lt;BR /&gt;001013 1994 4 20.259&lt;BR /&gt;001013 1995 1 6.023&lt;BR /&gt;001013 1995 2 -2.718&lt;BR /&gt;001013 1995 3 18.226&lt;BR /&gt;001013 1995 4 22.728&lt;BR /&gt;001013 1996 1 4.874&lt;BR /&gt;001013 1996 2 -1.478&lt;BR /&gt;001013 1996 3 23.333&lt;BR /&gt;001013 1996 4 36.728&lt;BR /&gt;001013 1997 1 24.223&lt;BR /&gt;001013 1997 2 14.357&lt;BR /&gt;001013 1997 3 27.754&lt;BR /&gt;001013 1997 4 13.379&lt;BR /&gt;001013 1998 1 23.547&lt;BR /&gt;001013 1998 2 20.203&lt;BR /&gt;001013 1998 3 9.79&lt;BR /&gt;001013 1998 4 28.538&lt;BR /&gt;001013 1999 1 104.477&lt;BR /&gt;001013 1999 2 85.555&lt;BR /&gt;001013 1999 3 60.486&lt;BR /&gt;001013 1999 4 81.763&lt;BR /&gt;001013 2000 1 41.582&lt;BR /&gt;001013 2000 2 85.354&lt;BR /&gt;001013 2000 3 -47.225&lt;BR /&gt;001013 2000 4 141.689&lt;BR /&gt;001013 2001 1 -87.3&lt;BR /&gt;001013 2001 2 27.8&lt;BR /&gt;001013 2001 3 71.6&lt;BR /&gt;001013 2001 4 82.9&lt;BR /&gt;001013 2002 1 132.1&lt;BR /&gt;001013 2002 2 82.4&lt;BR /&gt;001013 2002 3 -49.5&lt;BR /&gt;001013 2002 4 -104.5&lt;BR /&gt;001013 2003 1 50.2&lt;BR /&gt;001013 2003 2 -36.2&lt;BR /&gt;001013 2003 3 16.6&lt;BR /&gt;001013 2003 4 8.3&lt;BR /&gt;001013 2004 1 -6.2&lt;BR /&gt;001013 2004 2 2.9&lt;BR /&gt;001013 2004 3 -15.6&lt;BR /&gt;001013 2004 4 22&lt;BR /&gt;001013 2005 1 -16.1&lt;BR /&gt;001013 2005 2 -1.2&lt;BR /&gt;001013 2005 3 25.2&lt;BR /&gt;001013 2005 4 50.7&lt;BR /&gt;001013 2006 1 -13.7&lt;BR /&gt;001013 2006 2 43.6&lt;BR /&gt;001013 2006 3 21.7&lt;BR /&gt;001013 2006 4 35.5&lt;BR /&gt;001013 2007 1 25.8&lt;BR /&gt;001013 2007 2 41.1&lt;BR /&gt;001013 2007 3 28.8&lt;BR /&gt;001013 2007 4 46.1&lt;BR /&gt;001013 2008 1 5.1&lt;BR /&gt;001013 2008 2 49.4&lt;BR /&gt;001013 2008 3 56&lt;BR /&gt;001013 2008 4 65.1&lt;BR /&gt;001013 2009 1 -19.2&lt;BR /&gt;001013 2009 2 24.4&lt;BR /&gt;001013 2009 3 47.5&lt;BR /&gt;001013 2010 1 .&lt;BR /&gt;001013 2010 2 2.6&lt;BR /&gt;001013 2010 3 85.3&lt;BR /&gt;001013 2010 4 34.4&lt;BR /&gt;001017 1988 1 -6.5&lt;BR /&gt;001017 1988 2 -3.069&lt;BR /&gt;001017 1988 3 2.237&lt;BR /&gt;001017 1988 4 -0.624&lt;BR /&gt;001017 1989 1 3.536&lt;BR /&gt;001017 1989 2 0.4&lt;BR /&gt;001017 1989 3 7.46&lt;BR /&gt;001017 1989 4 1.047&lt;BR /&gt;001017 1990 1 1.165&lt;BR /&gt;001017 1990 2 1.358&lt;BR /&gt;001017 1990 3 5.141&lt;BR /&gt;001017 1990 4 2.33&lt;BR /&gt;001017 1991 1 3.938&lt;BR /&gt;001017 1991 2 5.732&lt;BR /&gt;001017 1991 3 0.547&lt;BR /&gt;001017 1991 4 2.031&lt;BR /&gt;001017 1992 1 -0.331&lt;BR /&gt;001017 1992 2 0.084&lt;BR /&gt;001017 1992 3 0.694&lt;BR /&gt;001017 1992 4 2.608&lt;BR /&gt;001017 1993 1 2.607&lt;BR /&gt;001017 1993 2 1.681&lt;BR /&gt;001017 1993 3 4.947&lt;BR /&gt;001017 1993 4 -0.419&lt;BR /&gt;001017 1994 1 1.287&lt;BR /&gt;001017 1994 2 1.859&lt;BR /&gt;001017 1994 3 -2.408&lt;BR /&gt;001017 1994 4 1.087&lt;BR /&gt;001017 1995 1 -2.619&lt;BR /&gt;001017 1995 2 0.176&lt;BR /&gt;001017 1995 3 3.299&lt;BR /&gt;001019 1988 4 .&lt;BR /&gt;001019 1989 1 0.648&lt;BR /&gt;001019 1989 2 1.172&lt;BR /&gt;001019 1989 3 0.991&lt;BR /&gt;001019 1989 4 0.812&lt;BR /&gt;001019 1990 1 1.435&lt;BR /&gt;001019 1990 2 1.02&lt;BR /&gt;001019 1990 3 1.668&lt;BR /&gt;001019 1990 4 -0.04&lt;BR /&gt;001019 1991 1 0.589&lt;BR /&gt;001019 1991 2 1.105&lt;BR /&gt;001019 1991 3 0.893&lt;BR /&gt;001019 1991 4 0.903&lt;BR /&gt;001019 1992 1 0.424&lt;BR /&gt;001019 1992 4 .&lt;BR /&gt;001019 1993 4 .&lt;BR /&gt;001019 1994 4 .&lt;BR /&gt;001019 1995 4 .&lt;BR /&gt;001019 1996 4 .&lt;BR /&gt;001019 1997 4 .&lt;BR /&gt;001019 1998 4 .&lt;BR /&gt;001019 1999 4 .&lt;BR /&gt;001019 2000 4 .&lt;BR /&gt;001019 2001 4 .&lt;BR /&gt;001020 1988 4 .&lt;BR /&gt;001020 1989 1 13.263&lt;BR /&gt;001020 1989 2 7.614&lt;BR /&gt;001020 1989 3 14.021&lt;BR /&gt;001020 1989 4 10.284&lt;BR /&gt;001020 1990 1 -11.182&lt;BR /&gt;001021 1988 4 .&lt;BR /&gt;001021 1989 1 -0.522&lt;BR /&gt;001021 1989 2 -0.903&lt;BR /&gt;001021 1989 3 0.643&lt;BR /&gt;001021 1989 4 2.066&lt;BR /&gt;001021 1990 1 -0.195&lt;BR /&gt;001021 1990 2 -0.301&lt;BR /&gt;001021 1990 3 0.488&lt;BR /&gt;001021 1990 4 0.873&lt;BR /&gt;001021 1991 2 .&lt;BR /&gt;001021 1991 3 0.146&lt;BR /&gt;001021 1991 4 1.036&lt;BR /&gt;001021 1992 1 0.9&lt;BR /&gt;001021 1992 2 1.959&lt;BR /&gt;001021 1992 3 -0.4&lt;BR /&gt;001021 1992 4 1.348&lt;BR /&gt;001021 1993 1 -0.484&lt;BR /&gt;001021 1993 2 0.911&lt;BR /&gt;001021 1993 3 0.831&lt;BR /&gt;001021 1993 4 -0.12&lt;BR /&gt;001021 1994 1 0.156&lt;BR /&gt;001021 1994 2 0.232&lt;BR /&gt;001021 1994 3 0.454&lt;BR /&gt;001021 1994 4 0.828&lt;BR /&gt;001021 1995 1 0.497&lt;BR /&gt;001021 1995 2 0.718&lt;BR /&gt;001021 1995 3 0.546&lt;BR /&gt;001021 1995 4 1.152&lt;BR /&gt;001021 1996 1 -0.926&lt;BR /&gt;001021 1996 2 -0.33&lt;BR /&gt;001021 1996 4 .&lt;BR /&gt;001021 1997 1 1.875&lt;BR /&gt;001021 1997 2 0.662&lt;BR /&gt;001021 1997 3 1.953&lt;BR /&gt;001021 1997 4 0.983&lt;BR /&gt;001021 1998 1 0.383&lt;BR /&gt;001021 1998 2 -0.368&lt;BR /&gt;001021 1998 3 -1.377&lt;BR /&gt;001021 1998 4 0.704&lt;BR /&gt;001021 1999 1 0.109&lt;BR /&gt;001021 1999 2 -0.312&lt;BR /&gt;001021 1999 3 0.266&lt;BR /&gt;001021 1999 4 0.26&lt;BR /&gt;001021 2000 1 0.489&lt;BR /&gt;001021 2000 2 0.995&lt;BR /&gt;001021 2000 3 -0.166&lt;BR /&gt;001021 2000 4 0.239&lt;BR /&gt;001021 2001 1 0.339&lt;BR /&gt;001021 2001 2 0.63&lt;BR /&gt;001021 2001 3 -0.095&lt;BR /&gt;001021 2001 4 0.148&lt;BR /&gt;001021 2002 1 0.287&lt;BR /&gt;001021 2002 2 0.529&lt;BR /&gt;001021 2002 3 0.157&lt;BR /&gt;001021 2002 4 0.177&lt;BR /&gt;001021 2003 1 -0.349&lt;BR /&gt;001021 2003 2 0.761&lt;BR /&gt;001021 2003 3 -0.046&lt;BR /&gt;001021 2003 4 0.096&lt;BR /&gt;001021 2004 1 0.601&lt;BR /&gt;001021 2004 2 0.577&lt;BR /&gt;001021 2004 3 0.244&lt;BR /&gt;001021 2004 4 -0.541&lt;BR /&gt;001021 2005 1 0.095&lt;BR /&gt;001021 2005 2 0.594&lt;BR /&gt;001021 2005 3 0.512&lt;BR /&gt;001021 2005 4 -0.076&lt;BR /&gt;001021 2006 1 -0.335&lt;BR /&gt;001021 2006 2 1.171&lt;BR /&gt;001021 2006 3 0.291&lt;BR /&gt;001021 2006 4 -0.193&lt;BR /&gt;001021 2007 1 -0.876&lt;BR /&gt;001021 2007 2 0.574&lt;BR /&gt;001021 2007 3 0.498&lt;BR /&gt;001021 2007 4 -1.74&lt;BR /&gt;001021 2008 1 -0.685&lt;BR /&gt;001021 2008 2 -0.154&lt;BR /&gt;001021 2008 3 -0.754&lt;BR /&gt;001021 2008 4 -0.703&lt;BR /&gt;001021 2009 1 -0.861&lt;BR /&gt;001021 2009 2 2.252&lt;BR /&gt;001021 2009 3 -0.854&lt;BR /&gt;001023 1988 1 .&lt;BR /&gt;001023 1988 2 6.817&lt;BR /&gt;001025 1988 1 .&lt;BR /&gt;001025 1988 2 -0.243&lt;BR /&gt;001025 1988 3 -0.128&lt;BR /&gt;001025 1988 4 -0.28&lt;BR /&gt;001025 1989 1 -0.292&lt;BR /&gt;001025 1989 2 -0.746&lt;BR /&gt;001025 1989 3 0.135&lt;BR /&gt;001025 1989 4 0.374&lt;BR /&gt;001025 1990 1 0.5&lt;BR /&gt;001025 1990 2 -0.025&lt;BR /&gt;001025 1990 3 -0.443&lt;BR /&gt;;;;;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 22:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638177#M189760</guid>
      <dc:creator>rfrancis</dc:creator>
      <dc:date>2020-04-07T22:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638179#M189761</link>
      <description>&lt;P&gt;Are you set with a macro? Any reason to not use PROC EXPAND (if you have SAS ETS licensed) or a MultiLabel Format which would do this much easier?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
array p{0:3} _temporary_;
set have; 
by ID;
if first.ID then do; 
call missing(of p{*}); 
counter=1;
end;
counter+1;
p{mod(_n_,4)} = value;
if counter&amp;gt;3 then do;&lt;BR /&gt;YearRange = catx('/', year, year-3);
moving_average = mean(of p{*});
moving_cv = cv(of p{*});
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 22:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638179#M189761</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-04-07T22:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638180#M189762</link>
      <description>And I think you forgot the first few lines of your code there?</description>
      <pubDate>Tue, 07 Apr 2020 22:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638180#M189762</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-04-07T22:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638182#M189764</link>
      <description>&lt;P&gt;Macros are not needed. If you search the Internet for "rolling window regression" you can find code to do this without macros. It's the same concept, you can do this as "rolling window PROC UNIVARIATE".&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Apr 2020 22:26:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638182#M189764</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-07T22:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638188#M189768</link>
      <description>I've seen the rolling regression code on the web. The pgms are generally quite long and much more complicated than what is needed for my application. I hesitate to say my application is simple, but in a relative sense, my application is much more simple than the pgms which appear on the web.</description>
      <pubDate>Tue, 07 Apr 2020 22:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638188#M189768</guid>
      <dc:creator>rfrancis</dc:creator>
      <dc:date>2020-04-07T22:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638189#M189769</link>
      <description>I think the code is in the attachment .... maybe the attachment did not go through.</description>
      <pubDate>Tue, 07 Apr 2020 22:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638189#M189769</guid>
      <dc:creator>rfrancis</dc:creator>
      <dc:date>2020-04-07T22:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638196#M189771</link>
      <description>&lt;P&gt;Okay, I disagree that the problem is as simple as your are implying, unless you have access to PROC EXPAND. Nevertheless, this code is about as simple as it gets: &lt;A href="http://pages.stern.nyu.edu/~adesouza/sasfinphd/index/node25.html" target="_blank" rel="noopener"&gt;http://pages.stern.nyu.edu/~adesouza/sasfinphd/index/node25.html&lt;/A&gt;. If you find a solution that is simpler, please let me know.&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Apr 2020 23:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638196#M189771</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-07T23:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638204#M189776</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321440"&gt;@rfrancis&lt;/a&gt;&amp;nbsp;did you see the array code I posted? That should work perfectly fine for the data you posted. You didn't include variable names so you'll have to figure out how to map it but in general, moving statistics are trivial and do not need a macro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 00:25:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638204#M189776</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-04-08T00:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for proc univariate statistic from overlapping time periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638208#M189780</link>
      <description>Hi Reeza, I see your array code, thank you!!</description>
      <pubDate>Wed, 08 Apr 2020 00:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-proc-univariate-statistic-from-overlapping-time/m-p/638208#M189780</guid>
      <dc:creator>rfrancis</dc:creator>
      <dc:date>2020-04-08T00:49:33Z</dc:date>
    </item>
  </channel>
</rss>

