Skip to Main Content

Data Analysis with Stata

preserve / restore

Pseudocode showing what you can use preserve and restore for.

*Open dataset
*Do some stuff on it -- call data as they look now "Version 1"

preserve

*Make more changes to data
*Save current version of data in separate file

restore

*Return to Version 1