11-23-2012 08:41 AM
I am trying to form portfolios on month T by looking back characteristics on month T-1.
This is the code I have written (It may appear very convoluted to you, because I'm new to SAS).
LENGTH PORTFOLIOYEAR $4.;
LENGTH PORTFOLIOMONTH $2.;
IF PORTFOLIOMONTH=13 THEN PORTFOLIOMONTH=1;
IF PORTFOLIOMONTH=13 THEN PORTFOLIOYEAR=REFYEAR+1;
LENGTH PORTFOLIODATE $6.;
I have tabbed the 2 lines of code that I'm having trouble with.
Because December (12) will determine the portfolio in Jan (1). However, I am unsure how can I adjust the year so that it becomes the next year i.e. 200712 will determine a portfolio in 200801.
The other problem I have is how can I merge the columns PORTFOLIOYEAR AND PORTFOLIOMONTH to give me PORTFOLIODATE.
The reason is because I have written a long code following this (And only realised that I overlooked the Dec and Jan issue today). And the PORTFOLIODATE is crucial, if not the rest of my codes need to be edited.
Thanks guys. Appreciate the help!
Need further help from the community? Please ask a new question.