I am trying to insert lines of text after 3 specific rows in my report in PROC REPORT. I have a field called ROW which is called in the column statement and not printed in the report. I want a line of text after row 5, row 12, and row 33. I tried this below and get a row after each row between 5 and 12, 12 and 33, etc...
compute after row;
if row =5 then do;
text='Group A'; len=50;
end;
if row =12 then do;
text='Group B'; len=50;
end;
if row =33 then do;
text='Group C'; len=50;
end;
line text $50. ;
endcomp;
Hi @RandoDando,
According to Sample 37763: Conditionally print a LINE statement in PROC REPORT you should use the $VARYINGw. format and define len=0 for the remaining rows:
compute after row;
len=50;
if row= 5 then text='Group A';
else if row=12 then text='Group B';
else if row=33 then text='Group C';
else len=0;
line text $varying. len;
endcomp;
Hi @RandoDando,
According to Sample 37763: Conditionally print a LINE statement in PROC REPORT you should use the $VARYINGw. format and define len=0 for the remaining rows:
compute after row;
len=50;
if row= 5 then text='Group A';
else if row=12 then text='Group B';
else if row=33 then text='Group C';
else len=0;
line text $varying. len;
endcomp;
I actually tried using the $varying statement but it produced really cryptic, "unknown" errors in SAS, so I changed it back to 50. . I'll try it exactly the way you entered it and see...
EDIT: Tried it as entered above and it worked. Thanks
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.