Professional Documents
Culture Documents
cd "C:\Users\Vivek\Desktop\STATA_session"
use school_a
*DESCRIBE command: it lists each variable name along with variable label and
storage type
describe
*Each element of data is said to be either type numeric or type string. The word
real is sometimes
*used in place of numeric. Associated with each data type is a storage type
*Numbers are stored as byte, int, long, float, or double, with the default being
float. byte,
*int, and long are said to be of integer type in that they can hold only integers
*Strings are stored as str#, for instance, str1, str2, str3, . . . , str2045, or as
strL.
*The number after the str indicates the maximum length of the string.
*A str5 could hold the word male, but not the word female because female has
six characters
*Storage requirements for byte=1 byte, int=2 bytes, long and float=4 bytes,
double=8 bytes
*Digits of accuracy- float=7 digits, long=9 digits, and double=16 digits of
accuracy
*Few people have data that is accurate to 1 part in 10 to the 7th.
*Among the exceptions are banks, who keep records accurate to the penny on amounts
of billions of INR
*If you are dealing with such financial data, store your dollar amounts as doubles.
//Compress command: compress attempts to reduce the amount of memory used by your
data by demoting and coalescing
compress
sum totalteacher- classroom_num //summarizes all the vars in between the two vars
tab school_type electricity //Cross tabulation giving count between type of school
//and facility of electricity
tab school_type electricity, row //this gives you proportions of schools with
electricity
//for all the types of school
tab school_type electricity, col //this gives the proportion of school types with
in all the
//schools with electricity connection
tab electricity, missing
*Count Command gives the count for observation satisfying the condition
count if total_student<totalteacher
*LABEL command: gives label to variable which help explain the var in more clear
form
//Provide a label to already existing variable type*
label variable electricity "Does school has electricity connection 1-Yes 0-No"
label variable roof_type "1-Thatched 2-Wood 3-Cement 4-tin/Asbestos sheet"
//Later, if we dont require label values, we can drop the value label for variable
electricity
label drop electlabel