Hello! I am somewhat new to Stata and have tried to find an answer to this on other threads but have been unable to find something that works with my dataset. I have attached a snippet from my dataset. I have upwards to 6,000 observations, so you could see why I am trying to find a way to code for this issue.
This is a dietary recall dataset. I am trying to begin data cleaning, and one of my parameters is that I only want to include subjects that have recalls from two days (as opposed to only one). I am having trouble coming up with a way where I can ultimately create a variable and code it 0/1 for if they have recalls for two days or not. As you can see, the number of entries for each ID can vary greatly. Some have 6 while others have up to 14. This obviously doesn't matter when I just need to verify that I have recalls for two days, but it does make it a little tricky to handle since I can't reshape the data. Can someone lend some insight on how to handle this? I am open to hearing other suggestions that may be better than what I'm trying to do as well.
I appreciate any and all help I can get with this.
Related Posts with How to identify if each ID has two unique values for a variable
Counting observations of nearest neighboursDear forum members, my data is a panel structured as follows: id change nid1 nid2 nid3 nid4 nid5 Fo…
ivreg2 command for woolridge version of LPHi, Can you please let me know the ivreg2 command for estimating productivity using Woolridge versio…
creating one dummy from many dummiesDear Members, I have seven dummies; region1 region2 region3 region4 region5 region6 region7; now i w…
Missing Standard Errors when vce(r) specified in xtreg, feDear All, Before I added 'vce(r)' option at the end of my xtreg, fe model I got standard error in th…
(Technical) Problem with instrumental variables regression: (not existing) variable not foundDear statalisters, After having used other people's questions on the forum a lot during my research…
Subscribe to:
Post Comments (Atom)
0 Response to How to identify if each ID has two unique values for a variable
Post a Comment