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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 815 views
  • 0 likes
  • 2 in conversation