Goodmorning,
this is my first post and I have not found any information with the Search box nor on the manuals (but I might not be formulating it correctly, since I am a Stata beginner).
I am using Stata 15 on Mac and I have a db of patients (800 patients and 14000 observations). Each has an ID, but most of the patients have more than one line (each line represents a visit, and each patient has several visits, but not all patients have the same number of visits).
The patients are asked their administrative situation (variable "papers") on their first visit (and in later visits, for example when their situation changes, but sometimes just to confirm the initial situation). For some patients this variable is empty on their first visits, and is only filled in after 3-4 visits. For other patients this variable has never been filled in.
I can identify so far when the administrative situation variable is empty at the beginning:
Code:
list ID if papers == "" & num_doublon == 1 browse if papers == "" & num_doublon == 1 // 74 patients
- the ones that have the administrative situation variable always empty (and leave it as such/check for the paper dossier)
- the ones that have a missing variable at the beginning but that has been filled after, in which case I would like to see what the variable is and decide if I want to use the first value that has been signed up for the patient or leave it blank (and check the paper dossier for the information).
I could obviously do this manually, but I assume there is a smarter way of doing this....
Here is a small example of my db with the three different situations:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float ID str27 papers 110426 "" 110426 "" 110426 "" 110426 "" 110491 "situation A" 110491 "situation A" 110491 "situation A" 110491 "situation B" 110491 "situation A" 110531 "" 110531 "situation C" 110531 "situation D" 110531 "situation D" 110531 "situation D" 110531 "situation D" 110531 "situation D" 110531 "situation D" 110531 "situation D" 110531 "" 110531 "situation D" end
Any help is more than appreciated, and I hope the question is clear. All my apologies if this sounds like a basic question but I am a bit stuck!
Thank you very much,
Chiara
0 Response to sorting fully empty variables for each ID from partially missing ones (and filling them in)
Post a Comment