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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.