BookmarkSubscribeRSS Feed
mansour_ibrahim
Obsidian | Level 7

Hello,

 
I want to delete the bars shown in the attaches figure.
I use this code:
data test;
format var4 date9.;
input var1 $2. var2 :$10. var3 $ var4 date9. var5 var6 var7 :$20. var8  ;
cards;
T1 septembre A 01dec2016 71 6 traitement-c 6
T1 septembre A 01dec2016 . 13 traitement-c 8
T2 septembre A 01dec2016 . 14 traitement-c 61
T2 septembre A 01dec2016 . 0 traitement-s 69
T3 septembre A 01dec2016 . 0 traitement-v 107
T3 septembre A 01dec2016 811 3 traitement-c 46
T1 septembre A 01dec2016 . 6 traitement-c 59
T1 septembre A 01dec2016 . 7 traitement-c 6
T1 septembre A 01dec2016 . 9 traitement-c 6
T1 septembre A 01dec2016 . 61 traitement-c 6
T2 septembre A 01dec2016 . 15 traitement-c 6
;run;


proc tabulate data=test;
class var1 var2 var3 var4 var6 var7;
var var5 var8;
table var5='NB1' *sum=''
      var8='NB2'*sum='' 
      var8=''*var1=''*reppctsum=''*f=mypct.
      , var3=''*var2=''
/box="M";
run;

Thank you

4 REPLIES 4
ballardw
Super User

Please attach images as image files in formats such as jpeg, gif or png. Microsoft doc files have potentials for virus and many users here either will not open them or are blocked by corporate policy.

 

I am going to guess that you don't want the "empty" column before the T1 T2 and T3.

If that is the case then try:

 

/box="M" row=float;
mansour_ibrahim
Obsidian | Level 7

Thank you

mansour_ibrahim
Obsidian | Level 7

hello,

sorry for format of attached figure. I have this message

The file figure2.jpg does not have a valid extension for an attachment and has been removed. sas,txt,csv,zip,pdf,ics,sx,sxs,doc,docx,xls,xlsx,egp,sav,sas7bdat,ctm,ctk,rtf are the valid extensions. 

 

 

we can realize with proc tabulate the restitution as shown in the attached figure.

 

 

thank you

 

Cynthia_sas
SAS Super FREQ

Hi:

  I don't like to open .docx files. Typically, I take screen shots with PrntScr and then save the image to a .PNG or .JPG file. However, with a slight modification of your code, I can illustrate why the ROW=FLOAT suggestion was the correct one.

 

  By default, TABULATE wants you to know EXACTLY which variables are used in the ROW and COLUMN dimensions by showing both the variable name/label and the statistic name, where appropriate. So in Example 1, modified from your example, you can see how every cell whether header cell or data cell has a purpose and is filled appropriately based on your TABLE statement. But if you "blank" out sum and blank out "reppctsum" in the row header area, then that will leave you with an empty area on each row. Similarly, if you blank out the column headers for VAR8, VAR5, etc, that will leave you more blank areas. TABULATE is smart enough to get rid of most of them, but compare output 1a with output 1b in the picture below:

tab_suppress_cell_dividers.png

 

The undesired "lines" are really the cell borders for the suppressed row header labels. So now comes ROW=FLOAT to the rescue. Using that option causes the undesired empty cells to be suppressed, as shown in output 2:

tab_row_float_suppress.png

 

and here's the code to produce all of the above outputs.

cynthia

 

The code:

data test;
format var4 date9.;
input var1 $2. var2 :$10. var3 $ var4 date9. var5 var6 var7 :$20. var8  ;
cards;
T1 septembre A 01dec2016 71 6 traitement-c 6
T1 septembre A 01dec2016 . 13 traitement-c 8
T2 septembre A 01dec2016 . 14 traitement-c 61
T2 septembre A 01dec2016 . 0 traitement-s 69
T3 septembre A 01dec2016 . 0 traitement-v 107
T3 septembre A 01dec2016 811 3 traitement-c 46
T1 septembre A 01dec2016 . 6 traitement-c 59
T1 septembre A 01dec2016 . 7 traitement-c 6
T1 septembre A 01dec2016 . 9 traitement-c 6
T1 septembre A 01dec2016 . 61 traitement-c 6
T2 septembre A 01dec2016 . 15 traitement-c 6
;run;

proc format;
  picture mypct low-high='009.99%';
run;
  
title; footnote;
proc tabulate data=test;
title '1a) PROC TABULATE withOUT row=float';
title2 'and showing ALL labels for column and row headers';
class var1 var2 var3 var4 var6 var7;
var var5 var8;
table var5*sum
      var8*sum 
      var8*var1*reppctsum*f=mypct. 
      , 
      var3*var2
/box="M";
run;

proc tabulate data=test;
title '1b) PROC TABULATE withOUT row=float';
title2 'but using blanks for most labels';
title3 'has undesired dividers in the row header area';
class var1 var2 var3 var4 var6 var7;
var var5 var8;
table var5='NB1' *sum=''
      var8='NB2'*sum='' 
      var8=''*var1=''*reppctsum=''*f=mypct.  
      , 
      var3=''*var2=''
/box="M";
run;

proc tabulate data=test;
title '2) PROC TABULATE with row=float';
title2 'ROW=FLOAT suppresses the unwanted empty cells in the row header area';
class var1 var2 var3 var4 var6 var7;
var var5 var8;
table var5='NB1' *sum=''
      var8='NB2'*sum='' 
      var8=''*var1=''*reppctsum=''*f=mypct.  
      , 
      var3=''*var2=''
/box="M" row=float;
run;
title; footnote;

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 1017 views
  • 0 likes
  • 3 in conversation