Help using Base SAS procedures

Create sequential years

Accepted Solution Solved
Reply
Contributor
Posts: 24
Accepted Solution

Create sequential years

I have some IDs as following below.

 

ID

1

2

3

 

I would like to create a panel table for these ID. The expected panel data is as following below.

 

ID    Year

1     1990

1     1991

1     1992

2     1990

2     1991

2     1992

 

Can anyone tell me how I can add the year? Thanks.


Accepted Solutions
Solution
‎04-12-2018 11:28 PM
PROC Star
Posts: 1,799

Re: Create sequential years

[ Edited ]
Posted in reply to dapenDaniel

data have;
input id;
datalines;
1
2
3
;

data want;
set have;
do year=1990 to 1992;
output;
end;
run;

View solution in original post


All Replies
Solution
‎04-12-2018 11:28 PM
PROC Star
Posts: 1,799

Re: Create sequential years

[ Edited ]
Posted in reply to dapenDaniel

data have;
input id;
datalines;
1
2
3
;

data want;
set have;
do year=1990 to 1992;
output;
end;
run;

Contributor
Posts: 24

Re: Create sequential years

Posted in reply to novinosrin

Thank you so much, novinosrin!!!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 160 views
  • 0 likes
  • 2 in conversation