I am trying to create a variable (RET2) that will give me the return (variable RET) of the month following the quarterly index (quart_index). I currently have the following:
data portfolio; set portfolio;
RET2 = (ret(month(quart_index)) + 1);
The error that SAS is giving me is:
1607 data portfolio; set portfolio;
1608 RET2 = (ret(month(quart_index)) + 1);
---
68
ERROR 68-185: The function RET is unknown, or cannot be accessed
Please show us a portion of your data set.
It appears that RET is a variable and you are using it as a function.
I need the code to create a new column in my result that shows the return of the stock for the month after the quarter.
Which depends on the structure of the data. For example, looking up a value within the same row is different than looking for a value in a different row. Therefore without your data structure we cannot help you.
Here are instructions on how to provide sample data as a data step:
https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...
@spa5263 wrote:
I need the code to create a new column in my result that shows the return of the stock for the month after the quarter.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.