* univar.do.
* It is easier to enter data into the data editor, but for now
* I will enter it using the input and end commands.
clear
input x
100
150
200
250
250
250
250
325
325
400
end
label variable x "Weekly Income"
* The summarize command gives basic summary stats.
* The tabstat command offers more summary stats
* The tab1 command gives frequencies.
summarize x
tabstat x, statistics( count mean median min max sd var sum )
tab1 x
* The clear command will clear out the data.
clear
* Now, we will redo the problem using grouped data and the weight parameter.
input x wgt
100 1
150 1
200 1
250 4
325 2
400 1
end
label variable x "Weekly Income"
* [fw = wgt] tells Stata to weight each case by the value of wgt.
* Stata has several other weighting options which can be more powerful
* and easier to use than SPSS.
* fw stands for frequency weights.
summarize x [fw = wgt]
tabstat x [fweight=wgt ], statistics( count mean median min max sd var sum )
tab1 x [fw=wgt]