Introduction
Frames are useful if you plan to work with different datasets simultaneously. You can change easily between datasets without continuously saving and loading them. You can easily access objects across the datasets. And you can link datasets and thus use variables from one dataset in the other dataset.
Frames
Introduction to Frames
* Preparation
clear all
cd "[working directory]"
import excel "WDI_selected.xlsx", firstrow clear
drop TimeCode
rename (Time CountryName CountryCode) (year country code)
destring GDPpercapitaPPP-Lifeexpectancyatbirthmale, replace force
* Create a new frame
frame create cntry_codes
* Load data into a frame
frame cntry_codes: use "Country_classification", clear
* Inspect data (or run any other command) in a frame
frame cntry_codes: browse
frame cntry_codes: isid code
frame cntry_codes {
gen n = _n
tab country if n<=10, su(n)
drop n
}
* Change between frames: frame change & cwf
describe
frame change cntry_codes // Changes to frame "cntry_codes" (Version 1)
describe
rename country name
cwf default // Changes to frame "default" (the "original" frame) (Version 2)
describe