Calcite | Level 5

## Proc freq and standard error - rounded to two decimal places

I am using the following statement:

proc freq data = merged16 stderr; tables DEGENDER AGE RACE ;
format DEGENDER \$DEGENDER. AGE AGE. RACE RACE. ;run;
ods output OneWayFreqs = wt;run;
proc print data = wt label;format _numeric_ 10.2;var _numeric_; run;

How can I get sas to give me the standard error rounded to two decimal places along with frequencies with proc freq?

Thank you!

3 REPLIES 3
Diamond | Level 26

## Re: Proc freq and standard error - rounded to two decimal places

How can I obtain standard errors from PROC FREQ?

The formula for the standard error of a proportion is the SE = sqrt( p*(1–p)/n ). You'd have to program this in a data step from the data set wt. After that, applying a format makes the result appear to have two decimal places.

In the future, please type one SAS command per line, and type your SAS code into the box that appears when you click on the running man icon. Thank you.

--
Paige Miller
Super User

## Re: Proc freq and standard error - rounded to two decimal places

@kgrover wrote:

I am using the following statement:

proc freq data = merged16 stderr; tables DEGENDER AGE RACE ;
format DEGENDER \$DEGENDER. AGE AGE. RACE RACE. ;run;
ods output OneWayFreqs = wt;run;
proc print data = wt label;format _numeric_ 10.2;var _numeric_; run;

How can I get sas to give me the standard error rounded to two decimal places along with frequencies with proc freq?

Thank you!

What does the log show when you run that code?

Also standard error of which variable(s)? What would the standard error of a character variable such as DEGENDER look like? Race would also be a bit odd in interpreting the standard error of a pretty obvious categorical variable.

Calcite | Level 5

## Re: Proc freq and standard error - rounded to two decimal places

the log gives me the following error:

WARNING: Output 'OneWayFreqs' was not created. Make sure that the output object name, label, or path
is spelled correctly. Also, verify that the appropriate procedure options are used to produce
the requested output object. For example, verify that the NOPRINT option is not used.

Discussion stats
• 3 replies
• 2218 views
• 0 likes
• 3 in conversation