

Opens a data browser for variables make, mpg, and price. Helpful if you have many variables and want to focus on a subset of them.ĭisplays a one-way frequency table. Width of each bin determined automatically by bin size and range of mpg. Option bin(10 ) specifies number of bins. Also gives the numbers of observations with negative, zero, or positive values unique values and missing values.ĭisplays a histogram of mpg with parameters decided by STATA. Option detail gives more statistics such as percentiles (50th percentile is the median), skewness, and kurtosis.ĭisplays variable type, summary statistics, percentiles, and number of missing values.ĭisplays a simple histogram for mpg. Here we count the number of foreign made cars.ĭisplays summary statistics for variables mpg and price (mean, standard deviation, minimum and maximum). varnames specifies which row contains the variable names - in this case, the first row.ĭisplays the variable type, format and value labels for mpg and price.Ĭounts the number of observations that satisfy certain conditions. Options rowrange and colrange specify ranges of rows (observations) and columns (variables) to import, respectively. Imports the auto data if it were a comma-separated values (.csv) file. sheet determines which worksheet to import, and firstrow imports the first row of the excel file as the variable names. Imports the auto data if it were an excel file. Import excel “C:\documents\data\auto.xlsx ”, sheet(“Sheet1”) firstrow For all examples we use the auto data file included in STATA. The option clear clears the current dataset from memory. Loads a data set from the current directory. Input the folder which contains the data file we want to use. As an alternative to the command clear, cls keeps the data file in useĬhanges the working directory to the specified folder.
#Histogram stata pdf#
Reformats the log file "autoanalysis" from a text file to a pdf file.Ĭlears the results window. This lets you add more commands and results to the same log file. Any commands submitted and their results will no longer be stored in the log file. "log off " temporarily suspends the log file, and " log on" reopens it. This is helpful if you want to perform some data analysis without including the results in the log file, and if you want to reopen the log file later in the same session.Įnds the log file. This is helpful in do-files and log files as a way to leave notes on your analysis when you review the file later. Starting a command line with an asterisk " *" makes the command line act as simple text - it won't be interpreted as a command. The log file will be stored in the folder under the current directory. log" records your output as a text file, otherwise it is recorded as a STATA file ". In this case, reopen the editor and correct any mistakes.Ĭreates a file that records all of the results of your data analysis in a log. If any command contains an error (syntax, misspelling, etc.), STATA will execute the commands up to that line only before stopping. This is the default setting.Įxecutes all of the commands from the Do-file "autoanalysis" in order. All commands after this now end at the end of the line - a new line starts a new command. Resets the line delimiter to carriage return.

This makes for a cleaner output when the command is displayed in the results section upon execution. This is helpful if you have a long command: you can split it into multiple lines in the do-file and mark the end of the entire command with a semi-colon. All commands in the Do-file after this one must now end with a semicolon. Changes the line delimiter to a semicolon " ". The point of a Do-file is that you can reproduce the same results later, and you can revise it with more commands.

Here you can type a list of commands for your data analysis.
