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,
Related Posts with how to display frequencies and percentages to whole numbers only in STATA SE/15.1
'xtoverid' after multiple imputation in panel data?Hello there, I am a first time Stata user and am having a few problems. I already searched in this f…
Power calculations in stataI would like to use the stata power command, to estimate the smallest effect size I would be able to…
How to generate a new binary variable based on individuals having 2 or more of other risk factorsI would like to create a variable based on individuals being classified as "high risk" or "low risk"…
ANOVA error r(422); "could not determine between-subject basic unit; use bseunit() option" Using bseunit() option, but get this error anywayHello, I'm new to using the ANOVA command (it is not common in my field). A reviewer for a journal …
Anyway to conduct dynamic model on panel data by using xtabond command in stata?Dear all: I found a challenge when I run a dynamic model on long panel data. I am hopeful that you …
Subscribe to:
Post Comments (Atom)
0 Response to how to display frequencies and percentages to whole numbers only in STATA SE/15.1
Post a Comment