BookmarkSubscribeRSS Feed
spa5263
Calcite | Level 5

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
5 REPLIES 5
PaigeMiller
Diamond | Level 26

Please show us a portion of your data set.

--
Paige Miller
Doc_Duke
Rhodochrosite | Level 12

It appears that RET is a variable and you are using it as a function.

Reeza
Super User
That isn't valid SAS code, so my question is what did you expect it to do, and how is your data structured?
spa5263
Calcite | Level 5

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. 

Reeza
Super User

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. 


 

sas-innovate-white.png

Special offer for SAS Communities members

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.

 

View the full agenda.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1241 views
  • 0 likes
  • 4 in conversation