Code (we are on 9.3) is the following and have attached the output pdf. Rather than repeat the clinic name and date on the next page(s) it is repeating on each adjacent row. I am fairly new to SAS so any help is much appreciated.. Thanks.
options orientation=landscape;
ods listing close;
ods pdf file="dummy_opencharts.pdf"
notoc startpage=no;
title "Clinic Summary - Physician Open Chart Report (for incomplete charts more than 14* days old)";
footnote1 'Each open chart will have a $10.00 fee based upon the weekly InBasket report';
footnote2 '*- Starting on 1/1/2020 penalty will apply to incomplete charts more than 7 days old';
proc report data=tmp3 nowindows nowd spanrows
style(report)={font_face=times font_size=1}
style(column)={just=center font_face=times background=white foreground=black
font_size=1 cellwidth=.6in}
style(header)={just=center font_face=times cellheight=.7in font_size=1
foreground=black cellwidth=.6in background=white};
column scheduling_department
report_dt
unclosed_14_plus_num
unclosed_14_plus_amt
transcription_14_plus_num
transcription_14_plus_amt
unsigned_esig_14_plus_num
unsigned_esig_14_plus_amt
hospital_14_plus_num
hospital_14_plus_amt
cosigns_14_plus_num
cosigns_14_plus_amt
total_14_plus_num
total_14_plus_amt
unclosed_8_plus_num
unclosed_8_plus_amt
transcription_8_plus_num
transcription_8_plus_amt
unsigned_esig_8_plus_num
unsigned_esig_8_plus_amt
hospital_8_plus_num
hospital_8_plus_amt
cosigns_8_plus_num
cosigns_8_plus_amt
total_8_plus_num
;
define scheduling_department / group
style(header)={vjust=middle}
style(column)={vjust=middle};
define report_dt / order order=internal format=mmddyy10.
style(header)={vjust=middle}
style(column)={vjust=middle};
break after scheduling_department / summarize;
compute after scheduling_department; line ' '; endcomp ;
run;
ods pdf close;
Another possible approach requires restructuring your data. You have apparently two similar measures at different time frames:
unclosed_14_plus_num unclosed_14_plus_amt transcription_14_plus_num transcription_14_plus_amt unsigned_esig_14_plus_num unsigned_esig_14_plus_amt hospital_14_plus_num hospital_14_plus_amt cosigns_14_plus_num cosigns_14_plus_amt total_14_plus_num total_14_plus_amt unclosed_8_plus_num unclosed_8_plus_amt transcription_8_plus_num transcription_8_plus_amt unsigned_esig_8_plus_num unsigned_esig_8_plus_amt hospital_8_plus_num hospital_8_plus_amt cosigns_8_plus_num cosigns_8_plus_amt total_8_plus_num
I would be tempted to create a variable with the "14_plus" or "8_plus" as an additional and then have the variables reduced to
unclosed_num unclosed_amt transcription_num transcription_amt unsigned_esig_num unsigned_esig_amt hospital_num hospital_amt cosigns_num cosigns_amt total_num total_amt
And using that time frame variable a grouping variable to control things:
Something along the lines of :
proc report data=tmp3 nowindows nowd spanrows style(report)={font_face=times font_size=1} style(column)={just=center font_face=times background=white foreground=black font_size=1 cellwidth=.6in} style(header)={just=center font_face=times cellheight=.7in font_size=1 foreground=black cellwidth=.6in background=white}; column timeframe
scheduling_department report_dt unclosed_num unclosed_amt transcription_num transcription_amt unsigned_esig_num unsigned_esig_amt hospital_num hospital_amt cosigns_num cosigns_amt total_num total_amt ; define timeframe /group; define scheduling_department / group style(header)={vjust=middle} style(column)={vjust=middle}; define report_dt / order order=internal format=mmddyy10. style(header)={vjust=middle} style(column)={vjust=middle}; break after scheduling_department / summarize; compute after scheduling_department; line ' '; endcomp ; run;
Or possibly as an Across variable
proc report data=tmp3 nowindows nowd spanrows style(report)={font_face=times font_size=1} style(column)={just=center font_face=times background=white foreground=black font_size=1 cellwidth=.6in} style(header)={just=center font_face=times cellheight=.7in font_size=1 foreground=black cellwidth=.6in background=white}; column scheduling_department report_dt timeframe,( unclosed_num unclosed_amt transcription_num transcription_amt unsigned_esig_num unsigned_esig_amt hospital_num hospital_amt cosigns_num cosigns_amt total_num total_amt ) ; define timeframe /across; define scheduling_department / group style(header)={vjust=middle} style(column)={vjust=middle}; define report_dt / order order=internal format=mmddyy10. style(header)={vjust=middle} style(column)={vjust=middle}; break after scheduling_department / summarize; compute after scheduling_department; line ' '; endcomp ; run;
I see now why the repeated adjacent row (for the summarizing) but still need to figure out how to display the header row titles (scheduling_department and report_dt) on subsequent pages
ods listing close;
ods csv file = "dummy_charts.txt";
proc print data=tmp3; run;
ods csv close;
ods listing;
Let me know if the text file works (exported the sas dataset tmp3 as a csv)
You should provide some example data that we can test or possibly modify to demonstrate solutions.
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 {i} icon or attached as text to show exactly what you have and that we can test code against.
The core cause of the issue is that you are using more columns than fit across the "page" and controlling how to show a column across the break from width. If you do not need to print this on paper you may want to try changing the PAPERSIZE system option to accommodate wider columns.
Thanks for the suggestions. This does need to be print-friendly but I may see if legal paper size and shrinking the columns will print everything on one page if I can't get the headers to repeat.
Another possible approach requires restructuring your data. You have apparently two similar measures at different time frames:
unclosed_14_plus_num unclosed_14_plus_amt transcription_14_plus_num transcription_14_plus_amt unsigned_esig_14_plus_num unsigned_esig_14_plus_amt hospital_14_plus_num hospital_14_plus_amt cosigns_14_plus_num cosigns_14_plus_amt total_14_plus_num total_14_plus_amt unclosed_8_plus_num unclosed_8_plus_amt transcription_8_plus_num transcription_8_plus_amt unsigned_esig_8_plus_num unsigned_esig_8_plus_amt hospital_8_plus_num hospital_8_plus_amt cosigns_8_plus_num cosigns_8_plus_amt total_8_plus_num
I would be tempted to create a variable with the "14_plus" or "8_plus" as an additional and then have the variables reduced to
unclosed_num unclosed_amt transcription_num transcription_amt unsigned_esig_num unsigned_esig_amt hospital_num hospital_amt cosigns_num cosigns_amt total_num total_amt
And using that time frame variable a grouping variable to control things:
Something along the lines of :
proc report data=tmp3 nowindows nowd spanrows style(report)={font_face=times font_size=1} style(column)={just=center font_face=times background=white foreground=black font_size=1 cellwidth=.6in} style(header)={just=center font_face=times cellheight=.7in font_size=1 foreground=black cellwidth=.6in background=white}; column timeframe
scheduling_department report_dt unclosed_num unclosed_amt transcription_num transcription_amt unsigned_esig_num unsigned_esig_amt hospital_num hospital_amt cosigns_num cosigns_amt total_num total_amt ; define timeframe /group; define scheduling_department / group style(header)={vjust=middle} style(column)={vjust=middle}; define report_dt / order order=internal format=mmddyy10. style(header)={vjust=middle} style(column)={vjust=middle}; break after scheduling_department / summarize; compute after scheduling_department; line ' '; endcomp ; run;
Or possibly as an Across variable
proc report data=tmp3 nowindows nowd spanrows style(report)={font_face=times font_size=1} style(column)={just=center font_face=times background=white foreground=black font_size=1 cellwidth=.6in} style(header)={just=center font_face=times cellheight=.7in font_size=1 foreground=black cellwidth=.6in background=white}; column scheduling_department report_dt timeframe,( unclosed_num unclosed_amt transcription_num transcription_amt unsigned_esig_num unsigned_esig_amt hospital_num hospital_amt cosigns_num cosigns_amt total_num total_amt ) ; define timeframe /across; define scheduling_department / group style(header)={vjust=middle} style(column)={vjust=middle}; define report_dt / order order=internal format=mmddyy10. style(header)={vjust=middle} style(column)={vjust=middle}; break after scheduling_department / summarize; compute after scheduling_department; line ' '; endcomp ; run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.