Help using Base SAS procedures

Proc Tabulate date sequence

Accepted Solution Solved
Reply
Regular Contributor
Posts: 240
Accepted Solution

Proc Tabulate date sequence

HI,

1) When I run the Proc Tab I get the date range out of sequence. The date

should be  01/01/2012-01/07/2012,  01/08/2012-01/14/2012 ...

DateRange
1/1/2012 - 1/7/20121/15/2012 - 1/21/20121/8/2012 - 1/14/2012
NTotalPercentNTotalPercentNTotalPercent
NNN

ODS HTML3 file='H:\Test.xls' style=minimal;

options missing=' ';

proc tabulate data=Test1 f=10.2 S=[backGROUND=light yellow  JUST=C] noseps;

  where Item='Shoe';

  class DateRange VSB Compliance;

  classlev Compliance /S=[BACKGROUND=light grey];

  keylabel pctn ='PERCENT'

           all='Total';

  table  VSB*(Compliance all), daterange*(n='N'*f=8.0 all pctn<Compliance all>='Percent')

   /RTS=50 MISSTEXT ='0' box=Shoe    ;

run;

ODS HTML3 close;

2)In the same Proc Tab I'm trying get Total at the end of the table. It doesn't summerize each week with Total at end of the 3 weeks.

3) I've research the net and look in my SAS book and fig out how to add the % in the percent Column.Is that possible ?

Thanks for your assistance 

DateRange
1/1/2012 - 1/7/20121/15/2012 - 1/21/20121/8/2012 - 1/14/2012
NTotalPercentNTotalPercentNTotalPercent
NNN
VSBCompliance11100000000
ShoeYES
Total11100000000

Accepted Solutions
Solution
‎01-26-2012 07:29 PM
Super User
Posts: 19,770

Proc Tabulate date sequence

Apply a picture format

proc format;

    picture tabpct (round)

    low-high='009%';

run;

proc tabulate data=Test1 f=10.2 S=[backGROUND=light yellow  JUST=C] noseps;

  where Item='Shoe';

  class DateRange VSB Compliance;

  classlev Compliance /S=[BACKGROUND=light grey];

  keylabel pctn ='PERCENT'

           all='Total';

  table  VSB*(Compliance all), daterange*(n='N'*f=8.0 all pctn<Compliance all>='Percent'*f=tabpct.)

   /RTS=50 MISSTEXT ='0' box=Shoe    ;

run;

View solution in original post


All Replies
Super User
Posts: 11,343

Proc Tabulate date sequence

Try

1)

CLASS DateRange /order = data;

Class VSB Compliance;

This may require sorting your data by DateRange

2) Not quite sure which total you may want but try:

VSB*(Compliance all) All,  /* should provide a total row at bottom*/

3) Due you want a percent sign to appear in the cells of the Table?

Or do you want a percent sign in the column heading?

Regular Contributor
Posts: 240

Proc Tabulate date sequence

What I'm looking on the total is something like this. The % would be in the number for example 30.00% and 70.00% 14.29% 85.71%...Thanks

DateRange
1/1/2012 - 1/7/20121/15/2012 - 1/21/20121/8/2012 - 1/14/2012
NTotalPercentNTotalPercentNTotalPercentTotal
NNN
VSB
ShoeCompliance33300001114.29423.52
NO
YES77700006685.711376.47
Total10101000007710017100
Solution
‎01-26-2012 07:29 PM
Super User
Posts: 19,770

Proc Tabulate date sequence

Apply a picture format

proc format;

    picture tabpct (round)

    low-high='009%';

run;

proc tabulate data=Test1 f=10.2 S=[backGROUND=light yellow  JUST=C] noseps;

  where Item='Shoe';

  class DateRange VSB Compliance;

  classlev Compliance /S=[BACKGROUND=light grey];

  keylabel pctn ='PERCENT'

           all='Total';

  table  VSB*(Compliance all), daterange*(n='N'*f=8.0 all pctn<Compliance all>='Percent'*f=tabpct.)

   /RTS=50 MISSTEXT ='0' box=Shoe    ;

run;

Regular Contributor
Posts: 240

Proc Tabulate date sequence

Hi Ballardw,

I fig out with your help to get the totals . The question is now how to add  % symbol for example 30.00% and 70.00% 14.29% 85.71%...Thanks

Regular Contributor
Posts: 240

Proc Tabulate date sequence

Thank You guys for the assitance ..  Reeza I need 2 dec points so I added 009.00% an it worked ... Hi Ballardw, Your answer help a lot I feel bad that I can't split  Correct Answer  or helpful ...  You guys help a lot  and I learn something  

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 593 views
  • 3 likes
  • 3 in conversation