<?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: 30 days Moving standard deviation in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217867#M53609</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perfect, It worked, Thank you... &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 May 2015 12:30:24 GMT</pubDate>
    <dc:creator>SwapnaKumari</dc:creator>
    <dc:date>2015-05-22T12:30:24Z</dc:date>
    <item>
      <title>30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217864#M53606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;Hi All,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;I am trying to calculate 30 days moving &lt;SPAN style="font-family: Calibri, sans-serif; font-size: 14.6666669845581px;"&gt;standard deviation &lt;/SPAN&gt;using Proc expand, and able to get the same in the output, I have used group by variable as per the requirement, Now the issue is in the result I am getting is having 0 value in every 1st observation in the output. I know &lt;SPAN style="font-family: Calibri, sans-serif;"&gt;&lt;SPAN style="font-size: 11pt;"&gt;The standard deviation of the first value of a considered data series is always zero, as it is not possible to calculate it with only one value. So I have &lt;/SPAN&gt;&lt;SPAN style="font-size: 14.6666669845581px;"&gt;requirement&lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt;"&gt; that the initial standard deviation shall be equal to the one of the second date.&amp;nbsp; Please find the below &lt;/SPAN&gt;&lt;SPAN style="font-size: 14.6666669845581px;"&gt;example&lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt;"&gt; for more clarity.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #1f497d; font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="border: none; border-bottom: solid #9CC2E5 1.5pt; background: white; padding: 0 5.4pt 0 5.4pt;" valign="top" width="103"&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;As of date&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border: none; border-bottom: solid #9CC2E5 1.5pt; background: white; padding: 0 5.4pt 0 5.4pt;" valign="top" width="76"&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Std.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;28.11.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: none; border-bottom: solid #9CC2E5 1.0pt; background: #DEEAF6; padding: 0 5.4pt 0 5.4pt;" valign="top" width="76"&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="text-decoration: line-through;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif; color: #1f497d; text-decoration: line-through;"&gt;0 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: red;"&gt;365&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid #9CC2E5 1.0pt; border-right: solid #9CC2E5 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="103"&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;29.11.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/TD&gt;&lt;TD style="border: none; border-bottom: solid #9CC2E5 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="76"&gt;&lt;P&gt;&lt;STRONG style="color: #1f497d; font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;365&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid #9CC2E5 1.0pt; border-right: solid #9CC2E5 1.0pt; background: #DEEAF6; padding: 0 5.4pt 0 5.4pt;" valign="top" width="103"&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;30.11.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/TD&gt;&lt;TD style="border: none; border-bottom: solid #9CC2E5 1.0pt; background: #DEEAF6; padding: 0 5.4pt 0 5.4pt;" valign="top" width="76"&gt;&lt;P&gt;&lt;STRONG style="color: #1f497d; font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;378&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid #9CC2E5 1.0pt; border-right: solid #9CC2E5 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="103"&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;1.12.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/TD&gt;&lt;TD style="border: none; border-bottom: solid #9CC2E5 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="76"&gt;&lt;P&gt;&lt;STRONG style="color: #1f497d; font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;371&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid #9CC2E5 1.0pt; border-right: solid #9CC2E5 1.0pt; background: #DEEAF6; padding: 0 5.4pt 0 5.4pt;" valign="top" width="103"&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;2.12.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/TD&gt;&lt;TD style="border: none; border-bottom: solid #9CC2E5 1.0pt; background: #DEEAF6; padding: 0 5.4pt 0 5.4pt;" valign="top" width="76"&gt;&lt;P&gt;&lt;STRONG style="color: #1f497d; font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;392&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;Below is the current code:-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;PROC EXPAND DATA = temp1 OUT=Moving_Stdev ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;CONVERT Exposure = Moving_Stdev30 / TRANSFORMOUT=(MOVSTD 30);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;by Instrument_Type Country;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;Can anyone please help me to achieve the above requirement, a sample code would really help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;Swapna&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -.25in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;2)&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 06:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217864#M53606</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-21T06:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217865#M53607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apologies, I think the above example is not very clear so sending the more clear one on what I exactly need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 11pt; font-family: Calibri, sans-serif; color: #1f497d; background-color: #ffffff;"&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 316px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="75"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As of date&lt;/P&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Std.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="40" style="border-top: none;"&gt;28/11/2014&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="177"&gt;Instead of 0 it should pick up the 2nd value i.e 365&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;29/11/2014&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;365&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;30/11/2014&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;378&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20" style="border-top: none;"&gt;1/12/2014&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;371&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20" style="border-top: none;"&gt;2/12/2014&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;392&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 07:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217865#M53607</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-21T07:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217866#M53608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code not tested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;merge &lt;SPAN style="color: #808080; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Moving_Stdev&amp;nbsp; &lt;SPAN style="color: #808080; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Moving_Stdev (firstobs=2 rename=(&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Std=_&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Std&lt;/SPAN&gt;&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;if &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Std=0 then &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Std=_&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Std;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 May 2015 12:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217866#M53608</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-22T12:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217867#M53609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perfect, It worked, Thank you... &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 May 2015 12:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217867#M53609</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-22T12:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217868#M53610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want the 3 cell value of standard deviation also to be same as 2nd cell value of standard deviation. for example:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="185"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="90"&gt;As of date&lt;/TD&gt;&lt;TD class="xl68" style="border-left: none; font-style: inherit;" width="31"&gt;Std.&lt;/TD&gt;&lt;TD class="xl64" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-weight: inherit; font-style: inherit;"&gt;&lt;TD class="xl65" height="118" style="border-top: none; font-style: inherit;" width="90"&gt;28/11/2014&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none; font-style: inherit;" width="31"&gt;0&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none; font-style: inherit;" width="64"&gt;Instead of 0 it should pick up the 2nd value i.e 365&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-weight: inherit; font-style: inherit;"&gt;&lt;TD class="xl65" height="20" style="border-top: none; font-style: inherit;" width="90"&gt;29/11/2014&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none; font-style: inherit;" width="31"&gt;365&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-weight: inherit; font-style: inherit;"&gt;&lt;TD class="xl65" height="120" style="border-top: none; font-style: inherit;" width="90"&gt;30/11/2014&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none; font-style: inherit;" width="31"&gt;365&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;" width="64"&gt;3rd value should also be as same as 2nd value&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-weight: inherit; font-style: inherit;"&gt;&lt;TD class="xl67" height="20" style="border-top: none; font-style: inherit;" width="90"&gt;1/12/2014&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none; font-style: inherit;" width="31"&gt;371&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-weight: inherit; font-style: inherit;"&gt;&lt;TD class="xl67" height="20" style="border-top: none; font-style: inherit;" width="90"&gt;2/12/2014&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none; font-style: inherit;" width="31"&gt;392&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be really great if you can please share a sample code for the above as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 10:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217868#M53610</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-28T10:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217869#M53611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. Code not tested.&lt;/P&gt;&lt;P&gt;I don't know if there are some group variables , Just assuming not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;merge &lt;SPAN style="font-weight: inherit; font-style: inherit; color: #808080;"&gt;Moving_Stdev&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;Moving_Stdev (firstobs=2 rename=(&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;Std=_&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;Std&lt;/SPAN&gt;&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if &lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;Std=0 then &lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;Std=_&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;Std;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: inherit;"&gt;lag_Std=lag(Std);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;if _n_ eq 3 then Std=lag_Std;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;Xia Keshan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 12:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217869#M53611</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-28T12:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217870#M53612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I do have the group variables please find the proc expand code which will give u insight of the group variables I have in my data set:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #808080;"&gt;PROC EXPAND DATA = temp1 OUT=Moving_Stdev ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #808080;"&gt;CONVERT Exposure = Moving_Stdev30 / TRANSFORMOUT=(MOVSTD 30);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #808080;"&gt;by Instrument_Type Country;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #808080;"&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #808080;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="color: #808080;"&gt;&lt;SPAN style="font-style: inherit; font-size: 13px; font-family: inherit; font-weight: inherit;"&gt;your code is running fine but i need the code which should &lt;/SPAN&gt;&lt;SPAN style="font-size: 13px;"&gt;change&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 13px; font-family: inherit; font-weight: inherit;"&gt; all the by group &lt;/SPAN&gt;&lt;SPAN style="font-size: 13px;"&gt;variable&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 13px; font-family: inherit; font-weight: inherit;"&gt; 3rd cell value with 2nd cell value&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="color: #808080;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-style: inherit; font-size: 13px; font-family: inherit; font-weight: inherit;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="color: #808080; font-style: inherit; font-size: 13px; font-family: inherit; font-weight: inherit;"&gt;Swapna&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 12:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217870#M53612</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-28T12:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217871#M53613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;merge &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #808080;"&gt;Moving_Stdev&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Moving_Stdev (firstobs=2 rename=(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Std=_&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Std&lt;/SPAN&gt;&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="color: #808080; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;by Instrument_Type Country;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if first.&lt;SPAN style="color: #808080; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Country &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt; then do;n=0;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Std=_&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Std;end;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;n+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;lag_Std=lag(Std);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;if _n_ eq 3 then Std=lag_Std;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 13:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217871#M53613</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-28T13:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217872#M53614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried running the code shared by you.. It is working only for 1st group n failing for remaining groups. also now the first value 0 for the remaining groups are not replacing with the second value.. &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;something is gong wrong can you please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the same input::- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 601px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="left" class="xl72" height="20" width="75"&gt;as_of_date&lt;/TD&gt;&lt;TD align="left" class="xl72" style="border-left: none;" width="118"&gt;Instrument_Type&lt;/TD&gt;&lt;TD align="left" class="xl72" style="border-left: none;" width="64"&gt;Country&lt;/TD&gt;&lt;TD align="left" class="xl72" style="border-left: none;" width="64"&gt;TIME&lt;/TD&gt;&lt;TD align="left" class="xl73" style="border-left: none;" width="110"&gt;Moving_Stdev30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="43" style="border-top: none;"&gt;28Nov2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Australia&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0.00&lt;/TD&gt;&lt;TD align="left" class="xl63" width="170"&gt;need to repalce 0 with 2nd value i.e 6.22 &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;29Nov2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Australia&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;6.22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="46" style="border-top: none;"&gt;02Dec2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl71" style="border-top: none; border-left: none;"&gt;Australia&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;9.53&lt;/TD&gt;&lt;TD align="left" class="xl63" width="170"&gt;need to replace 3rd value with 2nd value i.e 6.22 &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;03Dec2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Australia&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;77.73&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;04Dec2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Australia&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;68.23&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;05Dec2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Australia&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;80.13&lt;/TD&gt;&lt;TD align="left" class="xl63" width="170"&gt;`&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;28Nov2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Austria&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;29Nov2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Austria&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;30.55&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;02Dec2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Austria&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;52.76&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;03Dec2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Austria&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;50.97&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;04Dec2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Austria&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;44.43&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;"&gt;05Dec2013&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Commercial loans&lt;/TD&gt;&lt;TD align="left" class="xl69" style="border-top: none; border-left: none;"&gt;Austria&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;42.34&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 16:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217872#M53614</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-28T16:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217873#M53615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Opss.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if &lt;STRONG&gt;_n_&lt;/STRONG&gt; eq 3 then Std=lag_Std;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;--&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;if &lt;STRONG&gt;n&lt;/STRONG&gt; eq 3 then Std=lag_Std;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 12:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217873#M53615</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-29T12:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: 30 days Moving standard deviation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217874#M53616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply but your code is still not working with the groups it is only replacing the first group and remaining are still same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anyways I found a different way to calculate the same, so sharing the code with you.. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Replacing the 0 Values in stadev varibale with the 2nd value of Stdev*/&lt;/P&gt;&lt;P&gt;data temp1;&lt;/P&gt;&lt;P&gt;merge Moving_Stdev&amp;nbsp; Moving_Stdev (firstobs=2 rename=(Stdev=_Std));&lt;/P&gt;&lt;P&gt;if Stdev="0" then Stdev=_Std;&lt;/P&gt;&lt;P&gt;drop _Std;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;/*Replacing the 3rd Value in every group in stadev varibale with the 2nd value of Stdev*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;data Final ;&lt;/P&gt;&lt;P&gt;set temp1;&lt;/P&gt;&lt;P&gt;l2=lag1(Stdev);&lt;/P&gt;&lt;P&gt;if time = 3 then Stdev = l2;&lt;/P&gt;&lt;P&gt;drop time l2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 12:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/30-days-Moving-standard-deviation/m-p/217874#M53616</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-29T12:21:05Z</dc:date>
    </item>
  </channel>
</rss>

