Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: combining multiple years of data

From (Jeff Pitblado, StataCorp LP)
Subject   Re: st: combining multiple years of data
Date   Sat, 17 Feb 2007 21:14:28 -0600

Eleanor Friedman <> asks for the Stata equivalent of using
the PSULEV option in SUDAAN's NEST statement:

> Hello, I am a first time poster, so please indulge me!
> I am using STATA 9 to try and examine trends across multiple
> years of data from the CDC's BRFSS survey. I have had no
> problem when using a single year of data using the SVY
> commands. the CDC offers the following SUDAAN code to combine
> years: "NEST SURVYEAR _STSTR_PSU PSULEV=3;" My problem is that
> I have no idea how to translate this into STATA. As far as I
> have been able to determine, NEST does not exist in STATA, and
> I am unable to find an analog. I contacted the CDC asking how
> to combine several years of BRFSS data in STATA  and they said
> I should contact people who use STATA more frequently.
> Suggestions?

In the SUDANN line


the 'PSULEV=3' option identifies the position of the PSU (primary sampling
unit) variable in the NEST statement.  This means that all other variables to
the left of this position identify the strata in the first stage.  Eleanor's
example only specifies 2 variables, so this means that the 'SURVYEAR' and
'_STSTR_PSU' variables identify the first stage strata.

Although Stata's -svyset- command allows only one variable in the -strata()-
option for each sampling stage, Eleanor can use -egen- with the -group()-
function to generate a single strata variable for use with -svyset- in this

Assuming Eleanor only has information for the first stage and the weight
variable (in her Stata dataset) is named SAMPWEIGHT, she can do the following:

	. egen STRATA1 = group(SURVYEAR _STSTR_PSU)
	. svyset _n [pw=SAMPWEIGHT], strata(STRATA1)

I would also suggest that Eleanor save this modified dataset under a new name,
such as

	. save mybrfss

Then Eleanor can use this new 'mybrfss.dta' Stata dataset in the future
without having to worry about the survey design variables since the -svyset-
information is saved with the data in 'mybrfss.dta'

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index