02-22-2016 04:05 AM
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.
02-22-2016 04:33 AM
This should help:
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;
02-22-2016 08:26 AM
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.
Need further help from the community? Please ask a new question.