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

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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