Presentation on contract.collapse command

anshukgec1599 10 views 7 slides Mar 11, 2025
Slide 1
Slide 1 of 7
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7

About This Presentation

Presentation on contract.collapse command


Slide Content

Welcome to the Training on Data Processing with Stata by Anshuman Bhattacharjee DCO ODISHA contract , preserve,restore,collapse in Stata Day 1, Sessions II

Preserve a Dataset preserve preserves the data, guaranteeing that data will be restored after program termination. restore forces a restore of the data now. set max_preservemem , available only in Stata/MP, controls the maximum amount of memory preserve will use to store preserved datasets in memory. Once this limit is exceeded, preserve will store datasets on disk. Command preserve

contract contract replaces the dataset in memory with a new dataset consisting of all combinations of varlist that exist in the data and a new variable that contains the frequency of each combination .

contract

collapse collapse converts the dataset in memory into a dataset of means, sums, medians, etc. Command : - collapse clist [if] [in] [weight] [, options] clist must refer to numeric variables exclusively where clist is either [(stat)] varlist [ [(stat)] ... ] [(stat)] target_var=varname [target_var=varname ...] [ [(stat)] ...] or any combination of the varlist or target_var forms, and stat is one of

collapse

THANK YOU