Introduction to Stata
摘要
This chapter introduces Stata, a widely used statistical software for data management, analysis, and visualization, with a focus on its application to DEA and SFA. It begins with an overview of Stata’s interface, menu bar, toolbar, and key windows, highlighting efficient navigation through commands, do-files, and reproducible workflows. Basic data operations—such as importing/exporting datasets, managing variable and value labels, and executing core commands—are demonstrated using built-in examples. The chapter then explains essential programming concepts, including comments, working directories, macros (local and global), scalars, matrices, and variable creation. It also covers system path management for organizing ado-files. Building on this foundation, the chapter guides readers through writing reusable ado commands, from structuring syntax and parameters to enhancing flexibility and error checking. The Mata programming environment is introduced for advanced, high-performance matrix operations, control structures, and custom function development. Throughout, practical examples—such as batch data processing with loops and automation of repetitive tasks—illustrate how Stata’s programming capabilities can be harnessed for efficient, transparent, and reproducible research workflows.