cap log close log using stata-read_data-data_xls.smcl, replace smcl /* Read the spreadsheet in to Stata */ import excel using stata-read_data-data.xls, sheet("Sheet1") cellrange(a3:i14) clear /* Remane the variables */ rename A party rename B up rename C elected rename D notup rename E y2004 rename F y2006 rename G plusminus rename H vote rename I percent label variable party "Political party" label variable up "Seats up" label variable elected "Number elected" label variable notup "Seats not up" label variable y2004 "Seats in 2004" label variable y2006 "Seats in 2006" label variable plusminus "Margin of seats" label variable vote "Number voting for party" label variable percent "Percentage voting for party" /* Format the variables */ format party %-23s format vote %10.0fc format percent %9.2f /* Save the data */ save SOCY699C-election.dta, replace log close