Hi,

I do have an issue with my dataset. I need to add missing dates and replace the variable "created" with 0. My dates are from 2010m1 to 2019m12. For adding the missing dates I did this code and replaced my missing values for the variable "created" with 0
Code:
tsset monthly_date
tsfill
replace created_fr = 0 if created_fr == .
The issue that I have is for the last observation. One of my datasets does not have an observation in 2019m12. I could add this variable manually but this seems to be not the perfect solution.


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(monthly_date created_fr)
600 2
601 0
602 1
603 1
604 0
605 0
606 0
607 0
608 0
609 0
610 0
611 1
612 6
613 0
614 0
615 1
616 2
617 0
618 0
619 1
620 0
621 0
622 1
623 0
624 7
625 0
626 0
627 0
628 2
629 1
630 0
631 0
632 0
633 1
634 0
635 1
636 7
637 0
638 1
639 0
640 0
641 0
642 0
643 1
644 1
645 1
646 1
647 1
648 7
649 0
650 1
651 2
652 1
653 1
654 1
655 1
656 2
657 1
658 1
659 0
660 7
661 1
662 1
663 0
664 0
665 2
666 2
667 1
668 0
669 1
670 1
671 0
672 6
673 1
674 2
675 2
676 0
677 1
678 0
679 1
680 1
681 0
682 2
683 1
684 7
685 1
686 1
687 1
688 1
689 1
690 2
691 1
692 2
693 2
694 2
695 0
696 8
697 0
698 3
699 2
end
format %tm monthly_date