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

Hi, I am creating a table with 4 columns labeled 'Term', 'T1', 'T2' and 'T3', but for some reason the rowlabel 'Term' prints on the next line instead of in line with the other rowlabels. I have been having some issues trying to figure out why this is happening. Here is my below proc report statement, any help is much appreciated!

 


proc report nowd center spanrows missing split='^' data=all      list out=test                                                                                                    
style(report)=[frame=void rules=none cellspacing=0 padding=1pt font=('Courier New', 8pt)]
style(header)=[bordertopcolor=balck bordertopwidth=1
               borderbottomcolor=black borderbottomwidth=1
               background=white font=('Courier New', 8pt) textalign=c ]
style(column)=[font=('Courier New', 8pt)  ASIS=ON ] ;

   columns _PB_page vorder  roworder  rowlabel ("T1^(N=&N1)" col1) ("T2^(N=&N2)" col2) ("T3^(N=&N3)" col3) ;
   define _PB_page/group noprint;
   define vorder/group noprint;
   define roworder/group noprint;
   define rowlabel/display  ' ' left style(column)=[width=5.0in ] 'Term';
   define col1/display ' '  style(column)=[width=1.0in textalign=c] ;
   define col2/display ' ' style(column)=[width=1.0in textalign=c] ;
   define col3/display ' ' style(column)=[width=1.0in textalign=c]  ;

   break after _PB_page/page ;
   compute after vorder;
      line '^S={font_face=arial font_size=1pt}';
   endcomp;
   compute after _page_/ style={bordertopcolor=black bordertopwidth=1 just=l font_face='Courier New' font_size=8pt};
     line 'Version';
   endcomp;
  run;
ods _all_ close;
ods listing;

1 ACCEPTED SOLUTION

Accepted Solutions
kmardinian
Quartz | Level 8

Thank you so much, I ended up looking into it and was able to figure it out. It ended up being a stupid fix, but I appreciate the help!

 

I ended up just having to switch it to this:


   columns _PB_page vorder  roworder  rowlabel col1 col2 col3 ;
   define _PB_page/group noprint;
   define vorder/group noprint;
   define roworder/group noprint;
   define rowlabel/display   left style(column)=[width=5.0in ] 'Term';
   define col1/display style(column)=[width=1.0in textalign=c] 'T1' ;
   define col2/display  style(column)=[width=1.0in textalign=c] 'T2';
   define col3/display  style(column)=[width=1.0in textalign=c] 'T3' ;

View solution in original post

5 REPLIES 5
ballardw
Super User

We don't have your data, know which ODS style you might be using, which ODS destination the results go to or the content of several macro variables. So we have no idea what the appearance actually is. Kind of hard to diagnose.

 

I might guess that you have a vertical justification issue and the value is actually defaulting to the bottom instead of top of the cell

kmardinian
Quartz | Level 8

Hi ballardw,

 

Sorry about that, I am outputting the report to an rtf word file.

I'm sorry I'm new to sas, so I never know what information to give.

ballardw
Super User

@kmardinian wrote:

Hi ballardw,

 

Sorry about that, I am outputting the report to an rtf word file.

I'm sorry I'm new to sas, so I never know what information to give.


If the result could depend on data (almost always) example data that will demonstrate the issue with your code. Best is in the form of a data step so we don't have to ask is a value character or numeric, what the labels may be, lengths of character variables or formats involved. If using custom formats then those may need to be included.

 

If the question involves output appearance then ODS Style in effect and destination are usually a good idea. Best is to include the ODS RTF (or other destination) statement with all options used.

We have seen some issues that arise because of custom ODS styles that couldn't be duplicated without the actual style.

With RTF output you should be able to attach a copy of the result using the attachment bar below the message window. Browse to the location of your document and attach.

If the document has sensitive data it is a good idea to "sanitize" the data to remove anything sensitive replacing names and such with values of similar length with content like "xxxxxxxxxx" and "yyyyy".

kmardinian
Quartz | Level 8

Thank you so much, I ended up looking into it and was able to figure it out. It ended up being a stupid fix, but I appreciate the help!

 

I ended up just having to switch it to this:


   columns _PB_page vorder  roworder  rowlabel col1 col2 col3 ;
   define _PB_page/group noprint;
   define vorder/group noprint;
   define roworder/group noprint;
   define rowlabel/display   left style(column)=[width=5.0in ] 'Term';
   define col1/display style(column)=[width=1.0in textalign=c] 'T1' ;
   define col2/display  style(column)=[width=1.0in textalign=c] 'T2';
   define col3/display  style(column)=[width=1.0in textalign=c] 'T3' ;

Cynthia_sas
SAS Super FREQ

Hi:

  PROC REPORT is doing exactly what you tell it to do. With your COLUMN statement:

 columns _PB_page vorder  roworder  rowlabel ("T1^(N=&N1)" col1) ("T2^(N=&N2)" col2) ("T3^(N=&N3)" col3) ;

You are writing the T1, T2, and T3 column headers (with their N values) on one separate line. There should be blanks above all the other columns on THIS report row.

 

Then, in your DEFINE statement for ROWLABEL (which is 'Term'), this column header for Term will be placed on a different row.

 

  If you run this:

equivalent.png

I suspect you're getting something like this with Term on one line and the other headers above it.

 

You'd need to change your code like this:

fixed_columns.png

 

Hope this points you in the right direction. Otherwise, you need to post all your code, your ODS statements and some data.

Cynthia

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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