BookmarkSubscribeRSS Feed
Nsas
Calcite | Level 5

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

 

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

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?

 

 

Nsas
Calcite | Level 5

@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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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