clear
: Clears everything from memory.log using
: Starts a log file to record your Stata session.cd
: Changes the current working directory.input
: Enters data into Stata.list
: Lists the data in Stata.generate
: Generates a new variable.if
: Used to apply a command only to observations that meet a specific condition.replace
: Replaces the value of a variable based on a specified condition.generate bin1 = 0
: Creates a new variable bin1
and initializes it with zeros.replace bin1 = 1 if variable1 >= 15.5 & variable1 < 25.5
: Replaces the value in bin1
with 1 if variable1
is greater than or equal to 15.5 and less than 25.5.tabstat
: Tabulates the data.table
: Command to create table. (The command wasn't working, needs to be fixed.)recode
command is used to change the values of a variable based on specified conditions.recode variable1 15.5/25.5 = 1 25.5/35.5 = 2 35.5/45.5 = 3, generate(bin)
: Recodes values in variable1
from 15.5 to 25.5 to 1, from 25.5 to 35.5 to 2, from 35.5 to 45.5 to 3, and generates a new variable called bin
.graph
command is used to generate graphs in Stata.graph bar
: Generates a bar graph.histogram
command is used to generate histograms in Stata.histogram variable1, frequency start(15.5) width(10)
: Generates a frequency histogram for variable1
, starting at 15.5 with a width of 10.frequency
: Specifies a frequency histogram.percent
: Specifies a percent histogram.start()
: Specifies the starting value for the histogram.width()
: Specifies the width of each class.bin
: Specifies the number of bins.