BookmarkSubscribeRSS Feed
kgrover
Calcite | Level 5

SAS,  by default yields percent, CI etc. to 4 decimal places. I'd like it to give me all results rounded to 5 decimal places. 

 

My statement is as follows, can someone please help me figure out how I modify this statement to get everything in 5 decimal places?


proc surveyfreq data = stats2;
STRATA VESTR;
CLUSTER VEREP;
WEIGHT NW_WGHT;
tables PSYYR2 ANLYR TRQYR STMYR SEDYR/row cl (type = logit);
run; 

 

Thanks,

 

Kiran

 

3 REPLIES 3
ballardw
Super User

@kgrover wrote:

SAS,  by default yields percent, CI etc. to 4 decimal places. I'd like it to give me all results rounded to 5 decimal places. 

 

My statement is as follows, can someone please help me figure out how I modify this statement to get everything in 5 decimal places?


proc surveyfreq data = stats2;
STRATA VESTR;
CLUSTER VEREP;
WEIGHT NW_WGHT;
tables PSYYR2 ANLYR TRQYR STMYR SEDYR/row cl (type = logit);
run; 

 

Thanks,

 

Kiran

 


Easiest is to send the data from your output to data sets using ODS OUTPUT and then Proc Print, or use in other procedures,where you can set the formats. Otherwise you have to manage custom templates and that can be a headache.

 

proc surveyfreq data = stats2;
   STRATA VESTR;
   CLUSTER VEREP;
   WEIGHT NW_WGHT;
   tables PSYYR2 ANLYR TRQYR STMYR SEDYR/row cl (type = logit);
   ods output oneway=MyOnewaydataset;
run; 

Proc print data =MyOnewaydataset;
   format <your variable list> f10.5;
run;

Your can either refer to the documentation to get the names of tables available with specific options or use ODS TRACE to list the tables used in the output.

 

ods trace on;
proc surveyfreq data = stats2;
   STRATA VESTR;
   CLUSTER VEREP;
   WEIGHT NW_WGHT;
   tables PSYYR2 ANLYR TRQYR STMYR SEDYR/row cl (type = logit);
run; 
ods trace off;

Will add information to the log about the tables used that can then be referenced in the ODS OUTPUT.

 

kgrover
Calcite | Level 5

can this also be done using format? 

 

ballardw
Super User

@kgrover wrote:

can this also be done using format? 

 


If you mean directly in the Proc output the answer is no for any of the statistics generated by the procedure. A format applied to a numeric value where used as a categorical variable should work but anything calculated such as confidence limits or percentages and such not in the survey procs yet.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1523 views
  • 2 likes
  • 2 in conversation