I am trying to create a variable that will count how many nonmissing responses across several string variables exist per observation. I'm using Stata 15.1 on a Mac.
This is what my code looks like:
Code:
egen activ_count = rownonmiss(activ_ac-activ_other), strok
This is what I am trying to get it to do:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str41 activ_ac str58 activ_soc str22 activ_other float activ_count " " " " " " 0 " " " " " " 0 " " " " " " 0 " " " " " " 0 "Academic" " " " " 1 "Academic" " " " " 1 "Academic" "Social" "Other" 3 " " " " " " 0 "Academic" " " " " 1 " " " " " " 0 end
But this is what the code is actually doing:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str41 activ_ac str58 activ_soc str22 activ_other float activ_count " " " " " " 3 " " " " " " 3 " " " " " " 3 " " " " " " 3 "Academic" " " " " 3 "Academic" " " " " 3 "Academic" "Social" "Other" 3 " " " " " " 3 "Academic" " " " " 3 " " " " " " 3 end
I saw a similar post that illustrates that this code should work. I can't figure out what I did differently to make it not work. What is the error that I am making?
Thank you!
Sheilagh
0 Response to Problem with egen rownonmiss, strok
Post a Comment