BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Zachary
Obsidian | Level 7

Looking for a way to format the following output so that the column percents show up with zero decimal places:

proc freq data = CombineScoredTemp;

  tables _node_ * Bin_SLR

   /nopercent norow nofreq;

run;

Of course I could copy & paste it into Excel. Then format it. Then I would want more decimal places.

Also, is there a way to output these column percents so that a % shows up with the numbers?

Thank you very much in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
CTorres
Quartz | Level 8

Consider using Proc TABULATE insted which gives you many more formating options than Proc FREQ.

Compare the reports produced by the following two sample codes:

1. Using Proc FREQ:

proc freq data=sashelp.class;

  tables age*sex / nopercent norow nofreq;

run;

2. Using Proc FORMAT ans Proc TABULATE:

proc format;

  picture pctfmt low-high='009.99 %';

run;

proc tabulate data=sashelp.class format=10.;

  class age sex;

  table age all , sex*colpctn*F=pctfmt10.;

  keylabel all='Total' colpctn='Col Pct';

run;

SASReport.png

CTorres

View solution in original post

2 REPLIES 2
CTorres
Quartz | Level 8

Consider using Proc TABULATE insted which gives you many more formating options than Proc FREQ.

Compare the reports produced by the following two sample codes:

1. Using Proc FREQ:

proc freq data=sashelp.class;

  tables age*sex / nopercent norow nofreq;

run;

2. Using Proc FORMAT ans Proc TABULATE:

proc format;

  picture pctfmt low-high='009.99 %';

run;

proc tabulate data=sashelp.class format=10.;

  class age sex;

  table age all , sex*colpctn*F=pctfmt10.;

  keylabel all='Total' colpctn='Col Pct';

run;

SASReport.png

CTorres

Zachary
Obsidian | Level 7

Thank you very much for introducing me to proc tabulate.

The website that has proven to be most helpful is:

http://www2.sas.com/proceedings/sugi30/258-30.pdf

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 2 replies
  • 754 views
  • 0 likes
  • 2 in conversation