Stata Operators Arithmetic Logical Relational + Addition & And > Greater Than - Subtraction | Or < Less Than * Multiplication ! Not >= Greater Than or / Dividsion ~ Not <= Less Than or Equal ^ Power == Equal - Negation != Not + String Concatenation ~= Not Equal The order of evaluation (from first to last) of all operators is ! (or ~), ^, - (negation), /, *, -(subtraction), +, != (or ~=), >, <, <=, >=, ==, &, and |. Time Series Operators Lag / Lead Differences L.var Lag var one period D.var Difference (vart 1) vart - vart 1 – – L2.var Lag var 2 periods D2.var Difference of difference (vart 2) vart - vart 1 (vart 1 - vart 2) – – – – – … … F.var Lead var one period L.var Seasonal difference, one period (vart + 1) - 1 vart vart – F2.var Lead var 2 periods L2.var Seasonal difference, two periods (vart + 2) vart - vart 2 – … … File Access and Set-Up Commands Working directory The working directory is the folder where Stata looks to find data and save data and log files. Setting a working directory means that only the file name, not the full path, will be needed. Command Description Example pwd the current working to the output window cd Change the working directory cd dir Display contents of working directory Opening and Importing Data stores data in a proprietary format, Stata dta files. These can be directly opened with the use command, and all saved data is saved in this form with the save command. Stata also has the ability to import data from a variety of formats, including Excel and comma separated value text files. The import command is used to do this
Stata Operators Arithmetic Logical Relational + Addition & And > Greater Than - Subtraction | Or < Less Than * Multiplication ! Not >= Greater Than or / Dividsion ~ Not <= Less Than or Equal ^ Power == Equal - Negation != Not + String Concatenation ~= Not Equal The order of evaluation (from first to last) of all operators is ! (or ~), ^, - (negation), /, *, -(subtraction), +, != (or ~=), >, <, <=, >=, ==, &, and |. Time Series Operators Lag / Lead Differences L.var Lag var one period (vart – 1) D.var Difference vart - vart – 1 L2.var Lag var 2 periods (vart – 2) D2.var Difference of difference vart - vart – 1 – (vart – 1 - vart – 2) … … F.var Lead var one period (vart + 1) L.var Seasonal difference, one period vart - vart – 1 F2.var Lead var 2 periods (vart + 2) L2.var Seasonal difference, two periods vart - vart – 2 … … File Access and Set-Up Commands Working directory The working directory is the folder where Stata looks to find data and save data and log files. Setting a working directory means that only the file name, not the full path, will be needed. Command Description Example pwd the current working to the output window cd Change the working directory cd dir Display contents of working directory Opening and Importing Data stores data in a proprietary format, Stata dta files. These can be directly opened with the use command, and all saved data is saved in this form with the save command. Stata also has the ability to import data from a variety of formats, including Excel and comma separated value text files. The import command is used to do this
quick_reference.docx