The SAS Output Delivery System and reporting techniques

SAS RWI Indent rows

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

SAS RWI Indent rows

Hi,

How do I indent a row in SAS RWI? the indent= ot textindent= options do not seem to work.

 

Thank you, 

Neha.


Accepted Solutions
Solution
‎05-13-2016 09:28 PM
SAS Super FREQ
Posts: 8,862

Re: SAS RWI Indent rows

Posted in reply to nehuvarma

Hi:

  Leftmargin and rightmargin worked for me as style attribute overrides instead of trying indent=. Here's my output showing both the left margin and the right margin "indented" on selected rows, using conditional logic in the program:

leftmargin_works_to_indent.png

 

  And this is the program that created it.

 

options nodate nonumber;
ods pdf file="c:\temp\leftmargin_rightmargin_rwi.pdf" notoc ;
   
title '1) Use LeftMargin and RightMargin attributes';
data _null_; 
  set SASHELP.IRIS(obs=10) end=last; 
  if _N_ = 1 then do; 
      dcl odsout obj(); 
      obj.table_start(); 
        obj.head_start(); 
	    ** Header row 1;
          obj.row_start(type: "Header"); 
            obj.format_cell(text: "Species", 
                            style_attr:"fontweight=bold just=l width=2in leftmargin=.25in"); 
            obj.format_cell(text: "SepalLength", 
                            style_attr:"just=r fontweight=bold width=2in"); 
          obj.row_end(); 
        obj.head_end(); 
    end;
     ** row for every obs;
	 ** make every other row look "indented" by changing cell margin;
      obj.row_start(); 
	  if _n_ in (1,3,5,7,9) then do;
            obj.format_cell(data: species, style_attr:"just=l leftmargin=0in"); 
            obj.format_cell(data: SepalLength, style_attr:"just=r rightmargin=0in"); 
	  end;
	  else do;
            obj.format_cell(data: species, style_attr:"just=l leftmargin=.5in");
            obj.format_cell(data: SepalLength, style_attr:"just=r rightmargin=.5in"); 
	  end;
      obj.row_end(); 
   
  if last then do; 
      obj.table_end(); 
  end; 
run; 
ods pdf close;

  My memory ( which may be faulty) was that INDENT= was originally designed for RTF, but I always thought that leftmargin= worked better as an override.

 

cynthia

 

 

View solution in original post


All Replies
Super User
Posts: 11,343

Re: SAS RWI Indent rows

Posted in reply to nehuvarma

RWI is what?

Provide more of an example of what you are doing. If you are using a procedure to generate output some of the options only work for the tradional Listing output not in ODS (Html, RTF, PDF etc).

Contributor
Posts: 22

Re: SAS RWI Indent rows

Hi,

I am using the Report Writing Interface (RWI) to produce a table in which I
need to indent a column. The code is something like this:

obj.row_start();
obj.format_cell (text: "xyz");
obj.row_end;

I want to indent the text xyz, how should I do it?

Thank you.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Solution
‎05-13-2016 09:28 PM
SAS Super FREQ
Posts: 8,862

Re: SAS RWI Indent rows

Posted in reply to nehuvarma

Hi:

  Leftmargin and rightmargin worked for me as style attribute overrides instead of trying indent=. Here's my output showing both the left margin and the right margin "indented" on selected rows, using conditional logic in the program:

leftmargin_works_to_indent.png

 

  And this is the program that created it.

 

options nodate nonumber;
ods pdf file="c:\temp\leftmargin_rightmargin_rwi.pdf" notoc ;
   
title '1) Use LeftMargin and RightMargin attributes';
data _null_; 
  set SASHELP.IRIS(obs=10) end=last; 
  if _N_ = 1 then do; 
      dcl odsout obj(); 
      obj.table_start(); 
        obj.head_start(); 
	    ** Header row 1;
          obj.row_start(type: "Header"); 
            obj.format_cell(text: "Species", 
                            style_attr:"fontweight=bold just=l width=2in leftmargin=.25in"); 
            obj.format_cell(text: "SepalLength", 
                            style_attr:"just=r fontweight=bold width=2in"); 
          obj.row_end(); 
        obj.head_end(); 
    end;
     ** row for every obs;
	 ** make every other row look "indented" by changing cell margin;
      obj.row_start(); 
	  if _n_ in (1,3,5,7,9) then do;
            obj.format_cell(data: species, style_attr:"just=l leftmargin=0in"); 
            obj.format_cell(data: SepalLength, style_attr:"just=r rightmargin=0in"); 
	  end;
	  else do;
            obj.format_cell(data: species, style_attr:"just=l leftmargin=.5in");
            obj.format_cell(data: SepalLength, style_attr:"just=r rightmargin=.5in"); 
	  end;
      obj.row_end(); 
   
  if last then do; 
      obj.table_end(); 
  end; 
run; 
ods pdf close;

  My memory ( which may be faulty) was that INDENT= was originally designed for RTF, but I always thought that leftmargin= worked better as an override.

 

cynthia

 

 

☑ This topic is solved.

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

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