<?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: Proc Expand in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142281#M37860</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I apparently can't help much because my license for ETS is messed up and it'll take a while for IT to fix it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That being said, an import of your data and proc means on it resulted in the same value in Excel and SAS of&amp;nbsp; -0.003697452 for Jan 1973.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You haven't shown the rest of your code but my *GUESS* is that you haven't formatted the date in the way SAS expects it.&lt;/P&gt;&lt;P&gt;Try running a proc means on your data to see if the output matches your Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This assumes that the date is a SAS date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=input2 n sum;&lt;/P&gt;&lt;P&gt;format date monyy7.;&lt;/P&gt;&lt;P&gt;class date;&lt;/P&gt;&lt;P&gt;var dly_ret;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Jul 2014 16:11:14 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-07-31T16:11:14Z</dc:date>
    <item>
      <title>Proc Expand</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142278#M37857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm relatively new here and this is my first post on SAS forum. Hope I can get the help I need!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm doing a research project on index returns. I have daily data for a period of over 40 years. However, I do not have returns for Saturday and Sunday or any other holidays when stock market would be closed. I'm trying to convert this daily data into monthly using PROC EXPAND procedure. Here is my analysis:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- I used PROC EXPAND and found sum of the returns for each month. Subsequently, I calculated the same using excel (using pivot table). I found the results to be different. Is there any reason why this would happen?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- My data starts from January of 1973 until May 2014. When I used PROC EXPAND with missing values for Saturdays and Sundays, the resultant output didn't have any return value for January of 1973. So I tried to set all missing values to zero and voila, sum of return for January 1973 appeared. Is this a right approach?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc expand data=lib.dly_1 from=day to=month;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; convert dly_ret\observed=total;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by yr;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- And also, I need to find Standard deviation for each month once converted from daily return using PROC EXPAND. Can I do this by moving standard deviation? Is there a way to do this using PROC EXPAND or any other procedure or way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your help! Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 15:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142278#M37857</guid>
      <dc:creator>karthikmax</dc:creator>
      <dc:date>2014-07-30T15:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Expand</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142279#M37858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should post some sample code and data that result in the different numbers in SAS vs Excel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 15:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142279#M37858</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-30T15:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Expand</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142280#M37859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My apologies. Here are my code and results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Code&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;data usd.dly_5(drop= lag_DTWEXM count lag_count numday);&lt;/P&gt;&lt;P&gt;set usd.dly_2;&lt;/P&gt;&lt;P&gt;if(dly_ret=".") then dly_ret=0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc expand data=usd.dly_5 from=day to=month out=usd.dly_6;&lt;/P&gt;&lt;P&gt;convert dly_ret/observed=total;&lt;/P&gt;&lt;P&gt;id date;&lt;/P&gt;&lt;P&gt;by yr;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Result using PROC EXPAND&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;yr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dly_ret&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; JAN1973&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.002940597&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; FEB1973&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.023633396&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; MAR1973&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0081171767&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; APR1973&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.001223039&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; MAY1973&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.006476482&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; JUN1973&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.00692127&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; JUL1973&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.00099385&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; AUG1973&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0200460595&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; SEP1973&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0001108501&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; OCT1973&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0011257383&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; NOV1973&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0123855573&lt;/P&gt;&lt;P&gt;1973&amp;nbsp;&amp;nbsp;&amp;nbsp; DEC1973&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0024655859&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Results using Excel&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;mth/yr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dly_ret&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 162px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="64"&gt;11973&lt;/TD&gt;&lt;TD align="right" width="98"&gt;-0.003697452&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;21973&lt;/TD&gt;&lt;TD align="right"&gt;-0.022745714&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;31973&lt;/TD&gt;&lt;TD align="right"&gt;0.008243129&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;41973&lt;/TD&gt;&lt;TD align="right"&gt;-0.000343374&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;51973&lt;/TD&gt;&lt;TD align="right"&gt;-0.010353998&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;61973&lt;/TD&gt;&lt;TD align="right"&gt;-0.010218709&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;71973&lt;/TD&gt;&lt;TD align="right"&gt;0.000427683&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;81973&lt;/TD&gt;&lt;TD align="right"&gt;0.019562443&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;91973&lt;/TD&gt;&lt;TD align="right"&gt;-0.001659921&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;101973&lt;/TD&gt;&lt;TD align="right"&gt;0.002176381&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;111973&lt;/TD&gt;&lt;TD align="right"&gt;0.014772061&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;121973&lt;/TD&gt;&lt;TD align="right"&gt;0.003643333&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I have attached the daily raw data for the year 1973. Please let me know if you need anything else. Appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 23:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142280#M37859</guid>
      <dc:creator>karthikmax</dc:creator>
      <dc:date>2014-07-30T23:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Expand</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142281#M37860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I apparently can't help much because my license for ETS is messed up and it'll take a while for IT to fix it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That being said, an import of your data and proc means on it resulted in the same value in Excel and SAS of&amp;nbsp; -0.003697452 for Jan 1973.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You haven't shown the rest of your code but my *GUESS* is that you haven't formatted the date in the way SAS expects it.&lt;/P&gt;&lt;P&gt;Try running a proc means on your data to see if the output matches your Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This assumes that the date is a SAS date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=input2 n sum;&lt;/P&gt;&lt;P&gt;format date monyy7.;&lt;/P&gt;&lt;P&gt;class date;&lt;/P&gt;&lt;P&gt;var dly_ret;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 16:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142281#M37860</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-31T16:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Expand</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142282#M37861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BTW I don't think you should sum returns over the month, I think they're multiplicative to get an effective monthly return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The summation would underestimate the total return if invested for the whole month. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 18:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand/m-p/142282#M37861</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-31T18:38:03Z</dc:date>
    </item>
  </channel>
</rss>

