BookmarkSubscribeRSS Feed
gzr2mz39
Quartz | Level 8

I'm currently receiving the following error for my "bar" variable.

The max value of per_osha11 is 24.
How do I fix this error?
Thank you.

ERROR: The width of bar is not between 1 and 98. Adjust the column width or line size.
NOTE: This affects LISTING output.

proc report data=task_tot3 nowd contents="Claims" out=test
style(header)=[font_weight=bold background=CX90D9D7]
style(report)=[frame=void rules=none cellpadding=1 cellspacing=0];
options missing='0';
column bar task1 tot_osha11 per_osha11;
define task1 / 'Task';
define bar / '' style(column)=[cellwidth=75mm font_size=4pt font_face=webdings vjust=middle just=left cellpadding=0];
define tot_osha11 / analysis "Total 2011" style(column)={background=CXE599A7};
define per_osha11 / analysis "% of 2010 Total" style(column)={borderrightcolor=black borderrightwidth=1pt};
rbreak after / summarize;
compute bar / char length=100;
  barsize=round(per_osha11.sum*50);
  if barsize gt 0 then
  bar=repeat('67'x,barsize);
endcomp;
compute per_osha11;
  if _break_="_RBREAK_" then per_osha11.sum=100;
endcomp;
compute tot_osha11;
  if _break_="_RBREAK_" then call define(_row_,"style","style=[background=CXE599A7]");
  if _break_="_RBREAK_" then task1="Total 2010 - 2011";
endcomp;
run;

2 REPLIES 2
ArtC
Rhodochrosite | Level 12

Without asking why; you want a repeated character up to 100 times in the first column, but is that what you want?

If the error is a listing destination error and you are not using the listing destination, turn it off ( ods listing close;)

My memory says that in the listing destination a given column cannot be wider than the width of the paper (LINESIZE= system option).  So increasing the LINESIZE might change the error.

In the COMPUTE BAR block you multiply per_osha11 by 50, any value of per_osha11>2 (it can be up to 24) would give a total gt 100.  any value of barsize>99 will give a bar with ge 100 characters.

Cynthia_sas
SAS Super FREQ

Hi:

  Art's memory is correct. That message usually appears because the LISTING destination is still open and the calculated size of a column when added to the calculated size of the other columns will exceed the current LINESIZE setting. The fix is to use

ODS LISTING CLOSE;

before the ODS step.

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 16. 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
  • 2 replies
  • 27068 views
  • 6 likes
  • 3 in conversation