Hi, 'm working with a data set of 58 variables and 795 observations. Most of the variables are categorical and I'm using the tab command to display frequencies.
Stata provides these results to 2 decimal places, but I would like to display them as whole numbers only or to one decimal point only. I want to ensure the calculation is done in stata rather than me rounding up which may lead to inaccuracies.
I am using the following commands:
tab lat
tab lat centre, column
I have tried the following format commands:
tab lat, column format(%9.1f)
tab alt, column format(%3.0f)
But I receive the error message "r(198)".
What command shall I use?
Example of data using dataex displayed below:
input str5 id byte(disp opcl lat centre)
"NG1" 2 2 1 1
"NG2" 2 2 1 1
"NG3" 2 2 2 1
"NG4" 1 2 2 1
"NG5" 2 2 1 1
"NG6" 2 2 1 1
"NG7" 2 2 1 1
"NG8" 2 2 1 1
"NG9" 2 2 1 1
"NG10" 2 2 1 1
"NGT11" 3 2 1 1
"NG12" 2 2 2 1
"NG13" 2 2 1 1
"NG14" 3 2 1 1
"NG15" 2 2 2 1
"NG16" 2 2 2 1
"NG17" 1 2 2 1
"NG18" 3 1 1 1
"NG19" 2 2 2 1
"NG20" 2 2 1 1
"NG21" 2 1 2 1
"NG22" 1 2 1 1
"NG23" 2 2 1 1
"NG24" 2 2 1 1
"NG25" 2 2 2 1
"NG26" 1 2 2 1
"NG27" 2 2 2 1
"NG28" 2 2 1 1
"NG29" 2 2 1 1
"NG30" 1 2 2 1
"NG31" 2 2 1 1
"NG32" 1 2 2 1
"NG33" 2 2 2 1
"NG35" 2 2 2 1
"NG36" 2 2 1 1
"NG37" 1 2 1 1
"NG38" 2 2 1 1
"NG39" 2 2 1 1
"NG40" 2 2 1 1
"NG41" 1 2 2 1
"NG42" 2 2 1 1
"NG43" 2 2 1 1
"NG44" 2 2 1 1
"NG45" 1 2 1 1
"NG46" 1 2 2 1
"NG47" 2 2 1 1
"NG48" 2 2 1 1
"NG49" 2 2 2 1
"NG50" 2 2 2 1
"NG51" 2 2 2 1
"NG52" 2 2 1 1
"NG53" 2 2 1 1
"NG54" 2 2 1 1
"NG55" 2 2 2 1
"NG56" 2 2 2 1
"NG57" 2 2 1 1
"NG58" 2 2 1 1
"NG59" 3 2 1 1
"NG60" 1 2 1 1
"NG61" 2 2 1 1
"NG62" 2 2 2 1
"NG63" 2 2 2 1
"NG64" 2 2 1 1
"NG65" 2 2 1 1
"NG66" 1 2 1 1
"NG67" 1 2 1 1
"NG68" 1 2 1 1
"NG69" 2 2 2 1
"NG70" 2 2 1 1
"NG71" 2 2 1 1
"NG72" 2 2 1 1
"NG73" 1 2 1 1
"NG74" 2 2 1 1
"NG75" 2 2 1 1
"NG76" 2 2 1 1
"NG77" 1 2 1 1
"NG78" 1 2 2 1
"NG79" 2 2 1 1
"NG80" 2 2 1 1
"NG81" 2 2 1 1
"NG82" 2 2 2 1
"NG83" 1 2 2 1
"NG84" 2 2 1 1
"NG85" 2 2 1 1
"NG86" 3 2 1 1
"NG87" 2 2 1 1
"NG88" 2 2 1 1
"NG89" 1 2 1 1
"NG90" 1 2 2 1
"NG91" 1 2 2 1
"NG92" 2 2 1 1
"NG93" 2 2 1 1
"NG94" 2 2 2 1
"NG95" 2 2 1 1
"NG96" 2 2 2 1
"NG97" 1 2 1 1
"NG98" 1 2 2 1
"NG99" 2 2 1 1
"NG100" 1 2 2 1
"NG101" 2 2 1 1
end
label values disp disp
label def disp 1 "undisplaced", modify
label def disp 2 "some", modify
label def disp 3 "marked", modify
label values opcl opcl
label def opcl 1 "open", modify
label def opcl 2 "closed", modify
label values lat lat
label def lat 1 "right", modify
label def lat 2 "left", modify
label values centre centre
label def centre 1 "Nottingham", modify
[/CODE]
Tables displayed using tab command attached as a picture.
Many thanks,
Stata provides these results to 2 decimal places, but I would like to display them as whole numbers only or to one decimal point only. I want to ensure the calculation is done in stata rather than me rounding up which may lead to inaccuracies.
I am using the following commands:
tab lat
tab lat centre, column
I have tried the following format commands:
tab lat, column format(%9.1f)
tab alt, column format(%3.0f)
But I receive the error message "r(198)".
What command shall I use?
Example of data using dataex displayed below:
input str5 id byte(disp opcl lat centre)
"NG1" 2 2 1 1
"NG2" 2 2 1 1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"NG77" 1 2 1 1
"NG78" 1 2 2 1
"NG79" 2 2 1 1
"NG80" 2 2 1 1
"NG81" 2 2 1 1
"NG82" 2 2 2 1
"NG83" 1 2 2 1
"NG84" 2 2 1 1
"NG85" 2 2 1 1
"NG86" 3 2 1 1
"NG87" 2 2 1 1
"NG88" 2 2 1 1
"NG89" 1 2 1 1
"NG90" 1 2 2 1
"NG91" 1 2 2 1
"NG92" 2 2 1 1
"NG93" 2 2 1 1
"NG94" 2 2 2 1
"NG95" 2 2 1 1
"NG96" 2 2 2 1
"NG97" 1 2 1 1
"NG98" 1 2 2 1
"NG99" 2 2 1 1
"NG100" 1 2 2 1
"NG101" 2 2 1 1
end
label values disp disp
label def disp 1 "undisplaced", modify
label def disp 2 "some", modify
label def disp 3 "marked", modify
label values opcl opcl
label def opcl 1 "open", modify
label def opcl 2 "closed", modify
label values lat lat
label def lat 1 "right", modify
label def lat 2 "left", modify
label values centre centre
label def centre 1 "Nottingham", modify
[/CODE]
Tables displayed using tab command attached as a picture.
Many thanks,
Comment