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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;
imdickson
Quartz | Level 8
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.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Tim_SAS
Barite | Level 11

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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