BookmarkSubscribeRSS Feed
Sikcion
Fluorite | Level 6

Hi guys! I have a question about how to change the width of each column in Proc report?

here is my code:

options nodate ls=140;
%macro prttxt(inds=, title6=);
ods pdf file= " /home/u62957101/sasuser.v94/Project2C/output/Table13.pdf";
title1 bold "Table 13";
title2 bold "Best Overall Response per Investigatorr by Age Category";
title3 bold "ITT Subjects";
title4 " " ;
title5 " " ;
title5 j=l lspace=3 height=0.8 font="Arial" "Subgroup:Age Category &title6";

proc report data=final1_age&inds nowd headline headskip split="|" spacing=3;
column ord_I ord col1 ("Number of Subjects (%) " "____" (CMP123 Placebo Total));
define ord_I/order order=internal noprint;
define ord/order order=internal noprint;
define col1/" " style(column)={asis=on} width=35 flow;
define CMP123/ "CMP123|(N=%left(&NC))" width=16 left;
define Placebo/"Placebo|(N=%left(&NP)" width=16 left;
define Total/ "Total|(N=%left(&NT)" width=16 left;

break after ord_I /skip;
compute after;
line @1 110*" _";
line @1 "(1): 95% confidence interval computed using Clopper-Pearson approach.";
endcomp;
run;

%mend prttxt;
%prttxt(inds=1,title6= <65);
%prttxt(inds=2,title6= >=65);
ods pdf close;

 

and my output:

Screenshot 2023-12-27 at 7.16.23 PM.png

and this is my expected output:

Screenshot 2023-12-27 at 7.17.00 PM.png

 

I've changed the width of each column, but it didn't change. How can I make all columns in the same line? Thank you!

3 REPLIES 3
Ksharp
Super User

Using style:

style={cellwidth=10%}

 

ods pdf file='c:\temp\temp.pdf';
proc report data=sashelp.heart(obs=10  keep=status sex bp_status ageatstart weight height ) nowd ;
column status sex bp_status ("Number of Subjects (%) " "____" (ageatstart weight height));
define _all_/style={cellwidth=10%};
run;
ods pdf close;

 

 

 

 

Tom
Super User Tom
Super User

You photographs of your output make it look like you are using ODS to generate some type of fancy file format, PDF, HTML, etc.

 

The WIDTH= option is for saying how many characters the listing output should use.  It has no effect on ODS outputs.

 

You will have to use ODS style settings if you want to control what the ODS output looks like.

Cynthia_sas
SAS Super FREQ

Hi:

  @Tom is correct the simple form of WIDTH= is a LISTING only option that impacts the output window results, but has no impact on ODS destinations like ODS RTF, ODS PDF, ODS HTML or ODS EXCEL. @Ksharp is also correct in that he shows you the use of the CELLWIDTH= style override syntax. However, I prefer NOT to use percents or pixels as the value of CELLWIDTH because I find the percents less reliable in the destinations I use than specifying a more concrete unit of measure, like IN or CM. Some destinations (like RTF) convert whatever you specify into an internal unit of measure anyway.

  Here's an example:

Cynthia_sas_0-1703775162664.png

This screenshot is showing the default ODS HTML output.

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