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]

st: RE: How to use dataset where each record relates to a specific number of observations (weights?)


From   "David Radwin" <[email protected]>
To   <[email protected]>
Subject   st: RE: How to use dataset where each record relates to a specific number of observations (weights?)
Date   Thu, 26 May 2011 18:16:33 -0700 (PDT)

Nick,

1. It is weighting. Add [fweight=NUMBER] to your commands in the
appropriate place, typically immediately before the comma that signifies
options. See -help weight- for more on this.

2. Try this:

. recode NAT (1=100) (2=0), generate(NAT2)
. table COUB COUNTRY, contents(mean NAT2) format(%9.0f)

If you want percentage signs and/or Excel-friendly output, try installing
and using Ian Watson's -tabout- from SSC. A nice PDF help file is also
available.

. ssc install tabout

David
--
David Radwin
Research Associate
MPR Associates, Inc.
2150 Shattuck Ave., Suite 800
Berkeley, CA 94704
Phone: 510-849-4942
Fax: 510-849-0794

www.mprinc.com


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Nick Petschek
> Sent: Thursday, May 26, 2011 5:57 PM
> To: [email protected]
> Subject: st: How to use dataset where each record relates to a specific
> number of observations (weights?)
> 
> Dear Statalist,
> 
> I have two (basic) questions.  I would very much appreciate direction
> on either or both!
> 
> 1. How do I use a dataset where each record (row) is representing more
> than one observation?  Specifically, there is a variable NUMBER which
> denotes how many observations the record refers to.  Abstractly I
> understand that each record would just need to be multiplied by
> NUMBER.  At the moment I am only looking to run cross-tabs but do not
> understand how to get STATA to incorporate the variable NUMBER (which
> I believe could be similar to weighting?).
> 
> For example, I want the naturalization rates of foreign born
> populations using NAT (1 if naturalized 2 if not) COUB (country of
> birth) and COUNTRY (country of residence) to find the percent of each
> foreign born group naturalized in each host country.  I have run:
> 
> by NAT, sort : tab COUB COUNTRY
> 
> However this does not capture the fact that each record refers to a
> distinct number of observations.
> 
> 
> 
> 2. I am sure there must be a more straightforward way to obtain the
> results I am looking for, with the above code I have been exporting to
> excel and then doing the final percent calculation.  Is there a more
> straightforward way to tell STATA what I want?  Ideally I want my
> results to look like this:
> 
>                  COUNTRY
> COUB          1            2            3
> A              %nat      %nat      %nat
> B              %nat      %nat      %nat
> C              %nat      %nat      %nat
> 
> 
> 
> Many thanks for advice or direction,
> 
> Nick
> [email protected]
> 
> --
> Nicholas S. Petschek
> Master's Candidate | Tufts University
> Urban and Environmental Policy and Planning | 2012
> MALD at The Fletcher School | 2012
> *
> *   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/


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