BookmarkSubscribeRSS Feed
KrishnaChandra
Calcite | Level 5

Hai all.

    Am stuck with in proc report.My doubts are mentioned on below

1)How column values become alinged?

                            My

                       ---------------               I need in this format            2 ( 33.3 )

                           2(33.3)                                                       12 ( 2.1   )

                           12(2.1)                                                            0

                               0                                                            22( 14.56)

                           22(14.56)

2)How can i put a solid line on header of proc report??

I expect ur swift feedback.

Thanks

Krishna

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  If you have a need for a time-critical response, then your best bet is to work with Tech Support by opening a track.

  When you use PROC REPORT, the default style determines the justification. Without seeing your PROC REPORT code, it is hard to speculate why your output is not right justified. It could be because you made a character string, which is left justified by default. Perhaps you could try the PROC REPORT justification options. But, since you did not show your code or mention your destination of interest, it is impossible to tell you how to do the justification or the underlining because that is destination specific. For example, if you were sending output to the LISTING or CSV destination, underlining might be hard to accomplish. Depending on your version of SAS, how you do underlining could be done one of several ways. You did not mention the version of SAS that you are using.

  What code have you tried? What does your data look like?  What is your destination of interest? What style are you using to create the output? You ask about aligning the output, but none of your examples actually look aligned.

  For example, in the attached screen shot of RTF output, I show several possible alignment choices -- for RTF with an example of underlining the column headers.

Cynthia

data testvar;

  length grp $10;

  infile datalines dlm=',' dsd;

  input grp $ num1 num2 ;

return;

datalines;

"Group 1",2,33.3

"Group 2",12,2.1

"Group 3",0,

"Group 4",22,14.56

;

run;

    

ods _all_ close;

ods escapechar='^';

options orientation=portrait

        topmargin=1in bottommargin=1in

  rightmargin=.25in leftmargin=.25in

  nodate nonumber;

         

ods rtf file='c:\temp\testreport.rtf'

        style=rtf;

  proc report data=testvar nowd

       style(report)={width=8in rules=all frame=box}

       style(header)={color=black background=white  

                      textdecoration=underline fontweight=bold

                      fontstyle=roman font_face='Arial'};

  

        column grp num1 num2 val val_c val_l ;

define grp / display

        style(column)={width=.25in}

        style(header)=Header;

define num1 / display style(column)={width=.25in};

define num2 / display style(column)={width=.25in};

define val / computed 'Right Just' style(column)={just=r};

define val_c / computed 'Center Just' style(column)={just=c};

define val_l / computed 'Left Just' style(column)={just=l};

compute val / character length=26;

    val = trim(put(num1,comma6.))||

          ' ('||

          trim(left(put(num2,best12.2)))||

          ')';

endcomp;

compute val_c/ character length=26;

    val_c=val;

endcomp;

compute val_l/ character length=26;

    val_l=val;

endcomp;

run;

ods rtf close;


rtf_allign_underline.png

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 327 views
  • 0 likes
  • 2 in conversation