sas table data formate output



proc sql noprint;
select type||"="||case when type_id=6 then put(curr_date, percentn10.2)
                       when type_id in (1,2,4) then "RM "||put(curr_date,comma10.)
                       else put(curr_date,comma10.)
                   end into :curr_date  separated by '\n'
from &mid_table_1
where type_id not in (4,5)
order by type_id,sort_id;

select type||"="||case when type_id=6 then put(wtd      , percentn10.2)
                       when type_id in (1,2,4) then "RM "||put(wtd      ,comma10.)
                       else put(wtd      ,comma10.)
                  end into :wtd        separated by '\n'
from &mid_table_1
where type_id not in (1,5)
order by type_id;

select type||"="||case when type_id=6 then put(mtd      , percentn10.2)
                       when type_id in (1,2,4) then "RM "||put(mtd      ,comma10.)
                       else put(mtd      ,comma10.)
                  end into :mtd        separated by '\n'
from &mid_table_1
where type_id not in (1,5)
order by type_id;

select type||"="||case when type_id=6 then put(p1m_mtd  , percentn10.2)
                       when type_id in (1,2,4) then "RM "||put(p1m_mtd  ,comma10.)
                       else put(p1m_mtd  ,comma10.)
                  end into :p1m_mtd    separated by '\n'
from &mid_table_1
where type_id not in (1,5)
order by type_id;

select type||"="||case when type_id=6 then put(qtd      , percentn10.2)
                  when type_id in (1,2,4) then "RM "||put(qtd      ,comma10.)
                  else put(qtd      ,comma10.) end into :qtd        separated by '\n'
from &mid_table_1
where type_id not in (1,5)
order by type_id;

select type||"="||case when type_id=6 then put(ytd      , percentn10.2)
                       when type_id in (1,2,4) then "RM "||put(ytd      ,comma10.)
                       else put(ytd      ,comma10.) end into :ytd        separated by '\n'
from &mid_table_1
where type_id not in (1,5)
order by type_id;

select
  put(mtd,comma10.)
 ,put(p1m_mtd,comma10.)
 ,round((mtd/p1m_mtd-1)*100,.01) into :mtd_value,:p1m_mtd_value,:mtd_rate
from &mid_table_1
where type_id=2 ;
quit;

Daily Reload Report 31-05-2018

Electronic          =RM  1,395,905
Physical            =RM  2,962,775
Electronic+Physical =RM  4,358,680
Transaction         =   314,532
Target(%)           =    0.00%
MTD vs MTD-1 (%) =     2.69
MTD vs MTD-1 (RM)=  126742979 vs  123425638

[Accumulated Reload]
[Week to date] (           4 days)
Electronic+Physical =RM 16,711,390
Transaction         = 1,237,020
Average Reload      =RM  4,177,848
Target(%)           =    0.00%

[Month to date] (31 days)
Electronic+Physical =RM  126742979
Transaction         = 9,648,417
Average Reload      =RM  4,088,483
Target(%)           =    0.00%

[Previous Month to date] (30 days)
Electronic+Physical =RM  123425638
Transaction         = 9,413,492
Average Reload      =RM  4,114,188
Target(%)           =    0.00%%sysexec %str(
 echo -ne "Daily Reload Report &ddmmyy\n"                       > &email_body;
 echo -ne "\n&curr_date\n"                                      >>&email_body;
 echo -ne "MTD vs MTD-1 (%%) = &mtd_rate\n"                     >>&email_body;
 echo -ne "MTD vs MTD-1 (RM)= &mtd_value vs &p1m_mtd_value\n\n" >>&email_body;
 echo -ne "[Accumulated Reload]\n"                              >>&email_body;
 echo -ne "[Week to date] (&weekdaynum days)\n"                 >>&email_body;
 echo -ne "&wtd\n\n"                                            >>&email_body;
 echo -ne "[Month to date] (&monthdaynum days)\n"               >>&email_body;
 echo -ne "&mtd\n\n"                                            >>&email_body;
 echo -ne "[Previous Month to date] (&lmonthdaynum days)\n"     >>&email_body;
 echo -ne "&p1m_mtd\n\n"                                        >>&email_body;
 echo -ne "[Quarter to date] (&qdaynum days)\n"                 >>&email_body;
 echo -ne "&qtd\n\n"                                            >>&email_body;
 echo -ne "[Year to date] (&yeardaynum days)\n"                 >>&email_body;
 echo -ne "&ytd\n"                                              >>&email_body;
);




猜你喜欢

转载自blog.csdn.net/link200809/article/details/80540924
SAS