%macro create_pdf_new2;
proc sql;
create table capture as
select *
from capture
where qualnew is not missing
and complete is not missing
and enrollednew is not missing
and invalidphone is not missing
and unabletoreach is not missing
and declined is not missing
and claimsnew is not missing
and providernew is not missing
and externalnew is not missing
and selfreferralnew is not missing
and othernew is not missing
;
run;
ods escapechar="^" ;
ods pdf file=&output_pdf. notoc compress = 9 ; *STARTPAGE=NEVER ;
Ods pdf text = "^{style [just=L font_face='helvetica' font_style=italic font_size=11pt font_weight=bold]Maternity Program}";
Ods pdf text = "^{style [just=L font_face='helvetica' font_style=roman font_size=8pt ]&timeframe.}";
/********************************** Program Waterfall ************************************/
ods layout absolute;
Ods pdf text="^S={just=l color=black font_style=roman font_size=16pt font_weight=bold
backgroundcolor=orange CELLHEIGHT=21PT CELLWIDTH=20CM } PROGRAM WATERFALL";
proc report data=capture nowd
style(report)=[rules=all HEIGHT=18PT WIDTH=20CM just=left]
style(header)=[rules=all cellheight=.4in font_size=8pt background=lightgrey]
style(column)=[font_size=8pt];
column QualNew ( EnrolledNew Complete InvalidPhone UnabletoReach Declined ) EnrollRate CaptureRate;
define QualNew/ "Participants Qualified" center;
define EnrolledNew/ "Participants Enrolled" center;
define Complete/ "Participants Completed" center;
define InvalidPhone/ "Invalid/NoPhone#" center;
define UnabletoReach/ "Unable to Reach" center;
define Declined/ "Declined to Enroll" center;
define EnrollRate/"Enrollment Rate" format=percent8.1 center;
define CaptureRate/"Capture Rate" format=percent8.1 center;
run;
/********************************** Claims ************************************/
Ods pdf text="^S={just=l color=black font_style=roman font_size=16pt font_weight=bold
backgroundcolor=orange CELLHEIGHT=21PT CELLWIDTH=13CM } REFERRAL SOURCE";
proc report data=capture nowd
style(report)=[rules=all HEIGHT=18PT WIDTH=13CM just=left]
style(header)=[rules=all cellheight=.4in font_size=8pt background=lightgrey]
style(column)=[font_size=8pt];
column ClaimsNew ProviderNew ExternalNew InternalNew SelfReferralNew OtherNew;
define ClaimsNew / "Claims" center;
define ProviderNew/ "Provider" center;
define ExternalNew/ "External Referral" center;
define InternalNew/ "Internal" center;
define SelfReferralNew/ "Self- Referral" center;
define OtherNew/ "Other" center;
run;
/********************************** Trimester ************************************/
Ods pdf text="^S={just=l color=black font_style=roman font_size=16pt font_weight=bold
backgroundcolor=orange CELLHEIGHT=21PT CELLWIDTH=13CM } TRIMESTER BREAKDOWN & RISK";
proc report data=TRIMESTER_SUMMARY nowd
style(report)=[rules=all HEIGHT=18PT WIDTH=13CM just=l]
style(header)=[rules=all cellheight=.4in font_size=8pt background=lightgrey]
style(column)=[font_size=8pt];
column status one two three total;
define status / " ";
define one / "1st Trimester" center;
define two / "2nd Trimester" center;
define three / "3rd Trimester" center;
define TOTAL/ "Total" center;
define n/ format=6. ;
define Total_Per/ format=percent8.1 "Total_Per" ;
DEFINE Total_Per/ computed format=percent8.1 "Total_Per" ;
run;
/****************************** Outcomes - Mother ********************************/
ods region x=0.1 pct y=4.35in height=38 pct width=33 pct;
Ods pdf text="^S={just=l color=black font_style=roman font_size=16pt font_weight=bold backgroundcolor=orange CELLHEIGHT=17PT CELLWIDTH=6.3CM }OUTCOMES - MOTHER";
PROC REPORT DATA =MOTHER_METRICS nowd
style(report)=[rules=all WIDTH=6.3CM just=l]
style(header)=[rules=all cellheight=.6in font_size=8pt background=lightgrey]
style(column)=[font_size=8pt];
COLUMN Response total_cases Total_Per;
DEFINE Response/ 'Delivery Type' center;
DEFINE total_cases/ format=6. "Total Cases" center;
DEFINE Total_Per/ format=percent8.1 "% of Total" center;
RUN;
/****************************** Outcomes - New Born ********************************/
ods region x=40 pct y=4.35in height=50 pct width=60 pct ;
Ods pdf text="^S={just=center color=black font_style=roman font_size=16pt font_weight=bold backgroundcolor=orange CELLHEIGHT=17PT CELLWIDTH=11.5cm }OUTCOMES - NEWBORN";
PROC REPORT DATA =NEW_BORN_METRICS nowd
style(report)=[rules=all]
style(header)=[rules=all cellheight=.6in font_size=8pt background=lightgrey]
style(column)=[font_size=8pt];
COLUMN ('Outcomes' Question Response) ('Total Cases' total_cases) ('% of Total' Total_Per);
DEFINE Question/ GROUP ' ' center;
DEFINE Response/ GROUP ' ' center;
DEFINE total_cases/ format=6. " " center;
DEFINE Total_Per/ format=percent8.1 " " center;
RUN;
ods layout end;
ods pdf close;
%mend create_pdf_new2;
Code is above. Using SAS EG 6.1, SAS 9.4 and output is pdf. I can run my code in a separate code window in SAS EG and there is no error. But when I put the code in a macro with the rest of my code I get this error. Line 180 is the second line in this log.
MPRINT(CREATE_PDF_NEW2): ods region x=0.1 pct y=4.35in height=38 pct width=33 pct;
MPRINT(CREATE_PDF_NEW2): PROC REPORT DATA =MOTHER_METRICS nowd style(report)=[rules=all WIDTH=6.3CM just=l]
4 The SAS System 22:27 Thursday, December 3, 2015
style(header)=[rules=all cellheight=.6in font_size=8pt background=lightgrey] style(column)=[font_size=8pt];
MPRINT(CREATE_PDF_NEW2): COLUMN Response total_cases Total_Per;
MPRINT(CREATE_PDF_NEW2): DEFINE Response/ 'Delivery Type' center;
MPRINT(CREATE_PDF_NEW2): DEFINE total_cases/ format=6. "Total Cases" center;
MPRINT(CREATE_PDF_NEW2): DEFINE Total_Per/ format=percent8.1 "% of Total" center;
MPRINT(CREATE_PDF_NEW2): RUN;
NOTE: Multiple concurrent threads will be used to summarize data.
NOTE: There were 3 observations read from the data set WORK.MOTHER_METRICS.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.03 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 7200.68k
OS Memory 47796.00k
Timestamp 12/04/2015 01:52:26 PM
Step Count 687 Switch Count 38
Page Faults 0
Page Reclaims 1283
Page Swaps 0
Voluntary Context Switches 109
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
MPRINT(CREATE_PDF_NEW2): ods region x=40 pct y=4.35in height=50 pct width=60 pct ;
MPRINT(CREATE_PDF_NEW2): Ods pdf text="^S={just=center color=black font_style=roman font_size=16pt font_weight=bold
backgroundcolor=orange CELLHEIGHT=17PT CELLWIDTH=11.5cm }OUTCOMES - NEWBORN";
MPRINT(CREATE_PDF_NEW2): PROC REPORT DATA =NEW_BORN_METRICS nowd style(report)=[rules=all] style(header)=[rules=all
cellheight=.6in font_size=8pt background=lightgrey] style(column)=[font_size=8pt];
MPRINT(CREATE_PDF_NEW2): COLUMN ('Outcomes' Question Response) ('Total Cases' total_cases) ('% of Total' Total_Per);
MPRINT(CREATE_PDF_NEW2): DEFINE Question/ GROUP ' ' center;
MPRINT(CREATE_PDF_NEW2): DEFINE Response/ GROUP ' ' center;
MPRINT(CREATE_PDF_NEW2): DEFINE total_cases/ format=6. " " center;
MPRINT(CREATE_PDF_NEW2): DEFINE Total_Per/ format=percent8.1 " " center;
MPRINT(CREATE_PDF_NEW2): RUN;
NOTE: Multiple concurrent threads will be used to summarize data.
NOTE: There were 9 observations read from the data set WORK.NEW_BORN_METRICS.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.03 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 6850.68k
OS Memory 47796.00k
Timestamp 12/04/2015 01:52:26 PM
Step Count 688 Switch Count 36
Page Faults 0
Page Reclaims 1284
Page Swaps 0
Voluntary Context Switches 101
Involuntary Context Switches 2
Block Input Operations 0
Block Output Operations 0
MPRINT(CREATE_PDF_NEW2): ods layout end;
5 The SAS System 22:27 Thursday, December 3, 2015
MPRINT(CREATE_PDF_NEW2): ods pdf close;
NOTE: ODS PDF printed 1 page to /optum/csg/01datafs/dev/phi/data/custom/projects/MultiClient/LPR194735_MaternityPPR/MATERNITY
Monthly Report3C - 201501.pdf.
MLOGIC(CREATE_PDF_NEW2): Ending execution.
180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.
TIA,
Dan
@Reeza wrote:
It's usually a semicolon/quote error. I feel like copying and pasting may also introduce some invisible blanks that cause issues. If you can put the code in a text editor, check for invisible chars and then paste back into a clean session.
That's one of the weirder problems I've come across. I started from scratch with the barest of code needed to output something. I copied and pasted the same code, section by section and it worked without error each step of the way.
I have found things the way you suggested. Thanks for your suggestions.
@Reeza wrote:
I hate Line/Spool errors because they're hard to debug.
I had one last night in SAS UE and it was some weird copy/paste issue and I had to retype the code in and then it worked fine.
I can't see anything wrong with your code, someone else may. However, my solution in this type of situation is binary testing. Remove half the code and run. If no bug, put the other half of the code in and run - error should be in that section. Repeat until bug is isolated. AKA guess and test 🙂
Thanks for the reply. I tried removing one section at a time and I couldn't find it. I had it running perfectly and I made one last change and it appeared. I reversed the change and it was still there. I can't figure out what happened. Thanks.
@Reeza wrote:
It's usually a semicolon/quote error. I feel like copying and pasting may also introduce some invisible blanks that cause issues. If you can put the code in a text editor, check for invisible chars and then paste back into a clean session.
That's one of the weirder problems I've come across. I started from scratch with the barest of code needed to output something. I copied and pasted the same code, section by section and it worked without error each step of the way.
I have found things the way you suggested. Thanks for your suggestions.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: