Is this what you mean?  Or do you have multiple obs per Name?  You
could also accomplish the same task with a -reshape- then -bys Name:-
construct.
version 8.0
input str2 Name str2 D8 str2 D9 str2 D14 str2 D15 str2 D16
  "Z"   "A" "A" "P" "P"  "P"  "A"
  "G"   "P" "A" "P" "P"  "A"  "P"
  "S"   "A" "P" "P" "P"  "A"  "A"
  "An"  "A" "P" "P" "A"  "P"  "P"
  "Ma"  "P" "P" "P" "P"  "A"  "P"
 end
qui ds D*
gen long CA=0
gen long CP=0
foreach v of varlist `r(varlist)' {
 qui replace CA=CA+1 if `v'=="A"
 qui replace CP=CP+1 if `v'=="P"
 }
li , noo clean
    Name   D8   D9   D14   D15   D16   CA   CP
       Z    A    A     P     P     P    2    3
       G    P    A     P     P     A    2    3
       S    A    P     P     P     A    2    3
      An    A    P     P     A     P    2    3
      Ma    P    P     P     P     A    1    4
On 1/11/06, victor michael zammit <[email protected]> wrote:
> Hello Stata listers,
> In version 8 ,how do you get to count the number of P's and A's for each
> Name
>
> Hello Stata listers,
> In version 8 ,how do you get to count the number of P's and A's for each
> Name
>
>  Name D8  D9  D14  D15  D16  D19
> 1.  Z      A    A    P      P       P     A
> 2. G       P     A    P      P      A     P
> 3. S       A      P    P      P      A    A
> 4. An    A       P    P     A       P    P
> 5. Ma    P       P    P      P     A     P
*
*   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/