|
楼主

楼主 |
发表于 2011-3-7 14:04:28
|
只看该作者
HELP!!! SAS code: create duplicate records!!
Hi everyone,
I have a question about creating duplicate records (but different times) using SAS.
my questions is:
If I have a dataset like
days startdate stopdate
2 01/02/2009 03/02/2009
3 05/02/2009 08/02/2009
5 01/03/2009 06/03/2009
I want to duplicate the first record two times and duplicate the second record three times....., how should I write SAS code? The real case is there are so many records(50), and I want repeat every records different times according the number in front of the record! Also I want to create a NEW COLUMN below (visit)!!
Want to output dataset like:
days startdate stopdate visit
2 01/02/2009 03/02/2009 1
2 01/02/2009 03/02/2009 2
3 05/02/2009 08/02/2009 1
3 05/02/2009 08/02/2009 2
3 05/02/2009 08/02/2009 3
5 01/03/2009 06/03/2009 1
5 01/03/2009 06/03/2009 2
5 01/03/2009 06/03/2009 3
5 01/03/2009 06/03/2009 4
5 01/03/2009 06/03/2009 5
I didn't find the similar problem online, so I hope I could get help here^^
Thanks so much!!!! |
|