<?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: Estimate standard deviation quarter by quarter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420160#M280597</link>
    <description>&lt;P&gt;if this is only&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;qtr/monthly intervals, it might be a good case to demonstrate array handling. SAS/IML would also simplify the resultant solution. What follows uses only a data step and assumes the monthly data arrive in month order within each company&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data progressive_stddevs ;&lt;BR /&gt;do item= 1 by 1 until( last.company ) ;&lt;BR /&gt; set your_data ;&lt;BR /&gt; by company ;&lt;BR /&gt; array cogX(1200) ; * 1200 months, probably enough per company? ;&lt;BR /&gt; cogX(item) = cogsq ;&lt;BR /&gt; n_cogs = n( of cogX(*) ) ;&lt;BR /&gt; if n_cogs &amp;gt; 1 then COGSTD = std( of cogX(*) ) ;&lt;BR /&gt; output ;&lt;BR /&gt;end ;&lt;BR /&gt;drop cogX: ;&lt;BR /&gt;run ;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;the array is filled progressively until end of the company, when it will be emptied by restarting the data step iteration&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The STD() function ignores empty cells in the array&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Dec 2017 15:52:26 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2017-12-11T15:52:26Z</dc:date>
    <item>
      <title>Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420065#M280589</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I have a (company ID-time) panel data. Now I have to calculate standard deviation of variable COGSQ from quarter I/1983 to quarter II/1983, and then quarter I/1983 to quarter III/1983, and so on.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So basically, for company with GVKEY 001001;&lt;/P&gt;&lt;P&gt;t=0 is quarter I/1983&lt;/P&gt;&lt;P&gt;at t=1 (QII/1983), I need to find standard deviation of X from t=0 to t=1&lt;/P&gt;&lt;P&gt;at t=2 (QIII/1983), std of X from t=0 to t=2&lt;/P&gt;&lt;P&gt;and so on,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any idea how to do this?&lt;/P&gt;&lt;P&gt;So the dataset is like this&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;gvkey&lt;/TD&gt;&lt;TD&gt;datadate&lt;/TD&gt;&lt;TD&gt;Company&lt;/TD&gt;&lt;TD&gt;COGSQ&lt;/TD&gt;&lt;TD&gt;STD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1001&lt;/TD&gt;&lt;TD&gt;19830331&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1.258&lt;/TD&gt;&lt;TD&gt;NA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1001&lt;/TD&gt;&lt;TD&gt;19830630&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1.4&lt;/TD&gt;&lt;TD&gt;std from QI/1983 to QII/1983&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1001&lt;/TD&gt;&lt;TD&gt;19830930&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1.5&lt;/TD&gt;&lt;TD&gt;std from QI/1983 to QIII/1983&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1001&lt;/TD&gt;&lt;TD&gt;19831231&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1.6&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;……..&lt;/TD&gt;&lt;TD&gt;……&lt;/TD&gt;&lt;TD&gt;…….&lt;/TD&gt;&lt;TD&gt;…….&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1001&lt;/TD&gt;&lt;TD&gt;19860331&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2.3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1002&lt;/TD&gt;&lt;TD&gt;19840430&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;3.5&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1002&lt;/TD&gt;&lt;TD&gt;19840731&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;6.5&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;…..&lt;/TD&gt;&lt;TD&gt;……&lt;/TD&gt;&lt;TD&gt;…..&lt;/TD&gt;&lt;TD&gt;…..&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 13:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420065#M280589</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-11T13:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420066#M280590</link>
      <description>&lt;P&gt;Do you have SAS/ETS? If so check out &lt;A href="http://documentation.sas.com/?docsetId=etsug&amp;amp;docsetTarget=etsug_expand_toc.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_self"&gt;PROC EXPAND&lt;/A&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 11:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420066#M280590</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-11T11:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420087#M280591</link>
      <description>&lt;P&gt;Hi, I just check the PROC EXPAND but it is for transform/interpolate variables, so I dont see how this related to my case. Could you explain more for me? Please, I'm a newbie&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note that this is different from rolling window standard deviation. Rolling window std has a fixed number of observations (fixed window range) but in this situation, the window range is larger when time progress&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 13:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420087#M280591</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-11T13:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420090#M280592</link>
      <description>&lt;P&gt;PROC EXPAND is indeed for&amp;nbsp;&lt;SPAN&gt;transforming/interpolating variables and you want to transform a variable &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Take a look at the &lt;A href="http://documentation.sas.com/?docsetId=etsug&amp;amp;docsetTarget=etsug_expand_details19.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_self"&gt;Transformation Operators&lt;/A&gt; site at the documentation.&amp;nbsp;You want to create a moving stadard deviation, so the&amp;nbsp;MOVSTD&amp;nbsp;operator might be worth taking a look at.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 13:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420090#M280592</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-11T13:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420091#M280593</link>
      <description>&lt;P&gt;Post some sample of your data (not in the form of a picture) if you want some code answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 13:02:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420091#M280593</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-11T13:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420099#M280594</link>
      <description>Hi. I just post a sample of my data. Could you help me please?</description>
      <pubDate>Mon, 11 Dec 2017 13:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420099#M280594</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-11T13:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420114#M280595</link>
      <description>&lt;P&gt;Ah, I understand. You can still use PROC EXPAND, but this may be simpler to do in a data step like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; 
input gvkey$ datadate:yymmdd10. Company$ COGSQ;
quarter=qtr(datadate);
year=year(datadate);
format datadate yymmdd10.;
datalines;
1001 19830331 A 1.258
1001 19830630 A 1.4 
1001 19830930 A 1.5
1001 19831231 A 1.6
1001 19860331 A 2.3
1002 19840430 B 3.5
1002 19840731 B 6.5
;

proc sort data=have;
	by gvkey year quarter;
run;

data want;
	set have;
	by gvkey;
	if first.gvkey then COGSQ_first=COGSQ;

	if not first.gvkey then std_dev = std(COGSQ_first, COGSQ);
	
	retain COGSQ_first;
	drop COGSQ_first;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Dec 2017 14:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420114#M280595</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-11T14:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420123#M280596</link>
      <description>Thank you, but I am confused a little bit about the line:&lt;BR /&gt;if not first.gvkey then std_dev = std(COGSQ_first, COGSQ);&lt;BR /&gt;&lt;BR /&gt;So assume that it is on quarter III/1983, so this line will give me std_dev of COGSQ for 3 observations: Q1, Q2, Q3/1983 or just std_dev of 2 observations:Q1 and Q3/1983?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Dec 2017 14:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420123#M280596</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-11T14:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420160#M280597</link>
      <description>&lt;P&gt;if this is only&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;qtr/monthly intervals, it might be a good case to demonstrate array handling. SAS/IML would also simplify the resultant solution. What follows uses only a data step and assumes the monthly data arrive in month order within each company&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data progressive_stddevs ;&lt;BR /&gt;do item= 1 by 1 until( last.company ) ;&lt;BR /&gt; set your_data ;&lt;BR /&gt; by company ;&lt;BR /&gt; array cogX(1200) ; * 1200 months, probably enough per company? ;&lt;BR /&gt; cogX(item) = cogsq ;&lt;BR /&gt; n_cogs = n( of cogX(*) ) ;&lt;BR /&gt; if n_cogs &amp;gt; 1 then COGSTD = std( of cogX(*) ) ;&lt;BR /&gt; output ;&lt;BR /&gt;end ;&lt;BR /&gt;drop cogX: ;&lt;BR /&gt;run ;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;the array is filled progressively until end of the company, when it will be emptied by restarting the data step iteration&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The STD() function ignores empty cells in the array&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 15:52:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420160#M280597</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-12-11T15:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420161#M280598</link>
      <description>sorry I posted code from SAS Studio (so line-breaks are missing)&lt;BR /&gt;Shortly I'll post the code with line breaks</description>
      <pubDate>Mon, 11 Dec 2017 15:53:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420161#M280598</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-12-11T15:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420162#M280599</link>
      <description>&lt;P&gt;my code with line breaks to make it easier to read&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data progressive_stddevs ;
do item= 1 by 1 until( last.company ) ;
   set your_data ;
   by company ;
   array cogX(1200) ; * 1200 months, probably enough per company? ;
   cogX(item) = cogsq ;
   n_cogs = n( of cogX(*) ) ;
   if n_cogs &amp;gt; 1 then COGSTD = std( of cogX(*) ) ;
   output ;
end ;
drop cogX: ; &lt;BR /&gt;run ;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;the array is filled progressively until end of the company, when it will be emptied by restarting the data step iteration&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The STD() function ignores empty cells in the array&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 16:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420162#M280599</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-12-11T16:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420345#M280600</link>
      <description>Thanks. I will try that. But each company has different number of observations. For example, company 1 has data from Q1/1983 to Q1/1986 (13 observations), company 2 has data Q1/1984 to QI/2000 (64 observations). So can I still use array cogX(1200)?</description>
      <pubDate>Tue, 12 Dec 2017 02:25:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420345#M280600</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-12T02:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420356#M280601</link>
      <description>&lt;P&gt;You want the std of within-company quarterly changes in cost-of-goods-sold (COGSQ), in which each quarter may have a slightly different population of companies (with id variable GVKEY).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your data are sorted by GVKEY/DATADATE.&amp;nbsp; So if you calculate every quarterly change (use the DIF function, where DIF(x)=X-lag(X)), then just keep every record but the first record for each GVKEY.&amp;nbsp; Also make sure datadate and lag(datadate) are exactly 3 months apart (to avoid missed quarters or misalignment due to companies changing fiscal year definitions).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you've made this data set (call it NEED), then run proc means on it, with class datadate.&amp;nbsp; Using the ODS output statement, and the STACKODSOUTPUT option puts&amp;nbsp;data set file WANT&amp;nbsp;in a nice format:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need /view=need;
  set have;
  by gvkey datadate;
  cogsq_change=dif(cogsq);
  months_elapsed = intck('month',lag(datadate),datadate);

  if first.gvkey=0 and months_elapsed=3;
run;

ods output summary=want;
ods listing close;
proc means data=need stackodsoutput;
  class datadate;
  var cogsq_change;
run;
ods output close;
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will produce 5 variables for each datadate, one each for N, MEAN, STD, MIN, and MAX value of cogsq_change.&amp;nbsp; The datadate identified the last date of the quarterly change.&amp;nbsp; If you want more statistics, then make a list of wanted stats on the proc means statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ODS LISTING CLOSE, and ODS LISTING avoids the (presumably unwanted) printing of all those stats. Instead the &lt;EM&gt;&lt;STRONG&gt;ods&lt;/STRONG&gt;&lt;/EM&gt;&lt;EM&gt;&lt;STRONG&gt; output summary=want;&lt;/STRONG&gt;&lt;/EM&gt; statement tells sas to put those results into a data set file named want.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 03:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420356#M280601</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-12-12T03:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420400#M280602</link>
      <description>Reply to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181905"&gt;@trungcva112&lt;/a&gt; &lt;BR /&gt;The array can be a fixed size. That needs to be large enough for the company with the most history. I thought 1200, to allow for 100 years of monthly data. If there is less history it is not a problem.&lt;BR /&gt;Like all SAS statistical functions only non-missing values will be used.&lt;BR /&gt;At the start of each data step iteration the whole array is set missing. Each value is inserted into the array just after each set statement and a STD() calculated. Each data step iteration ends when all rows of a company have been read.</description>
      <pubDate>Tue, 12 Dec 2017 10:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420400#M280602</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-12-12T10:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420401#M280603</link>
      <description>There might be a problem if a company has tlmore than one period of history. That data step would treat all data for a company as one history</description>
      <pubDate>Tue, 12 Dec 2017 10:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420401#M280603</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-12-12T10:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420402#M280604</link>
      <description>The DO loop could be extended to collect the min and max asset value or return, during the 'history to date'</description>
      <pubDate>Tue, 12 Dec 2017 10:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420402#M280604</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-12-12T10:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Estimate standard deviation quarter by quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420440#M280605</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15174"&gt;@Peter_C&lt;/a&gt;&lt;BR /&gt;Your code works. Thank you very much. You are a life saver.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&lt;BR /&gt;Thank you. Your code gives me a STD of all firms' COGSQ in a given datadate (quarter). But I need a progressive STD of COGSQ of each firms when time passes.&lt;BR /&gt;But your code will surely be a useful reference for me in the furture.&lt;BR /&gt;@All&lt;/P&gt;&lt;P&gt;Thank you everyone&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 12:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/m-p/420440#M280605</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-12T12:34:00Z</dc:date>
    </item>
  </channel>
</rss>

