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-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!

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
  • 421 views
  • 1 like
  • 2 in conversation