My problem with Stata 15.0 concerns the r(2000) error: no observations. You have requested some statistical calculation and there are no observations on which to perform it. Perhaps you specified if or in and inadvertently filtered all the data.
This makes sense because when I manually check my data I can see that my code has indeed filtered all of the data. However as I am using Stata to clean data and check for errors this is actually a good thing (it means the data that piece of code was checking is clean and free of errors). So how do I run this code but make it so that if the code does filter all the data it just carries on to the next chunk of code?
The code I am using is:
I have also tried using:
The latter prevented the error from occurring, but when I entered dummy data of a date that the code should pull out (05/05/2018) it didn’t pull this out.
Example data (this is made up data for confidentiality reasons but this reflects the type of data I am working with) (I read about dataex but it was not clear from the guidance on how to implement this in a forum pot, I hope what I have done below is satisfactory, if not the please let me know how to amend what I have done and I will do so):
Thank you in advance for any advice.
Best wishes,
Jenna
This makes sense because when I manually check my data I can see that my code has indeed filtered all of the data. However as I am using Stata to clean data and check for errors this is actually a good thing (it means the data that piece of code was checking is clean and free of errors). So how do I run this code but make it so that if the code does filter all the data it just carries on to the next chunk of code?
The code I am using is:
Code:
putdocx paragraph putdocx text ("ILI 3 date of onset is not between the baseline date and the 30th April 2018") putdocx table TRIALNAME = data(StudySubjectID VISDAT_E1_C1 ILISTDAT_E7_C17_3) if /// ILISTDAT_E7_C17_3 > td(30apr2018) & ILISTDAT_E7_C17_3 !=.
Code:
if !_rc { putdocx paragraph putdocx text ("ILI 3 date of onset is not between the baseline date and the 30th April 2018") putdocx table TRIALNAME = data(StudySubjectID VISDAT_E1_C1 ILISTDAT_E7_C17_3) if /// ILISTDAT_E7_C17_3 > td(30apr2018) & ILISTDAT_E7_C17_3 !=. }
Example data (this is made up data for confidentiality reasons but this reflects the type of data I am working with) (I read about dataex but it was not clear from the guidance on how to implement this in a forum pot, I hope what I have done below is satisfactory, if not the please let me know how to amend what I have done and I will do so):
Code:
StudySubjectID VISDAT_E1_C1 ILISTDAT_E7_C17_3 100 06/10/2017 15/02/2018 101 06/10/2017 102 10/10/2017 22/02/2018 103 21/10/2017 03/03/2018 104 23/10/2017 12/12/2017 105 30/10/2017 106 30/10/2017 107 31/10/2017 05/01/2018 108 01/11/2017 109 01/11/2017 110 02/11/2017 06/04/2018 110 02/11/2017 23/03/2018 110 02/11/2017 21/12/2017 110 02/11/2017 110 02/11/2017 110 02/11/2017 110 03/11/2017 15/01/2018 110 03/11/2017 110 03/11/2017 110 04/11/2017 29/04/2018
Best wishes,
Jenna
Comment