Hello,
I have a long dataset that includes many observations for each person. There is a date variable (date) that corresponds to whether or not the person (ID) transmitted a value. The other variables include the start date (implantdate) and the end date (today). I am interested in calculating a monthly percentage of transmissions across all participants (ie, the count of the "date" variables for each month starting with the "implantdate" and ending with "today"). Since the start date is different for each person, I would like to calculate this as "Month 1" Month 2" etc. I am including a dataex example below (although unfortunately it only has data for one patient- is there a way to include data for many different IDs within the dataex? Maybe that's a separate discussion post!)
I have a long dataset that includes many observations for each person. There is a date variable (date) that corresponds to whether or not the person (ID) transmitted a value. The other variables include the start date (implantdate) and the end date (today). I am interested in calculating a monthly percentage of transmissions across all participants (ie, the count of the "date" variables for each month starting with the "implantdate" and ending with "today"). Since the start date is different for each person, I would like to calculate this as "Month 1" Month 2" etc. I am including a dataex example below (although unfortunately it only has data for one patient- is there a way to include data for many different IDs within the dataex? Maybe that's a separate discussion post!)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte id float(date implantdate today) 1 21573 20130 21638 1 21571 20130 21638 1 21570 20130 21638 1 21568 20130 21638 1 21566 20130 21638 1 21565 20130 21638 1 21564 20130 21638 1 21546 20130 21638 1 21531 20130 21638 1 21530 20130 21638 1 21529 20130 21638 1 21528 20130 21638 1 21527 20130 21638 1 21526 20130 21638 1 21525 20130 21638 1 21524 20130 21638 1 21523 20130 21638 1 21508 20130 21638 1 21504 20130 21638 1 21503 20130 21638 1 21502 20130 21638 1 21501 20130 21638 1 21500 20130 21638 1 21498 20130 21638 1 21497 20130 21638 1 21496 20130 21638 1 21495 20130 21638 1 21494 20130 21638 1 21493 20130 21638 1 21492 20130 21638 1 21491 20130 21638 1 21490 20130 21638 1 21489 20130 21638 1 21488 20130 21638 1 21487 20130 21638 1 21486 20130 21638 1 21485 20130 21638 1 21484 20130 21638 1 21482 20130 21638 1 21480 20130 21638 1 21479 20130 21638 1 21478 20130 21638 1 21477 20130 21638 1 21476 20130 21638 1 21472 20130 21638 1 21468 20130 21638 1 21467 20130 21638 1 21463 20130 21638 1 21462 20130 21638 1 21461 20130 21638 1 21460 20130 21638 1 21459 20130 21638 1 21458 20130 21638 1 21456 20130 21638 1 21455 20130 21638 1 21454 20130 21638 1 21453 20130 21638 1 21452 20130 21638 1 21449 20130 21638 1 21448 20130 21638 1 21447 20130 21638 1 21446 20130 21638 1 21445 20130 21638 1 21444 20130 21638 1 21442 20130 21638 1 21441 20130 21638 1 21440 20130 21638 1 21439 20130 21638 1 21437 20130 21638 1 21436 20130 21638 1 21434 20130 21638 1 21433 20130 21638 1 21432 20130 21638 1 21431 20130 21638 1 21429 20130 21638 1 21428 20130 21638 1 21427 20130 21638 1 21426 20130 21638 1 21425 20130 21638 1 21424 20130 21638 1 21423 20130 21638 1 21422 20130 21638 1 21421 20130 21638 1 21420 20130 21638 1 21419 20130 21638 1 21418 20130 21638 1 21417 20130 21638 1 21416 20130 21638 1 21414 20130 21638 1 21413 20130 21638 1 21412 20130 21638 1 21411 20130 21638 1 21410 20130 21638 1 21409 20130 21638 1 21408 20130 21638 1 21407 20130 21638 1 21406 20130 21638 1 21405 20130 21638 1 21404 20130 21638 1 21403 20130 21638 end format %td date format %td implantdate

Comment