* ***************************************************************************************
* PROGRAM: homework1-1+SOLUTION.do
* PROGRAMMER: Angela Ambroz (Consultant, Twaweza)
* DATE CREATED: 19 May 2015
* PURPOSE: Solution to the first homework assignment in the Twaweza "Getting started with Stata" course.
* There's a solution video up at: https://www.youtube.com/watch?v=Fl4dJQJiac0&feature=youtu.be
* ***************************************************************************************
use "/Users/angelaambroz/Desktop/stata-course/uwezo.dta", clear
//Note: Change the file path to the folder where you downloaded uwezo.dta.
//YOUR EXPLANATION: This loads the dataset into Stata's memory. It shows me the variables in the
//variables window. The data is now ready to be analyzed and worked with.
describe, short
//YOUR EXPLANATION: This describes the meta-data about the dataset. That is, it tells me:
// how many observations (or rows) there are, how many variables there are, how big the file size
// is, and any other meta-information which may have been included (like a dataset label).
count
//YOUR EXPLANATION: This counts the number of observations (or rows) in the dataset.
codebook age swahili grade
//YOUR EXPLANATION: This provides summary information about three variables: age, swahili, and grade.
// It gives me, for example, the range of answers, statistical mean and standard deviation for each
// answer. It also provides information on what the labels are (if the variable is encoded), or what
// the distribution looks like in quintiles.
mean age if grade==4
//YOUR EXPLANATION: This calculates the statistical mean of the variable, age - but only for those
// observations where the condition (grade==4) is met. In plain English, this finds the average age
// of fourth graders.
//(note: explain "if"!)
tab swahili
//YOUR EXPLANATION: This tabulates the frequencies of each answer response for the variable, swahili.
// It tells me the numerical frequency (that is, the number of observations that answered for each value),
// the percentage, and the cumulative percentage (which is the sum of the percentage of having answered
// a value and all the values above it).
clear
//YOUR EXPLANATION: This clears the dataset from Stata's memory. Stata is now ready to be either closed, or
// to have a new dataset loaded into it.