BookmarkSubscribeRSS Feed
spa5263
Calcite | Level 5

I am trying to create a chart that shows me the return value (RET) for the next 3 months for a given quarterly index (quart_index). For example, if the quarterly index is 1, then I need the return values for months 4, 5, and 6.  I am using stock data from 2009- 2018 and need the returns to appear for the correct year as well. 

2 REPLIES 2
Kurt_Bremser
Super User

Welcome to the forums!

 

Please post example data in usable form (in a data step with datalines), so we can see the variables, their types and contents, and eventual formats. Use the "little running man" icon for posting code.

Also post the expected result.

Reeza
Super User
That cannot be done with an IF/THEN statement, ti's more complex than that. You can look at the LAG<n> function though for starters, but it also depends on how your data is structured. If you have multiple stocks you'll need to ensure you don't cross boundaries across stocks.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 2 replies
  • 370 views
  • 0 likes
  • 3 in conversation