BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9

I have a proc report where I want to replace the column name by

define Jsc / 'Jsc (mA/cm2)';

but it splits after JSC?

6 REPLIES 6
Tom
Super User Tom
Super User

Try adding a WIDTH option to make the column wide enough for your longer title.

You might also check what character you are using for you split character, but normally you would not use a space for that.

Tim_SAS
Barite | Level 11

Remember that the WIDTH option only works for listing output. For non-listing output like PDF or RTF, you'll need to use a STYLE option on the DEFINE statement and specify the WIDTH style attribute. See http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/viewer.htm#a002972093.htm.

Filipvdr
Pyrite | Level 9

I tried width but as I use HTML to output it does not work...

So i tried:

define jsc / 'Jsc (mA/cm²)' STYLE=[CELLWIDTH=270]; (which is far too big)

but still my name gets splitted in the title..

Filipvdr
Pyrite | Level 9

solution: take a split charachter which is not / (default)

proc report SPLIT='+'

SAS_Niels
Calcite | Level 5

Hey Filipvdr,

If you do not specify a width= statement in your define statement, the column headline will break after the longest value in the column.

E.g. the variable sex in sashelp.class dataset has a maximum length of 1, so the column length is one. If you add a label you need to define the column width like the width of the label. (Even the unlabeled variable name sex needs a width option to be displayed correctly.)

See the following comparision:

proc report data=sashelp.class;

   column name sex age weight height;

   define sex / 'Gender';

run;

Sex in the basic dataset is either 'M' or 'F' with the maximum width of 1. So the column header has a width of 1.

proc report data=sashelp.class;

   column name sex age weight height;

   define sex / display 'Gender' width=6;

run;

The assigned label 'Gender' has a width of 6 characters and with the corresponding width option you can expand the header.

Smiley Happy

Niels

Cynthia_sas
SAS Super FREQ

Hi,

  As Tim pointed out, WIDTH= option of PROC REPORT only has an impact on LISTING output. Since the OP said he wanted HTML output, the WIDTH= option would not work. Instead, a combination of changing the default split character (a /) and using CELLWIDTH should get him what he wants. In the attached screen shots, examp_width1.jpg shows code that used LISTING and HTML. Without WIDTH=, the label 'Gender' does behave as you describe, but only for the LISTING output. As you can see, in the HTML output, the label appears correctly. However, because the split character is defined as / (the default), the label string for NAME splits at the slash in the label.

  With the SPLIT= redefined, and an explicit CELLWIDTH, the header for NAME is as desired and the header for SEX is fine without a WIDTH= option. The units for CELLWIDTH can be specified as pixels, points, inches or centimeters. I usually don't mess with pixels and I just go with inches as the unit.

  In addition to WIDTH=, there are other PROC REPORT options that only work in the LISTING destination, these are: FLOW, PANELS, BOX, DOL, DUL, OL, UL, SKIP, HEADLINE, HEADSKIP, WIDTH, SPACE, LS, PS. See this Tech Support note for more information:

http://support.sas.com/kb/2/549.html

http://support.sas.com/kb/23/671.html

http://support.sas.com/rnd/base/ods/templateFAQ/report1.html

cynthia


examp_width1.jpgexamp_width2.jpg

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!

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
  • 6 replies
  • 3089 views
  • 0 likes
  • 5 in conversation