Hello,
Currently I have a database with the donators and theirs giving in UK. I had create 4 column : giv2, giv4, giv6, giv8 and if the person has given in the wave 2 the value in giv2 is 1; same reasoning for the others giv4,6,8.
I would like to create 4 new column with :
- never : never give on the 4 waves
- seldom : give 1 time over the 4 waves
- Time to time : give 2 or 3 times over the 4 waves
- Always : give 4 times over the 4 waves
I don't know how to do it, maybe with a max function ?
For the seldom this one could be work ? : bysort pidp: egen seldom = max(giv2==1 & giv4==1 & giv6==1 & giv8==1)
Thanks for your help
Related Posts with Generate new variable with if
How to see the frequency of a veriables in each country in a dataset ?By the helps from others, I see that I can list the unique countries from a sample by using\ tab GE…
Why the number of observation decrease when I increase the sample size?Hi all, Today I face a strange situation that the number of observations shrinking when I expand th…
Test constraint droppedDear Statalist: *First, I run the following Modified Pearson Regression with interactions glm k6ca…
"Starting values invalid" message when using nlsur commandsDear Stata users, I am trying nlsur command using function evaluator program to estimate coefficien…
What is wrong with inlist2 in my code?Hi all, Yesterday, as documented from this post (https://www.statalist.org/forums/for...p-of-countr…
Subscribe to:
Post Comments (Atom)
0 Response to Generate new variable with if
Post a Comment