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]

From |
"David Radwin" <dradwin@mprinc.com> |

To |
<statalist@hsphsun2.harvard.edu> |

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

Date |
Tue, 31 May 2011 09:00:10 -0700 (PDT) |

Nick, The issue with copying as table is lining up the cursor precisely so that Stata "knows" where the tab stops are. I can't easily describe this in words. It may take some trial and error. David Elliott addressed this problem a while ago: http://www.stata.com/statalist/archive/2007-07/msg00238.html . If you use another command like -tabout- (SSC) or -outsheet- to create comma-separated or tab-separated tables in separate files, you can simply open the files directly in Excel (or the equivalent) and the tab stops will always be in the correct places. 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: owner-statalist@hsphsun2.harvard.edu [mailto:owner- > statalist@hsphsun2.harvard.edu] On Behalf Of Nick Petschek > Sent: Saturday, May 28, 2011 8:45 PM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: RE: How to use dataset where each record relates to a > specific number of observations (weights?) > > Thank you, David. Worked magically. However I was unable to copy it > into excel without formating issues (neither copying "as table" or > text import in excel worked). > > Nick > > On Thu, May 26, 2011 at 9:16 PM, David Radwin <dradwin@mprinc.com> wrote: > > 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: owner-statalist@hsphsun2.harvard.edu [mailto:owner- > >> statalist@hsphsun2.harvard.edu] On Behalf Of Nick Petschek > >> Sent: Thursday, May 26, 2011 5:57 PM > >> To: statalist@hsphsun2.harvard.edu > >> 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 > >> 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/

**References**:**st: How to use dataset where each record relates to a specific number of observations (weights?)***From:*Nick Petschek <nick.petschek@gmail.com>

**st: RE: How to use dataset where each record relates to a specific number of observations (weights?)***From:*"David Radwin" <dradwin@mprinc.com>

**Re: st: RE: How to use dataset where each record relates to a specific number of observations (weights?)***From:*Nick Petschek <nick.petschek@gmail.com>

- Prev by Date:
**Re: st: censored regression - testing for normal and homoscedastic residuals** - Next by Date:
**st: Writing the value of a variable in another variable in a selective way** - Previous by thread:
**Re: st: RE: How to use dataset where each record relates to a specific number of observations (weights?)** - Next by thread:
**st: Proportional hazard assumption** - Index(es):