BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ganeshsas764
Obsidian | Level 7
Hi Team,
I developed a proc report code generate the report through ODS ,but am facing column width issue for few variable which are have larger label name (I used split option but no use). Could you please help how to reduce the column width with out changing the label name.

Proc report data=sashelp.class split='*';
Col name sex age;
Define name/display;;
Define sex/display ;
Define age/display width=5 format=5. 'Indian socity*Boys and girls*age details as per certificate*;
Run;


1 ACCEPTED SOLUTION

Accepted Solutions
xxformat_com
Barite | Level 11

Use a single style= option in your define statement.

 


ods excel file="&xxproject/reporting/test.xlsx";* options(flow='table');
proc report data=sashelp.cars nowd split="*"; 
column Drivetrain msrp;
define Drivetrain / display;
define MSRP / display "Local Indian Security Value*inc. Accrued Interest" 
                      style (column)=[cellwidth=.5in 
                                      textalign=right 
                                      tagattr='format: #,##0.00'] 
                      format=comma10.2;
run;
ods excel close;

View solution in original post

8 REPLIES 8
Tom
Super User Tom
Super User

Are you generating plain old text output?  If so then make the width value longer so it does not have to chop words in half.   

Or are you generating ODS output ("fancy" output)?  If so then use STYLE= option to set the column width.

 

Example with both:

proc report data=sashelp.class split='*';
  col name sex age;
  define name/display;;
  define sex/display ;
  define age/display width=20 format=5. style=[width=1 in]
    'Indian society*Boys and girls*age details as per certificate'
  ;
run;
                      Indian socity
            S        Boys and girls
            e    age details as per
  Name      x           certificate
  Alfred    M                    14
  Alice     F                    13
  Barbara   F                    13
  Carol     F                    14
  Henry     M                    14
  James     M                    12
  Jane      F                    12
  Janet     F                    15
  Jeffrey   M                    13
  John      M                    12
  Joyce     F                    11
  Judy      F                    14
  Louise    F                    12
  Mary      F                    15
  Philip    M                    16
  Robert    M                    12
  Ronald    M                    15
  Thomas    M                    11
  William   M                    15

Tom_0-1671803572706.png

 

ganeshsas764
Obsidian | Level 7
Hi Tom,

Thanks for your response,

I tried with above logic to my code. But it's not reducing the width in output column. Here i am creating the XLS file through ODS in that output file Column width showing large size .i want to reduce that column width

I have mentioned same code in below.could you please check once?

proc report data=sashelp.cars nowd nocenter split="*" spacing=0 ; column Drivetrain msrp;
define Drivetrain / display;
define MSRP / display right style=[width=1 in] "Local Indian Security Value*inc. Accrued Interest" format=comma22.2 style={tagattr='format: #,##0.00'};
run;
tarheel13
Rhodochrosite | Level 12

How wide do you want it to be? I added code to make it 1.5 inches.

Proc report data=sashelp.class split='*';
Col name sex age;
Define name/display;;
Define sex/display ;
Define age/display style(column)=[cellwidth=1.5in] format=5. 'Indian socity*Boys and girls*age details as per certificate*;
Run;
ganeshsas764
Obsidian | Level 7
Thank for your response. When I applied the login as you suggested it's working fine. But when I applied into my code it's not showing as expected.

I have attached sample code below which i used in my report . could please check once ?

proc report data=sashelp.cars nowd nocenter split="*" spacing=0 ; column Drivetrain msrp;
define Drivetrain / display;
define MSRP / display right style (column)= [cellwidth=1.5 in] "Local Indian Security Value*inc. Accrued Interest" format=comma22.2 style={tagattr='format: #,##0.00'};
run;
xxformat_com
Barite | Level 11

Hi,

I don't have any issue when running your code on my computer.

Is there any message in the log? Can you share a picture of the result you get?

Have you tried to split the statement into several lines? It could be that the width of your screen editor is too short.

Make sure ls=max too.

Best Regards,

ganeshsas764
Obsidian | Level 7
Hi mate,
There is no issue when you run code and it's generate the output,but when you create XLS files through ODS in that output file column width showing as large..i want reduce column width in output report
xxformat_com
Barite | Level 11

Use a single style= option in your define statement.

 


ods excel file="&xxproject/reporting/test.xlsx";* options(flow='table');
proc report data=sashelp.cars nowd split="*"; 
column Drivetrain msrp;
define Drivetrain / display;
define MSRP / display "Local Indian Security Value*inc. Accrued Interest" 
                      style (column)=[cellwidth=.5in 
                                      textalign=right 
                                      tagattr='format: #,##0.00'] 
                      format=comma10.2;
run;
ods excel close;
ganeshsas764
Obsidian | Level 7
Thank you so much it's working.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 8 replies
  • 1162 views
  • 4 likes
  • 4 in conversation