RAJA 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.
=========================================================
To put it another way: You want a separate variable for each response
/A, B, C, ...).
clear
input str5 var1
ABCDE
BFGH
ABIJK
BDJK
BC
end
foreach V of newlist A B C D E F G H I J K {
gen `V' = strpos(var1,"`V'")>0
}
Hope this helps
Svend
________________________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(School of Public Health, Department of Epidemiology)
Bartholins Allé 2
DK-8000 Aarhus C, Denmark
Phone: +45 8693 7796
Mobile: +45 2634 7796
E-mail: [email protected]
_________________________________________________________
*
* 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/