Help using Base SAS procedures

width make no changes in PROC REPORT

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 75
Accepted Solution

width make no changes in PROC REPORT

Im learning PROC REPORT but width= doesnt make any changes to my results

 

Here are my code:

PROC REPORT data=ALFRED.EXPENSES headline headskip nowd;
options missing='0';
COL ID Income(CommitmentBank Entertainment),sum Food Accomodation CashFlow CashWithoutBasicSurvival;
DEFINE Income/ GROUP width=25;
/*DEFINE Accomodation / style(column)=[cellwidth=11in];*/
DEFINE CommitmentBank / display style(column)=[cellwidth=11in];
DEFINE Entertainment / display width=200;
DEFINE Food / display width=105;
DEFINE CashWithoutBasicSurvival / COMPUTED;
COMPUTE
 CashWithoutBasicSurvival;
 CashWithoutBasicSurvival = CommitmentBank.sum-Entertainment.sum;
ENDCOMP;
BREAK AFTER Income / summarize;
RUN;

 

Need your advice.


Accepted Solutions
Solution
‎02-22-2016 09:29 PM
Super User
Super User
Posts: 7,424

Re: width make no changes in PROC REPORT

As I mention, use cellwidth.  What is your output destination?  You will note from the article I posted that width does not work for HTML destination.

View solution in original post


All Replies
Super User
Super User
Posts: 7,424

Re: width make no changes in PROC REPORT

This should help:

http://jpsmonline.umd.edu/SASOnlineTutor/sot12/en/60476/m40/m40_16.htm

 

To note, I tend to always specify cellwidth (RTF/PDF output).

 

Also to note, if your learning, its a good idea to learn a set way of programming so your code is easy to read (as most of the time its someone else who has to look at it), for example: consistent casing, indentation:

options missing='0';

proc report data=alfred.expenses headline headskip nowd;
  columns id income(commitmentbank entertainment),sum food accomodation cashflow cashwithoutbasicsurvival;

  define income         / group width=25;
  /*define accomodation / style(column)=[cellwidth=11in];*/
  define commitmentbank / display style(column)=[cellwidth=11in];
  define entertainment  / display width=200;
  define food           / display width=105;
  define cashwithoutbasicsurvival / computed;

  compute
    cashwithoutbasicsurvival;
    cashwithoutbasicsurvival = commitmentbank.sum-entertainment.sum;
  endcomp;

  break after income / summarize;
run;
Frequent Contributor
Posts: 75

Re: width make no changes in PROC REPORT

Thanks for pointing out ... however, i still couldn't find the solution that i want. I tried putting width=2 and width=9 and width=50, still the same.
Solution
‎02-22-2016 09:29 PM
Super User
Super User
Posts: 7,424

Re: width make no changes in PROC REPORT

As I mention, use cellwidth.  What is your output destination?  You will note from the article I posted that width does not work for HTML destination.

Super Contributor
Posts: 394

Re: width make no changes in PROC REPORT

You don't say, but I assume you're writing your report to an ODS destination that supports styles, such as RTF or PDF, since I see the the STYLE and CELLWIDTH option in your code. The WIDTH option applies only to listing output and has no effect in these destinations. Use CELLWIDTH instead.

 

The WIDTH option is ignored in styled destinations because it specifies the column width in terms of characters. Styled destinations commonly use proportional-width fonts. Counting characters doesn't have much use when the characters can have different widths. (For example, "i" vs. "m".) In styled destinations specifying the column width in measurements such as inches or millimeters (the value of the CELLWIDTH option) is much more useful.

☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 312 views
  • 0 likes
  • 3 in conversation