<?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: How to set ranges by using observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574686#M162443</link>
    <description>Thank you PGStats!!&lt;BR /&gt;It works!</description>
    <pubDate>Thu, 18 Jul 2019 17:29:47 GMT</pubDate>
    <dc:creator>JKCho</dc:creator>
    <dc:date>2019-07-18T17:29:47Z</dc:date>
    <item>
      <title>How to set ranges by using observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574390#M162288</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table stock as 
 select cusip,std(price), invertal(Filing_Date-10biz day to Filing_Date+10biz day) as with_in_std 
  from rvol
   group by cusip, interval(Filing_Date);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 385px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31104i1A70DFB1E6074882/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yeah... I want to calculate std(price) by setting intervals or ranges. I know the code to calculate std(price) set by id, year, or both and several combinations. This time, I try to calculate std(price) by intervals. However, as long as I know there is no code like interval() so wonder how can I obtain &lt;STRONG&gt;std(price) from a certain date to another certain date(In my case, the are std(price) between both ends of 10 business days away from the filing date).&lt;/STRONG&gt; As I have the dates on the first row(trading days only), I think I can tack price variations by these trading days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So.. the key is... how to connect a filing date to both ends. I am trying to various possible codes now by searching for this community.&lt;/P&gt;&lt;P&gt;So far, I have not found and assume there is none similar. (If I find, I will link it.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you know some solutions, please share with me!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your comments!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 22:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574390#M162288</guid>
      <dc:creator>JKCho</dc:creator>
      <dc:date>2019-07-17T22:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to set ranges by using observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574397#M162293</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data two;
    set one;
    if filing_date-10&amp;lt;names_date&amp;lt;filing_date+10 then interval=1;
    else interval=0;
run;

proc summary nway data=two;
    class filing_date;
    var price;
    weight interval;
    output out=want std=price_std;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jul 2019 22:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574397#M162293</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-07-17T22:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to set ranges by using observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574431#M162316</link>
      <description>&lt;P&gt;Thank you, PaigeMiller!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used your code and found it worked well.&lt;/P&gt;&lt;P&gt;While I think this can be a solution, I would like to ask one more. There are some companies(cusip) having the same filing dates and need to separate them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you give me more hints on how to separate firms(cusip) having the same filing dates? I have been thinking about it and continue to do so... but still no clue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I first put cusip and filing_date in the CLASS statement so I could have the combination but... it did mean # of cusip multiplied by # of the filing date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestion is good!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 02:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574431#M162316</guid>
      <dc:creator>JKCho</dc:creator>
      <dc:date>2019-07-18T02:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to set ranges by using observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574446#M162327</link>
      <description>&lt;P&gt;Try this variation on &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; 's code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=rvol nway;
where intck("day", namesDate, filingDate) between -10 and 10;
class cusip filingDate;
var price;
output out=want std=priceStd;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;this assumes that your dates are SAS date values.&lt;/P&gt;
&lt;P&gt;(untested)&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 04:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574446#M162327</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-07-18T04:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to set ranges by using observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574512#M162353</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270067"&gt;@JKCho&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, PaigeMiller!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used your code and found it worked well.&lt;/P&gt;
&lt;P&gt;While I think this can be a solution, I would like to ask one more. There are some companies(cusip) having the same filing dates and need to separate them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you give me more hints on how to separate firms(cusip) having the same filing dates? I have been thinking about it and continue to do so... but still no clue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I first put cusip and filing_date in the CLASS statement so I could have the combination but... it did mean # of cusip multiplied by # of the filing date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestion is good!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's the great thing about PROC SUMMARY. If you want this analysis for each combination of CUSIP and FILING_DATE (instead of by FILING_DATE but not CUSIP as in my original program), all you have to do is change the CLASS statement so that it contains both variable names.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 12:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574512#M162353</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-07-18T12:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to set ranges by using observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574685#M162442</link>
      <description>Oh... I got your point!&lt;BR /&gt;Thank you again!!!</description>
      <pubDate>Thu, 18 Jul 2019 17:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574685#M162442</guid>
      <dc:creator>JKCho</dc:creator>
      <dc:date>2019-07-18T17:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to set ranges by using observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574686#M162443</link>
      <description>Thank you PGStats!!&lt;BR /&gt;It works!</description>
      <pubDate>Thu, 18 Jul 2019 17:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-ranges-by-using-observations/m-p/574686#M162443</guid>
      <dc:creator>JKCho</dc:creator>
      <dc:date>2019-07-18T17:29:47Z</dc:date>
    </item>
  </channel>
</rss>

