Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Counting between 2 variables


From   Lucie Vlach <Lucie.Vlach@albertahealthservices.ca>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Counting between 2 variables
Date   Mon, 30 May 2011 15:42:05 -0600

Thank you Eric!

I was able to get this easy to read output after collapsing:

149. |  Brown      03.05UW DC-Form Completion          1 |
150. |  Brown      03.05WV case manag/team Conf.       1 |
     |--------------------------------------------------------|
151. |  Jones      03.05CJ OC-Misc Desk Work           4 |
152. |  Jones      03.05SQ DC-Telephone re Patient     2 |
153. |  Jones      03.05WP DC-Review Labs/Reports     13 |
     |--------------------------------------------------------|
154. | Smith       03.05CF OC- Review Labs/Reports     3 |
155. | Smith       03.05SQ DC-Telephone re Patient     1 |
156. | Smith       03.05SR OC-Telephone re/with Pat    2 |
<snip>
And then with tabstat I can get the grand totals of  all the calls submitted per person:
tabstat  calls_submitted, by( provider_lastname) stat(sum)

Thank you very much!!

Lucie

________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Eric Booth [ebooth@ppri.tamu.edu]
Sent: May 30, 2011 12:19 PM
To: <statalist@hsphsun2.harvard.edu>
Subject: Re: st: Counting between 2 variables

<>

One approach is to use -collapse- to create your freq by provider/hsc.  Here's an example to get you started:
****************!
clear
inp str10 provider_lastname  calls_submitted   str80 hsc_num
Brown   10    "03.05CJ OC-Misc Desk Work"
Brown   10    "03.05TN DC-Misc Desk Work Multiple Pts"
Brown   2    "03.05UT DC-Telephone with Patient"
Brown   1    "03.05TU Otr Diagnos Inter./Eval."
Jones   1    "03.05TU Otr Diagnos Inter./Eval."
Jones   10    "03.05CJ OC-Misc Desk Work"
Jones   8    "03.05TN DC-Misc Desk Work Multiple Pts"
Smith   10    "03.05CJ OC-Misc Desk Work"
Smith   10    "03.05CJ OC-Misc Desk Work"
Red   10    "03.05CJ OC-Misc Desk Work"
Red   8    "03.05CJ OC-Misc Desk Work"
Red   10    "03.05CJ OC-Misc Desk Work"
end
**
collapse (sum) calls_submitted  , by(provider hsc_num)
**
l, sepby(provider)
outsheet using "test.xls", replace
**
gr hbar calls_subm, over(hsc_num) over(prov) blabel(bar) nofill
****************!

- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754


On May 30, 2011, at 1:01 PM, Lucie Vlach wrote:

> Hello all!
>
> I have a problem, and I am not sure what to do. Tried for 3 days.
> I need to generate a new variable, or come up with a command, that will tell me the real count of how many of “hsc_num” each different codes each “provider_lastname”(person) submitted. (“calls_submitted”).
>
> For example: (top line of data) Brown submitted 10 units of “03.05CJ OC-Misc Desk Work”. How would I be able to illustrate how many of each type of  “hsc_num” each person submitted. Things would be easy if this dataset only listed everything as per 1 unit of  “calls_submitted”, but the submission units vary from 1 to 52 units in my dataset.
>
> I want to be able to say something like:
> Brown submitted 340 units of calls, and his “hsc_num” types were distributed this way (in frequencies etc).
> Jones submitted total of 19 units of calls, and his codes were 10 of A, 8 of B, 1 of C, etc...
>
> I acn graph it or just do tables, anything will be great.
>
> SAMPLE of dataset:
>
> provider_lastname,  calls_submitted,   hsc_num
> Brown   10    03.05CJ OC-Misc Desk Work
> Brown   10    03.05TN DC-Misc Desk Work Multiple Pts
> Brown   2    03.05UT DC-Telephone with Patient
> Brown   1    03.05TU Otr Diagnos Inter./Eval.
> etc.
> Jones   1    03.05TU Otr Diagnos Inter./Eval.
> Jones   10    03.05CJ OC-Misc Desk Work
> Jones   8    03.05TN DC-Misc Desk Work Multiple Pts
> etc.
> Smith   10    03.05CJ OC-Misc Desk Work
> Smith   10    03.05CJ OC-Misc Desk Work
> etc.
> Red   10    03.05CJ OC-Misc Desk Work
> Red   8    03.05CJ OC-Misc Desk Work
> Red   10    03.05CJ OC-Misc Desk Work
> <snip>
>
> Thank you very much for any help!
>
> Lucie
>
> This message and any attached documents are only for the use of the intended recipient(s), are confidential and may contain privileged information. Any unauthorized review, use, retransmission, or other disclosure is strictly prohibited. If you have received this message in error, please notify the sender immediately, and then delete the original message. Thank you.
>
> *
> *   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/




*
*   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/

This message and any attached documents are only for the use of the intended recipient(s), are confidential and may contain privileged information. Any unauthorized review, use, retransmission, or other disclosure is strictly prohibited. If you have received this message in error, please notify the sender immediately, and then delete the original message. Thank you.

*
*   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/


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