$last_4_chars = "0001"; @all_stores = qw("24","25"); foreach $store(@all_stores) { #This sas file will seperate the datasets by stores #Opens file to write to die("Cannot open weekly_$store_pdf.sas to read from ") unless(open(FINAL, ">weekly_$store_pdf.sas")); $prep_pdf = "libname bce '/cdw/dept/dss/home_dir/s006258/BCE';\n". "proc sql;\n". "SELECT FILEDATE,RPTSTORE,RPTTEAM,FIRSTNAME,LASTNAME,WTDTRAN, \n". " WTDOFFERS,WTDAPPS, substr(WTDOFFERS/WTDAPPS,0,5) as WTD_RATE, +\n". " (case\n". " when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) >= 1. +2 then 'G'\n". " when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) <= 1. +2 and\n". " (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) >= + .65 then 'Y'\n". " when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) < .65 + then 'R'\n". " end) as WTD_Color \n". " MTDTRAN,MTDOFFERS,MTDAPPS, substr(MTDOFFERS/MTDAPPS,0,5) as M +TD_RATE,\n". " (case\n". " when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) >= 1. +2 then 'G'\n". " when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) <= 1. +2 and\n". " (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) >= + .65 then 'Y'\n". " when (substr(sum(WTDAPPS)/sum(WTDOFFERS),0,4)*100) < .65 + then 'R'\n". " end) as MTD_Color\n". "FROM bce.yearly_g$last_4_charsv00\n". "WHERE RPTSTORE = $store\n". "Order by RPTTEAM"; print FINAL "$prep_pdf"; close(FINAL); }
In reply to Printing to file by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |