Using Stata for Survey Data Analysis


Example 17. Using weights in generating tables


Download 1.39 Mb.
Pdf ko'rish
bet42/61
Sana08.03.2023
Hajmi1.39 Mb.
#1252470
1   ...   38   39   40   41   42   43   44   45   ...   61
Bog'liq
2009 Usingstataforsurveydataanalysis (1)

Example 17. Using weights in generating tables 
 


Minot
 
 
 
 
 
Using Stata for Survey Analysis 
Page 38 
 

SECTION 8: MODIFYING DATA FILES
This section describes a number of commands that are used to modify and combine data files in Stata.
We begin with a five simple commands and then move to five more complex ones.
rename 
drop 
keep 
sort 
compress 
collapse 
merge 
append 
reshape 
fillin 
rename 
This command renames variables. Some examples: 
rename oldname newname 
rename b21_q1 sexhead 
rename b21_q3ag agehead 
drop 
This command deletes records or variables. Examples are:
drop if agehead>140
deletes records in which age is greater than 140 
drop if area==.
deletes records in which area is missing 
drop temp1 temp2 
deletes variables temp1 and temp2 
keep 
This command deletes everything but specified observations or variables. Examples include: 
keep if agehead <= 140 
keeps only records in which age is 140 or under  
keep hhid agehead pcexpend 
keeps only variables hhid, agehead, and pcexpend, 
deleting all others 
sort 
This command sorts the records in the file according to the value of specified variables. It is the same 
as “sort cases” in SPSS. Examples are: 
sort region town 
sorts data file in order of region and town
sort urban 
sorts by the dummy variable urban 
compress  
This command reduces the size of the file by changing the data storage types. It will not make any 
changes that would cause Stata to lose data. This command has no options or arguments. 



Download 1.39 Mb.

Do'stlaringiz bilan baham:
1   ...   38   39   40   41   42   43   44   45   ...   61




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling