DATA HAVE;
INPUT ID TIME D1 D2 E1;
DATALINES;
1 -0.25 . . 0
1 0 . . 1
1 3 . . 0
1 672.25 . . 0
2 0 . . 0
2 0 . . 1
2 3 21300 9.966 0
2 669.5 2760 7.923 0
2 670.0833 . . 1
2 673.25 31400 10.355 0
2 1509.1667 3760 8.232 0
2 1509.1667 . . 1
2 1512.1667 24100 10.09 0
2 2181.4167 4170 8.336 0
2 2181.5 . . 1
2 2184.5333 26900 10.2 0
2 2853.5 . . 1
2 3525.7917 . . 1
2 3981.5 9310 9.139 0
;
DATA WANT;
INPUT ID TIME D1 D2 E;
DATALINES;
1 -0.25 . . 0
1 0 . . 1
1 0.2 . . 0
1 0.4 . . 0
1 0.6 . . 0
1 0.8 . . 0
1 1 . . 0
1 1.5 . . 0
1 2 . . 0
1 2.5 . . 0
1 3 . . 0
1 672.25 . . 0
2 0 . . 0
2 0 . . 1
1 0 . . 1
1 0.2 . . 0
1 0.4 . . 0
1 0.6 . . 0
1 0.8 . . 0
1 1 . . 0
1 1.5 . . 0
1 2 . . 0
1 2.5 . . 0
2 3 21300 9.966 0
2 669.5 2760 7.923 0
2 670.0833 . . 1
2 673.25 31400 10.355 0
2 1509.1667 3760 8.232 0
2 1509.1667 . . 1
2 1512.1667 24100 10.09 0
2 2181.4167 4170 8.336 0
2 2181.5 . . 1
2 2184.5333 26900 10.2 0
2 2853.5 . . 1
2 3525.7917 . . 1
2 3981.5 9310 9.139 0
;
I'm trying to create the dummy rows using the time variable. for instance, from time=0 to time=1, dummy rows will be created with an increment of time value by 0.2. Also, from time=1 to time=3, dummy rows will be created with an increment of 0.5. for each dummy record created D1and D2 will be set . and E1 will be set to 0.
Any help to create this output data is greatly appreciated.
Thanks
First question: Why?
Secondly, in your wan dataset, when TIME = 1, you have an increment of 0.5 and not 0.25 from time = 1 to time = 3?
@PeterClemmensen: this is to perform some sort of simulation. Thanks for catch with increment values. Increment is 0.5 from time=1 to time=3.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.