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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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