The SAS Output Delivery System and reporting techniques

proc report

Reply
Frequent Contributor
Posts: 115

proc report

I've data in below format in my dataset, i want to print it in same way by adding leading blanks by using proc report. in my original source dataset some rows contains leading blanks and some rows starting with character. in below example, first row started with normal character, second and third rows started with leading blanks.

name1

Cu Bangladesh

   Orascom Telecom

   Axiata Group Berhad (Bangladesh) Bd

proc report data=data1;

column name1;

define name1;

run;

Now all rows by defaultly writing in left justify with above code. any way to print the same format (some rows started with charcter and some rows started with leading blanks) in proc report

SAS Super FREQ
Posts: 8,721

Re: proc report

Hi:

  What is your destination of interest? HTML, RTF, PDF? There have been previous forum postings on doing indention using PROC REPORT. You would look for examples of using INDENT= or LEFTMARGIN=.

  Your DEFINE statement for NAME1 is incorrect...there must be SOMETHING else on the DEFINE statement...So, you should be seeing an error message similar to what is shown below:

237    define name;

                  -

                  22

                  76

ERROR 22-322: Syntax error, expecting one of the following: -, /, :.

ERROR 76-322: Syntax error, statement will be ignored.

   The type of indention you show would be done with a CALL DEFINE statement inside a COMPUTE block.

  Just curious, do you really only have 1 variable on the report???

cynthia

Frequent Contributor
Posts: 115

Re: proc report


I've many numeric columns  in report, but only one character column as stated in above. So i am generating this proc report in Stored process. So I want to print the charcter data hierachical order. i.e. i dont want to use left justify, want to print same as in source dataset

SAS Super FREQ
Posts: 8,721

Re: proc report

Hi:

  I did not say to use left justify. I said to use the style override for LEFTMARGIN. There is a difference. See attached screenshot run using the Females in SASHELP.CLASS -- and then indenting only some of the names.. You could also try to use ASIS=ON style override if your data has embedded blanks. The problem with ASIS=ON is that, as a stored process, it is possible that your client application (such as PowerPoint or Web Report Studio might ignore any of the style overrides that you set up in PROC REPORT. I think it is more likely that ASIS=ON would be ignored than the LEFTMARGIN.


  You might want to work with Tech Support on this because there might not be one solution that works for all the client apps that can receive your stored process. You may have to use more advanced macro programming to account for different indenting techniques for different client apps. And, there may be some client apps where you can't get indenting...for example...if you use the SAS Add-in for Microsoft Office and return CSV results to Excel, there is not anything you can do to preserve the indenting.

cynthia

  compute name;

    if name in ( 'Barbara', 'Carol', 'Janet', 'Joyce') then

       call define(_col_,'style','style={leftmargin=.25in}');

  endcomp;

Attachment
Ask a Question
Discussion stats
  • 3 replies
  • 255 views
  • 0 likes
  • 2 in conversation