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

Hello,

 

I have a dataset that lists the beginning year and end year of companies. The sample dataset is below

 

FirmID    Beginning              End

1001          1998                  2005

1002          1982                  2000

 

I would like to generate a panel data. The data is below.

 

 

FirmID      Year          age

1001        1998          1

1001        1999          2

...

1001        2005          8

1002        1982          1

...

1002        2000         19

 

What program do I need to use? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
data have;
input FirmID    Beginning              End;
cards;
1001          1998                  2005
1002          1982                  2000
;

data want;
 set have;
 do year=Beginning to end;
  age=year-Beginning+1;
  output;
 end;
 drop Beginning End;
run;

View solution in original post

1 REPLY 1
novinosrin
Tourmaline | Level 20
data have;
input FirmID    Beginning              End;
cards;
1001          1998                  2005
1002          1982                  2000
;

data want;
 set have;
 do year=Beginning to end;
  age=year-Beginning+1;
  output;
 end;
 drop Beginning End;
run;