Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Petschek <nick.petschek@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: How to use dataset where each record relates to a specific number of observations (weights?) |
Date | Thu, 26 May 2011 20:57:18 -0400 |
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 nick.petschek@gmail.com -- 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/