Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Summarizing variables


From   Sergiy Radyakin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Summarizing variables
Date   Wed, 7 Aug 2013 13:37:06 -0400

See this example. Copying to Excel is generally nicer from the browser.

sysuse nlsw88, clear
keep occupation wage
rename occupation practice_code
rename wage weight

sort practice_code
collapse (mean) weight, by(practice_code)
rename weight practwt
list, clean noobs nol
browse, nol

On Wed, Aug 7, 2013 at 1:20 PM, Nick Cox <[email protected]> wrote:
> This sounds like
>
> tab practice_code, su(practwt)
>
> or perhaps what -groups- (SSC) can do.
>
> Nick
> [email protected]
>
>
> On 7 August 2013 18:13, Lisa Cook <[email protected]> wrote:
>> Hi,
>>
>> I'm trying to output values for two variables using Stata/IC 11.2 for Windows.
>>
>> My dataset includes about 50,000 patients grouped in about 50 primary
>> care practices. I've created some practice-level variables like
>> weights and practice-level means, but I'm having trouble getting Stata
>> to output what I want. My immediate goal is to get Stata to list the
>> practice IDs and practice weights in a table like this:
>>
>> practice_code      practwt
>> 120                      .034
>> 130                      .045
>> etc.
>>
>> I can get Stata to give me the practice weights if I tell it:
>>
>> by practice_code, sort: ta practwt
>>
>> But the output is ugly and impossible to copy into Excel:
>>
>> -> practice_code = 92
>>
>>     practwt |      Freq.     Percent        Cum.
>> ------------+-----------------------------------
>>    .0068969 |        367      100.00      100.00
>> ------------+-----------------------------------
>>       Total |        367      100.00
>>
>> I've downloaded the program "vallist", hoping it would do what I
>> needed, but it doesn't. Any other user-written programs out there? Or
>> is there an option in a built-in program that I should be using?
>>
>> Thanks,
>> Lisa
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index