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

st: Count Special Character


From   "Kang, Eugene" <EKang@mays.tamu.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Count Special Character
Date   Sat, 26 Feb 2005 15:03:41 -0600

Hi,

I would appreciate some help on the following problem.

I have a variable that captures individual names in my dataset. If there
is more than 1 individual, then the names are separated by a /. For
instance, there are 2 individuals if the variable shows
riedel/baysinger, while there are 3 individuals if the variable shows
riedel/baysinger/hitt.

I need to create a new variable that captures the number of individuals
for an observation. Does STATA allow me to count the number of / in a
variable? In the above example, 1 / would indicate 2 individuals for
that observation, while 2 / will indicate 3 individuals, and so on. I
could count the number of / manually, but I have close to 20,000
observations in the dataset!!

Eugene Kang


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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