Hi all,
Hope someone can help me with the below issue. As I have not been able to the issue myself and I am running out of ideas. 🙂
I have a similar question as have been previously posted (getting proc report spanrows to work correctly with long lines of text in PDF output) and the work around Usage Note 45549: Wrapped text strings in the first column cause unwanted white space in subsequent ...) mentioned. However, my output format is txt and not ODS PDF. Does this change the anything regarding how to work around this problem?
kind regards
FHeinen
If your going to plain text file, then you would need to put the breaks in yourself. So create a dataset as you want the output to look like then proc report very basic code. This is a bit of a hack, but shows the kind of thing:
data have; var1="This is an example of a description that is too long so it wraps down to the next line"; var2="Manager"; var3=3; id=1; output; var2="staff"; var3=2; id=2; output; var2="peer"; var3=3; id=3; output; run; proc sort data=have out=inter (keep=var1) nodupkey; by var1; run; data inter (drop=i); set inter; retain id; length var_res $30; if _n_=1 then id=1; do i=1 to countw(var1); if lengthn(strip(var_res)||" "||scan(var1,i," ")) <= 30 then var_res=strip(var_res)||" "||scan(var1,i," "); else do; output; id=id+1; var_res=scan(var1,i," "); end; end; run; proc sql; create table WANT as select B.VAR_RES as VAR1, A.VAR2, A.VAR3 from WORK.HAVE A left join WORK.INTER B on A.ID=B.ID; quit;
Whe you say the output format is text, I assume you're writing to the SAS listing (or some other non-styled output file). In this case the solutions that rely on ODS styles won't work and SPANROWS doesn't apply. You'll have to fall back to the old-school PROC REPORT listing options. Check out the WIDTH and FLOW options on the DEFINE statement for example.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.