Hi Everyone,

I have a string variable that contains multi-picklist values separated by a semi-colon and I need to count each value's occurrence. After using split to parse the values and using multencode to separate and label all values I became stuck. I think I need to use a loop but not sure how to set that up as I'm a pretty novice user; any help setting this up to count values across variables would be much appreciated.

My actual data contains many more values so multencode creates 10 new variables, and the picklist contains 33 possible values. I've read the loop in the manual and still can't quite figure it out.

Here's a pared-down version of something similar:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str256 socialasst
"Housing; Food"                                        
"Financial Assistance; Health Supplies"                
"Financial Assistance; Legal Support; Workplace Issues"
"Financial Assistance; Rent/Eviction Support"          
"Cleaning Supplies; Financial Assistance; Food"        
"Cleaning Supplies; Food; Health Supplies"             
end
Code:
format socialasst %45s
split socialasst, p("; ")

ssc install multencode
multencode socialasst1-socialasst3, gen(nsa1-nsa3) label(reason)
numlabel reason, add