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!
Is your question:
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.
@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.
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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.