BookmarkSubscribeRSS Feed
HitmonTran
Pyrite | Level 9

Hello,

 

I want to keep my indentation in proc report (as presented in data), but when it flows to a new line it misalign.

 

HitmonTran_0-1611539683093.png

 

data:

desc
Number of participants
Cardiac disorders
   Palpitations
Gastrointestinal disorders
   Gastrointestinal polyp haemorrhage

 

 

 

code: define statement "desc"

proc report data = final1 nowd headline headskip missing split='@' style(header column)=[protectspecialchars=off];


 %if &blind=Y %then %do;
	 columns ordx1 aebodsys total1 aedecod  desc ;
	  define ordx1     / descending order     order=internal noprint;
	  define aebodsys  / order order=internal noprint;
	  define total1  / descending order  order=internal noprint;
	  define aedecod   / order order=internal noprint;

	  define desc    	  	/display   style(header)=[just=left]    style(column)=[asis=on cellwidth=2.5 in ] flow " "; 
run;

 

14 REPLIES 14
ChrisNZ
Tourmaline | Level 20

The text-wrapping occurs in the first column? Did you try setting a large width for the first column?

ChrisNZ
Tourmaline | Level 20

Do you want the  h  to be aligned with  in the line above it in your yellow-coloured text?

HitmonTran
Pyrite | Level 9
that's correct. I updated the post to include sample data.
ballardw
Super User

@HitmonTran wrote:
that's correct. I updated the post to include sample data.

Not really "data".

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

ChrisNZ
Tourmaline | Level 20

>  I updated the post to include sample data.

Sample data would be data we can your code against.

This should always be provided when you ask for help if you want to help yourself.

 

In any case, I think that's the standard behaviour, and that's it. 

Maybe try inserting padding characters in those labels that cause problems?

 

RAVI2000
Lapis Lazuli | Level 10
Did you find a way to do this alignment?
HitmonTran
Pyrite | Level 9
not yet.
SASKiwi
PROC Star

How about trying these STYLE options in your column DEFINE statement?

style=[textalign=left cellwidth=2.5in tagattr="wrap:yes"]

You need to use TEXTALIGN=left to ensure there is no indenting and the TAGATTR setting WRAP to yes should set wrapping on in the column. 

Cynthia_sas
SAS Super FREQ

Hi:

  This is a variation of a program I posted for someone else about indenting -- he did not have to worry about wrapping, but the fix is the same -- use the leftmargin= option, as shown below.

Cynthia_sas_0-1611710132199.png

 

With a big enough cellwidth and leftmargin set at .25 in , there is NOT any wrapping.

 

However, with cellwidth of 1.5in and a leftmargin of .25, you can see that when the line does need to wrap, it wraps to the leftmargin value:

Cynthia_sas_1-1611710220627.png

 

I already had the code set up for PDF using the same data as the previous example, so all I did was change the cellwidth and change the output file name and you can see that wrapping occurs as you wanted.

Cynthia

RAVI2000
Lapis Lazuli | Level 10
Thank you for your response Cynthia. Can you link the thread here.
RAVI2000
Lapis Lazuli | Level 10
Can we use INDENT= option in proc report?
Cynthia_sas
SAS Super FREQ
Hi: INDENT= and LEFTMARGIN= sometimes do the same thing. It depends on the destination, you'll have to look in the ODS documentation on style attributes and whether they are honored by each destination. As you can see, LEFTMARGIN= works for PDF. The INDENT= option may be an RTF option. Can't remember off the top of my head.
Cynthia
RAVI2000
Lapis Lazuli | Level 10
Is this applicable for all outputs like RTF, PDF, HTML?
Cynthia_sas
SAS Super FREQ
Hi:
As you can see in the example above, LEFTMARGIN= works for PDF. I don't think it works for HTML. Can't remember about RTF. Better to check in the doc or run a simple test using fake data such as I show in my example.
Cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 14 replies
  • 2916 views
  • 6 likes
  • 6 in conversation