BookmarkSubscribeRSS Feed
sunilreddy
Fluorite | Level 6

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

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

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

sunilreddy
Fluorite | Level 6


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

Cynthia_sas
SAS Super FREQ

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;


indent_name.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
  • 3 replies
  • 839 views
  • 0 likes
  • 2 in conversation