This is the code I am using to create the output and email to myself. This will run and produce the correct output if I run manually using SAS EG. But to have it in a production environment it is executed from unix cmd line and it fails do to the error I posted earlier. So I need to edit the length so that I can produce the output or find another way to create the information sheet in the report. Thanks, /** auto-email **/ %let html = /xx/xxx/adhoc_rpts/cita_compare.xls; %let rptname= cita_compare; filename rptfl "/xx/xxx/adhoc_rpts/&rptname..xls"; ods path(prepend) work.templat(update); proc template; define style styles.XLsansPrinter; parent = styles.sansPrinter; style header from header / font_face = "Arial, Helvetica" font_size = 10pt font_weight = bold font_style = roman foreground = cx000000 background = #99ccff just = center vjust = bottom; end; run; quit; /*ODS won't create a tab for an empty dataset, so if there are no errors, this dummy dataset will add a row stating there are no errors and use that as a seed file. */ data no_review; format note $20.; note='No_Records_To_Review'; run; /*create a macro variable that has the count of error samples*/ proc sql noprint; select count(*) INTO :obsvar from compare_results; quit; /*if the error samples count=0 then set an obsno macro variable to 1, else set it to 0*/ data _null_; if &obsvar.=0 then obsnosamp=1; else obsnosamp=0; call symput("obsnosamp",obsnosamp); run; /*append the no_review seed dataset to the samples dataset ONLY if the samples dataset is empty - uses the obsno macro variable to accomplish this - the nowarn and force options will force the append even though the variable lists don't match and not create log warnings*/ proc append data=no_review(obs=&obsnosamp.) base=compare_results nowarn force; quit; proc report nofs data=work.compare_results list; columns _all_; run; options validvarname=upcase label=0; proc report nofs data=work.compare_results out=work.compare_results1 list; columns _all_; run; options validvarname=any label=1; /** PROBLEM STARTS HERE **/ proc report nofs data=work.instructions list; columns _all_; run; options validvarname=upcase label=0; proc report nofs data=work.instructions out=work.instructions1 list; columns _all_; run; options validvarname=any label=1; ods listing close; ods tagsets.excelxp file = rptfl style = XLsansPrinter options(embedded_titles='on' minimize_style='yes' wraptext='no' AUTOFIT_HEIGHT='yes' ) /*rs=none; ods noproctitle*/; /* Instructions Sheet */ ods tagsets.excelxp options(sheet_name="Instructions" sheet_interval='none' embedded_titles='yes' wraptext = 'yes' absolute_column_width="20,20,50,50"); proc print data=instructions1 noobs ; title "Research Instructions"; var unmapped_category note description action ; run; /*Summary tab*/ ods tagsets.excelxp options(sheet_name = 'Unmapped Cita Compare Report' sheet_interval='table' embedded_titles='yes'wraptext = 'no' autofilter='all' absolute_column_width="20,12,15,15,20,30,15,15,15,15"); proc print data = work.compare_results1 Noobs; title "Unmapped Cita Compare Report"; var UNMAPPED_CATEGORY ENTITY_ID ENTITY_DESC PORTFOLIO_ID PORTFOLIO_DESC TQM_RPT_NAME REPORT_ID RPT_NUMBER CHKPT_NUMBER NOTE ; run; ods tagsets.excelxp close; %put &todaydt.; filename myfile email to = ("elliott.olds@wjm.com") from="eo7777@jvsnun.ssmb.com" SUBJECT="Unmapped Cita Compare Report for &todaydt." attach = ("&html" ct = 'application/octet-stream'); data _null_; file myfile; put "Your Unmapped TQM CITA Compare Report for &todaydt. is now available." / / " " / / "Thank you and have a great day!" / / " " / /"Sincerely," / /"Elliott Olds" / / " " ; run; filename myfile clear; run;
... View more