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
Oaxaca analysisHi, I am trying to use oaxaca command to run a nonlinar decomposition analysis I am using this code:…
Can lpoly/lowess/npregress be used in a survival analysis context?Hi experts, I know that in STATA we can use the logit command to fit a discrete-time logistic hazar…
Impact of policyHello, I am new to Stata and I want to determine the impact of a policy on 8 countries using a 9 yea…
How to modify value labels based on certain words already present in value labelsHello everyone, I have a set of categorical variables which have certain value labels attached to th…
Exporting output of ManWitney U TestHi, I am unable to find a way to export output of ManWitney U (ranksum) Test for independent samples…
Subscribe to:
Post Comments (Atom)
0 Response to How to identify if each ID has two unique values for a variable
Post a Comment