* Closes a log file named svydes1 if it is already open. * The capture prefix suppresses any error message if the log is not open. capture log close svydes1 * Removes all data currently in memory. clear * Prevents Stata from pausing output one screen at a time. set more off * Sets the output line width to 255 characters, reducing line wrapping in the log file. set linesize 255 * Loads the dataset short0212.dta into memory. use "F:\Heroin\short0212.dta" * Opens a log file named svydes1.log. * Replace or overwrites any existing file with the same name. * The log is assigned the name svydes1. log using "F:\heroin\svydes1.log", name (svydes1) replace * Specifies survey Design. * Produces a description of the survey design for observations where year = 2012. * Saves all output to svydes1.log. * Closes the log file named svydes1 that was previously opened with: svyset verep [pweight=analwt], strata (vestr) vce(linearized) /// singleunit(missing) svydescribe analwt if year==2012 log close svydes1