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

Hi,

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

 

Thank you, 

Neha.

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

3 REPLIES 3
ballardw
Super User

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).

analyst_work
Obsidian | Level 7
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. -##
Cynthia_sas
SAS Super FREQ

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

 

 

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