Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: dealing with multiple alphanumeric responses


From   "Steichen, Thomas" <STEICHT@RJRT.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: dealing with multiple alphanumeric responses
Date   Mon, 1 Jul 2002 17:03:08 -0400

Pooja Gupta writes:

> one of my
> variables has multiple alphanumeric characters that are not 
> seperated by commas.
> for eg, the first five observations of the variable are
> 
> 1. ABC
> 2. ABCEG
> 3. BDEGHI
> 4. ACDFGI
> 5. AHI
> 
> can a write a code which allows me to do a tabulation of each 
> of these alphabets
> (i.e., how many As, how many B, how many C and so on) ?

Something of the form

. for any A B C D E F G H I: gen v_X=index(var, "X") \ replace v_X=1 if v_X>1 

where A B C D E F G H I is the list of possible alpha characters
  and var is the variable of interest

will generate individual numeric (0,1) variables for each alpha code
that can then be tabulated with the usual tabulation commands.

Tom
CONFIDENTIALITY NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information.  If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system.  Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index