Desktop productivity for business analysts and programmers

Body of email come in attachment

Reply
Contributor
Posts: 30

Body of email come in attachment

The email portion is coming in the attachment i am sending not sure why its doing that 


%MACRO EMAILER; %IF &EMAIL = 'Y' %THEN %DO; ods path work.mystore(update) sasuser.templat(update) sashelp.tmplmst(read); proc template; define style styles.mystyle_xls; parent=styles.seaside; style body from body / background=transparent; style topc from rowheader / vjust=top background=cornsilk font_size=10pt ; class usertext from usertext / bordertopcolor=white borderbottomcolor=white borderleftcolor=white borderrightcolor=white just=left ; style data from data/ /* background=cxB0B0B0*/ just=left ; end; run; data x; x=.; label x='A0'x; run; proc sort data=FINAL_EMAIL_LIST; BY PROV_NAME; RUN; %macro nocomp_email_NEST2( email=, Vprov_name=, CMS_COUNT=, CC_COUNT=, CAL_COUNT=); ods tagsets.ExcelXP options( embedded_titles='yes' embedded_footnotes='yes' frozen_headers='4' sheet_name=&Vprov_name /* row_heights='0,0,0,0,0,0,0,30'*/ autofit_height='yes' /* row_height_fudge = '40'*/ absolute_column_width='25,25,25,25,25,25,25,25' row_repeat='yes' rowcolheadings='yes' Pages_FitWidth = '1' Row_Repeat = '1-4' Pages_FitHeight='100' FitToPage = 'yes' ); /*Options nonumber nodate nocenter;*/ options nocenter; ods listing close; options missing=''; /* Perform PROC REPORT */ ODS escapechar='^'; Proc report data=OUTREACHREPORT_FINAL(where=(trim(left(email)) = trim(left(&email)))) split='^'; column MRN PatientName Total_DX PatientAreaCode PatientPhone LastMedVisitDate PayerDisplayName NOTE kporg_status ROW_HEIGHT VSORT1; define MRN / display ' ^Medical Record Number' style(column)={just=left cellwidth=75}; define PatientName / display ' ^Patient Name' style(column)={just=left cellwidth=200}; define Total_DX / display ' ^# of A/B/HTN & Lipids Dx' style(column)={just=left cellwidth=50}; define PatientAreaCode / display ' ^Area Code' style(column)={just=left cellwidth=50}; define PatientPhone / display ' ^Phone Number' style(column)={just=left cellwidth=75}; define LastMedVisitDate / display ' ^Last MED Visit' style(column)={just=left cellwidth=75}; define PayerDisplayName / display ' ^Payer' style(column)={just=left cellwidth=100 color=$c_format. Font_Weight=$fontweight.}; /*background=$cc_format. - This was for the black background on last two columns*/ define NOTE / display ' ^Note' style(column)={just=left cellwidth=200 color=$cc_format. Font_Weight=$fontweight.}; /*background=$cc_format.*/ define kporg_status / display ' ^kp.org status' style(column)={just=left cellwidth=75}; /*background=$cc_format.*/ define ROW_HEIGHT / display ' ' style(column)={just=left cellwidth=3 color=$cc_format. Font_Weight=$fontweight.}; /*Explanation for proc sort: Make a duplicate of the columns you are sorting by to preserve duplicate numbers in every row*/ /*If this is not done, proc report sort will only display the first unique number*/ define VSORT1 / ORDER DESCENDING ORDER=INTERNAL NOPRINT; TITLE1 JUSTIFY=LEFT "^{STYLE [color=red font_size=14pt font_weight=bold] Provider: &Vprov_name}"; /* TITLE2 JUSTIFY=LEFT HEIGHT=14PT "^{Style [color=blue font_weight=bold] Medicare:} &CMS_COUNT */ /* ^{Style [color=gold font_weight=bold] Covered California:} &cc_count"; */ TITLE2 JUSTIFY=LEFT HEIGHT=14PT "^{Style [color=steel font_weight=bold] CalPERs:} &cal_count"; RUN; ods tagsets.ExcelXP path='/apps/sas/datasets/data17/NCAFS/tpmgmoc/nvl/reports/' file="Unseen_Attachment" style=mystyle_xls; %MEND nocomp_email_NEST2; %macro nocomp_email(Email=,name=, SUM= , First_Name=); %let separator_s =%str( ); %LET subject_string = %sysfunc(catx(&separator_s, %nrstr(ACTION SUGGESTED:), %sysfunc(compress(&name," ")), %nrstr(Unseen Risk Member Outreach))); %PUT &subject_string; /*To determine the line and column of errors*/ options spool; proc format; value $c_format 'CalPERS' = 'Black' 'Consider booking TAV appt.' = 'Black' other = 'Black'; value $cc_format 'CalPERS' = 'Black' 'Consider booking TAV appt.' = 'White' 'abc' = 'White' other = 'White'; value $fontweight 'CalPERS' = 'medium' /*Bold*/ 'Consider booking TAV appt.' = 'medium' /*Bold*/ other = 'medium'; run; ods tagsets.ExcelXP path='/apps/sas/datasets/data17/NCAFS/tpmgmoc/nvl/reports/' file="Unseen_Attachment" style=mystyle_xls; data _null_; set final_email_list_filter; call execute('%nocomp_email_NEST2( email =" '||email||' ",'|| 'Vprov_name= " '||trim(PROV_NAME)||' ",'|| 'CMS_COUNT= '||trim(left(CMS_COUNT))||', '|| 'CC_COUNT= '||trim(left(CC_COUNT))||', '|| 'CAL_COUNT= '||trim(left(CAL_COUNT))||')' ); run; /* Close Excel file */ ods tagsets.ExcelXP close; filename output email subject ="&subject_string - (PHI)" to= 'hr@org' from='hr@.org' attach = ( "/apps/sas/datasets/data17/NCAFS/tpmgmoc/nvl/reports/Unseen_Attachment" extension='xml' content_type='application/vnd.ms-excel' ) CT= 'text/html'; ODS HTML BODY=output STYLE=CBD_STANDARD rs=none; /*solutions*/ ods escapechar='^'; options missing=' '; Proc report data=SUMMARY(where=(email = &email)); title1 j=left font=light Height=4 Hello Dr. &First_Name; title2 j=left height=3 font=light "^{newline 1} ^{Style [color=blue Height=16pt font_weight=bold] You have} ^{Style [color=blue Height=16pt font_weight=bold textdecoration=underline] &SUM} ^{Style [color=blue Height=16pt font_weight=bold] unseen risk pts for the remainder of 2018}"; COLUMN Total_Risk_Members PanelTotalUnseenMembers PanelUnseenWithFutureAppt Medicare_Unseen_Members CalPERs_Unseen_Members ACA_Unseen_Members AVG_TO_BE_SEEN_PER_WEEK; define Total_Risk_Members / display '^ TOTAL RISK MBRS' style(column)={just=center cellwidth=75}; define PanelTotalUnseenMembers / display '^ TOTAL NUMBER STILL UNSEEN' style(column)={just=center cellwidth=100}; define PanelUnseenWithFutureAppt / display '^ TOTAL w/ FUTURE APPT ALREADY BKD' style(column)={just=center cellwidth=150}; define Medicare_Unseen_Members / display '^ CMS' style(column)={just=center cellwidth=75}; define CalPERs_Unseen_Members / display '^ CAL' style(column)={just=center cellwidth=75}; define ACA_Unseen_Members / display '^ ACA' style(column)={just=center cellwidth=75}; define AVG_TO_BE_SEEN_PER_WEEK / display '^ Avg No. to be seen Per Week' style(column)={just=center cellwidth=75}; /*Add Back in Sept*/ /*"^{newline 2} ^{Style [font_weight=bold]We ask that you please have your MA call these patient to schedule the appointment, rather than sending a secure message or letter, because these pts have already received both. It is time for the personal touch.}*/ footnote1 j=left color=black font=light height=4 "^{newline 1} Please find attached your unseen CalPERs list, which is helpful to have when making cold calls (documenting on a Tele Encounter) or with contacting your members via Online Encounter. ^{newline 2}^{Style [color=red] Your other lists for CMS and ACA can be accessed directly by your MA in App1 using the Unseen by PCP Page, which they should already be using to document their outreach attempts.} ^{newline 2} Remember to use the Inbox as a trigger: if the pink light is on in RAR, Sec Msg, etc, instruct your MA to call the pt in. ^{newline 2} We appreciate your attention to the coding aspect of our work. ^{newline 1} Please contact us if you have any questions."; footnote2 j=left height=4 font=light " ^{newline 2} ^{STYLE [color=Black font_size=14pt font_weight=bold] Jaime Silva} ^{newline 1} Senior Financial Analyst ^{newline 1} North Valley Controllers Office ^{newline 1} ^{Style [color=green] Phone: } (916) 784-5882 or tie line 8-514 ^{newline 2} ^{STYLE [color=Black font_size=14pt font_weight=bold] Gena Fairchild} ^{newline 1} Documentation & Coding Program Manager ^{newline 1} North Valley Controller's Office ^{newline 1} ^{Style [color=green] Phone: } (916) 784-5567 or tie line 8-514 ^{newline 1} ^{Style [color=red] APP1/MDRS: } ^{Style [color=blue] https://eio.kp.org/eio/Refresh/} ^{newline 1} ^{Style [color=blue] NVL Documentation & Coding Website: } ^{Style [color=blue] http://kaisersac/clinical/coding} ^{newline 3} ^{Style [color=blue] NOTICE TO RECIPIENT:} If you are not the intended recipient of this e-mail, you are prohibited from sharing, copying, or otherwise using or disclosing its contents. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and permanently delete this e-mail and any attachments without reading, forwarding or saving them. Thank you."; run; ods HTML close; filename output clear; /*Delete final_email_list_filter*/ proc datasets; delete final_email_list_filter; %mend nocomp_email; data _null_; set SUMMARY; call execute('%nocomp_email( email ="'||EMAIL||'",'|| 'name="'||ResourceName||'",'|| 'SUM ="'||PanelTotalUnseenMembers||'",'|| 'First_Name ="'||First_Name||'")' ); run; %END; %MEND EMAILER; %EMAILER;
SAS Super FREQ
Posts: 805

Re: Body of email come in attachment

As a general advice do not nest macro definitions, but keep each macro definition separate

check whether the
ODS ... FILE=...;
some proc
ODS ... CLOSE;

are placed correctly

Test the your macros with simple code first
Ask a Question
Discussion stats
  • 1 reply
  • 105 views
  • 0 likes
  • 2 in conversation