Hi everyone, 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... 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? data stkid; set work.example; yearmth=year*12+12-month; run; keep stock code year month yearmth; retyearmth=year*12+12-month; run; data ret; set work.example; keep stock_code year month retyearmth return; run; proc sql ; create table data as select *, log(b.return+1) as logretfrom stkid as a,ret as b where a.stock_code=b.stock_code and (yearmth-12)<=b.retyearmth<=(yearmth-2); quit; proc sort data=data;by stock_code yearmth; run; proc means 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... My variable name are: stockid, yearmonth, return. https://sites.google.com/site/jiejaycao/home/tools1. SAS with SQL 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!
... View more