You can transform the string values of MFNO to numeric ones using -destring-
then assign codes to the non-numerical values (before and after)
egen code = group(when) //this is done for each "when"
then use -tab- with the by option
Hope this helps
Rafa
----- Original Message -----
From: "Nick Cox" <[email protected]>
To: <[email protected]>
Sent: Tuesday, January 13, 2004 5:57 PM
Subject: st: FW: [counting before and after]
> Mark Laflamme wrote to me privately,
> and I take the liberty of forwarding to the list:
>
> Variables are named when1 when 2 to when10
> Variable is a string either "BEFORE" or "AFTER" or which neither are
> written(not a missing value)
> A provider has made an order BEFORE or AFTER an encounter
> Providers are categorizd by variable provcode as 1,2,3 or 4
> for particular patients, patient is categorized by string variable
> mrno(8 digits with a dash)
>
> For example
> MRNO when1 when2 when3 ........ when10 provcode
> 1112220-1 BEFORE AFTER 2
> 2223334-5 AFTER AFTER AFTER 3
> 3334445-6
> 4
> 4445556-7 BEFORE BEFORE AFTER AFTER 1
>
> I am trying to ....
> 1) sum the number of BEFORE and AFTER and/or neither for each MRNO
> 2) sum the number of BEFORE and AFTER and/or neither for each provcode
> 3) a table for BEFORE and AFTER
>
> For example....
> AFTER
> Yes NO
>
> BEFORE yes 12 34
> No 5 12
> TOTALS
>
> *
> * 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/
>
*
* 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/