BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sfan6
Calcite | Level 5

I have the following data set,

 

Ticker    Year    Net Income       Net Income in year t-1

   A        2011        100

   A        2012        110                         100

   A        2013        105                         100

   A        2014        108                         105

   B        2013        150

   B        2014        170                         150

   B        2015        160                         170

 

How to construct the variable, Net Income in year t-1? 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
LAG()

data want;
set have;
by ticker; *assumes sorted;

net_lag = lag(net_income);
if first.ticker then call missing(net_lag);
run;

View solution in original post

2 REPLIES 2
Reeza
Super User
LAG()

data want;
set have;
by ticker; *assumes sorted;

net_lag = lag(net_income);
if first.ticker then call missing(net_lag);
run;
sfan6
Calcite | Level 5

Thank you so much! it works!

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 539 views
  • 1 like
  • 2 in conversation