--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
--- On Thu, 10/9/09, Rajaram Subramanian Potty wrote:
> I have a variable which is multiple response and is a
> string variable and is in character. Now, I want to know how
> may respondents was given different characters. The
> following is the example of the variable with 5
> observations
> Var1
> 1. ABCDE
> 2. BFGH
> 3. ABIJK
> 4. BDJK
> 5. BC
> Now, I want to know how many are answered A, or B or C
> or D or E etc.
*------------- begin example --------------
clear
input str5 y
ABCDE
BFGH
ABIJK
BDJK
BC
end
gen a = strpos(y,"A") > 0
gen b = strpos(y,"B") > 0
gen c = strpos(y,"C") > 0
gen d = strpos(y,"D") > 0
gen e = strpos(y,"E") > 0
gen f = strpos(y,"F") > 0
gen g = strpos(y,"G") > 0
gen h = strpos(y,"H") > 0
gen i = strpos(y,"I") > 0
gen j = strpos(y,"J") > 0
gen k = strpos(y,"K") > 0
list
total a-k
*------------- end example --------------
Hope this helps,
Maarten
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/