<?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 Urgent help! with assignment of sorting portfolios in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Urgent-help-with-assignment-of-sorting-portfolios/m-p/246730#M46206</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am now in a seminar of advanced investments, where i have an assignment of sorting the portfolios and construct the investing strategy based on momentum and volatility. However, I don't know anything about programming and I was told that SAS is the only the program that can do this assignment. I know this is a very troublesome question, as i need help from the very beginning with SAS...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code for creating momentum that my teacher gave us. and we need to do something similar for the variance ( a proxy for volatility). And how shall i do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data stkid;&lt;BR /&gt;set work.example;&lt;BR /&gt;yearmth=year*12+12-month;&lt;BR /&gt;run;&lt;BR /&gt;keep stock code year month yearmth;&lt;BR /&gt;retyearmth=year*12+12-month;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data ret;&lt;BR /&gt;set work.example;&lt;BR /&gt;keep stock_code year month retyearmth return;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;BR /&gt;create table data as select *, log(b.return+1) as logretfrom stkid as a,ret as b&lt;BR /&gt;where a.stock_code=b.stock_code and (yearmth-12)&amp;lt;=b.retyearmth&amp;lt;=(yearmth-2);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc sort data=data;by stock_code yearmth;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc means&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Also here are the codes for the major steps of the assignment, single sorting and double sorting. But don't know how to use it...&lt;/P&gt;&lt;P&gt;My variable name are: stockid, yearmonth, return.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://sites.google.com/site/jiejaycao/home/tools" target="_blank"&gt;https://sites.google.com/site/jiejaycao/home/tools&lt;/A&gt;&lt;U&gt;&lt;FONT face="times new roman, serif" size="2"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;1.&lt;/FONT&gt; &amp;nbsp;SAS with SQL&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really tried to learn it by myself from all the materials online, but i am afraid this is really not my area. I relly run out of options so that's why i come here to ask this big question, hoping someone can help me work out the whole code, actually the main connections. I shall be more than grateful!&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jan 2016 19:11:40 GMT</pubDate>
    <dc:creator>emilykingjr</dc:creator>
    <dc:date>2016-01-28T19:11:40Z</dc:date>
    <item>
      <title>Urgent help! with assignment of sorting portfolios</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Urgent-help-with-assignment-of-sorting-portfolios/m-p/246730#M46206</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am now in a seminar of advanced investments, where i have an assignment of sorting the portfolios and construct the investing strategy based on momentum and volatility. However, I don't know anything about programming and I was told that SAS is the only the program that can do this assignment. I know this is a very troublesome question, as i need help from the very beginning with SAS...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code for creating momentum that my teacher gave us. and we need to do something similar for the variance ( a proxy for volatility). And how shall i do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data stkid;&lt;BR /&gt;set work.example;&lt;BR /&gt;yearmth=year*12+12-month;&lt;BR /&gt;run;&lt;BR /&gt;keep stock code year month yearmth;&lt;BR /&gt;retyearmth=year*12+12-month;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data ret;&lt;BR /&gt;set work.example;&lt;BR /&gt;keep stock_code year month retyearmth return;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;BR /&gt;create table data as select *, log(b.return+1) as logretfrom stkid as a,ret as b&lt;BR /&gt;where a.stock_code=b.stock_code and (yearmth-12)&amp;lt;=b.retyearmth&amp;lt;=(yearmth-2);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc sort data=data;by stock_code yearmth;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc means&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Also here are the codes for the major steps of the assignment, single sorting and double sorting. But don't know how to use it...&lt;/P&gt;&lt;P&gt;My variable name are: stockid, yearmonth, return.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://sites.google.com/site/jiejaycao/home/tools" target="_blank"&gt;https://sites.google.com/site/jiejaycao/home/tools&lt;/A&gt;&lt;U&gt;&lt;FONT face="times new roman, serif" size="2"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;1.&lt;/FONT&gt; &amp;nbsp;SAS with SQL&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really tried to learn it by myself from all the materials online, but i am afraid this is really not my area. I relly run out of options so that's why i come here to ask this big question, hoping someone can help me work out the whole code, actually the main connections. I shall be more than grateful!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 19:11:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Urgent-help-with-assignment-of-sorting-portfolios/m-p/246730#M46206</guid>
      <dc:creator>emilykingjr</dc:creator>
      <dc:date>2016-01-28T19:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent help! with assignment of sorting portfolios</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Urgent-help-with-assignment-of-sorting-portfolios/m-p/246732#M46208</link>
      <description>&lt;P&gt;I can not follow you....&lt;/P&gt;
&lt;P&gt;What do you want to do you want us to help you with exactly?&lt;/P&gt;
&lt;P&gt;Be specific with what you need.&lt;/P&gt;
&lt;P&gt;Give sample data and say how you want it to be, so we can help...&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 19:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Urgent-help-with-assignment-of-sorting-portfolios/m-p/246732#M46208</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-01-28T19:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent help! with assignment of sorting portfolios</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Urgent-help-with-assignment-of-sorting-portfolios/m-p/246734#M46210</link>
      <description>&lt;P&gt;Hello Mohamed,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is too big, so I will not upload it, but it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; stockid &amp;nbsp; &amp;nbsp; &amp;nbsp; return&lt;/P&gt;&lt;P&gt;200501 &amp;nbsp; &amp;nbsp;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.55&lt;/P&gt;&lt;P&gt;200502 &amp;nbsp; &amp;nbsp; 123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -0.01&lt;/P&gt;&lt;P&gt;200501 &amp;nbsp; &amp;nbsp; &amp;nbsp;234 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.09&lt;/P&gt;&lt;P&gt;200502 &amp;nbsp; &amp;nbsp; &amp;nbsp;234 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.08&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it is a panel data, with around 500 stocks' monthly return in around 10 year's time. And the time format in the raw data is year together with month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The assignment is to create and test two investing strategies based on momentum and volatility. Momentum will be the return of a stock of the past 12 month minus the past 1 month. So for example, the momentum for stock 123 in 200501 will be its cumulative return during 200401-200412. The proxy for volatility will be the variance, which is calculated based on the past 3 years. For example again, the volatility for stock 123 in 200501 will be calculated using the returns from 200201-200412.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly I need to construct the two measures in my data set, then I need to follow the first two steps in the link (winsorize, single sorting). The macros are already there, but I do not know how to connect them... I would appreciate your help very much!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 19:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Urgent-help-with-assignment-of-sorting-portfolios/m-p/246734#M46210</guid>
      <dc:creator>emilykingjr</dc:creator>
      <dc:date>2016-01-28T19:56:07Z</dc:date>
    </item>
  </channel>
</rss>

