BookmarkSubscribeRSS Feed
kgrover
Calcite | Level 5

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
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
ballardw
Super User

@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.

kgrover
Calcite | Level 5

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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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