%global odb;
%let odb=cowlife;
%global path;
%let path=netslifemiscow;
%global schema;
%let schema=tmrlifearc;
%global user;
%let user=netslifesas;
%global password;
%let password=;
libname netssas "/paic/hq/sasuserdata16/netssasdata" ;
設定資料壓縮:
options compress=binary;
libname &odb oracle path=&path schema=&schema user=&user password="&password";
/*系統變數*/
%global
systemdate;
%let
systemdate=
%sysfunc
(datetime());
%global
yyyymm;
%let
yyyymm=201503;
%global
yyyymm_01;
%let
yyyymm_01=
%sysfunc
(putn(
%sysfunc
(intnx(month,
%sysfunc
(inputn(&yyyymm.,yymmn6.)),-1)),yymmn6.));
%put
&yyyymm_01.;
%global
yyyymm_02;
%let
yyyymm_02=
%sysfunc
(putn(
%sysfunc
(intnx(month,
%sysfunc
(inputn(&yyyymm.,yymmn6.)),0)),yymmn6.));
%put
&yyyymm_02.;
%global
yyyymm_03;
%let
yyyymm_03=
%sysfunc
(putn(
%sysfunc
(intnx(month,
%sysfunc
(inputn(&yyyymm.,yymmn6.)),1)),yymmn6.));
%put
&yyyymm_03.;
%global
yyyymm_04;
%let
yyyymm_04=
%sysfunc
(putn(
%sysfunc
(intnx(month,
%sysfunc
(inputn(&yyyymm.,yymmn6.)),2)),yymmn6.));
%put
&yyyymm_04.;
%global
yyyymm_05;
%let
yyyymm_05=
%sysfunc
(putn(
%sysfunc
(intnx(month,
%sysfunc
(inputn(&yyyymm.,yymmn6.)),3)),yymmn6.));
%put
&yyyymm_05.;
options
compress
=binary;
/*schema=&schema_sfzdata*/
libname
&odb_sfz
oracle
path
=&path_sfz
user
=&user_sfz
password
="&password_sfz";
/*sas
邏輯庫連線*/
%global
netsyh;
%let
netsyh=netsdw2;
libname
netsdw2
base
"/paic/hq/sasuserdata24/netsdw2";
libname
crm_xqd
base
"/paic/hq/sasuserdata19/crm_xqd";
時間函式,可以用在sql中,和sysdate一樣使用
%global systemdate;
%let systemdate=%sysfunc(datetime());
建表:
proc sql noprint;
create table &netssasdata..ods_telsales_fysp_ym_tmp
( order_no varchar(16),
is_primary_agent varchar(1) );
quit;
建索引:
proc sql noprint;
create unique index order_no on &netssasdata..dw_la_cylce_order_mm_&data_month(order_no);
quit;
設定輸出集記錄數1000
proc sql outobs=1000;
select t.campaign_id,t.campaign_name
,sum(1) as fst_call_cnt,sum(t.total_call_count) as total_call_count,
sum(t.total_contact_count) as total_contact_count
from &netssasdata..dwa_la_cylce_mm_201206 t
where t.campaign_month='201206'
and t.custlist_type_code='19'
group by t.campaign_id,t.campaign_name;
quit;
資料匯入:
data &netssasdata..dim_telephone_property;
input telephone_number_3$ telephone_sp_code telephone_sp$ is_3g @@;
cards;
134 1 中國移動0
130 2 中國聯通0
186 2 中國聯通1
133 3 中國電信0
189 3 中國電信1 ;
run;
data合併
data &netssasdata..dw_la_cust_tel_mm_&data_month;
set &netssasdata..dw_la_free_cust_tel_mm_&data_month;
set &netssasdata..dw_la_free_cust_telh_mm_&data_month;
set &netssasdata..dw_la_cylce_cust_tel_mm_&data_month;
set &netssasdata..dw_la_cylce_cust_telh_mm_&data_month;
run;
資料排序
proc sort data = &netssasdata..dw_la_cust_tel_mm_&data_month;
by telephone_number assigned_task_id;
run;
類似rownumber功能
data &netssasdata..dw_la_cust_tel_mm_seq_&data_month;
set &netssasdata..dw_la_cust_tel_mm_&data_month;
by telephone_number;
if first.telephone_number then seq=1;
else seq+1;
run;
篩選rn=1
proc sql noprint;
create table &netssasdata..dw_la_cust_tel_mm_seq_1_&data_month as
select assigned_task_id,telephone_number
from &netssasdata..dw_la_cust_tel_mm_seq_&data_month a
where a.seq = 1 ;
quit;
SAP常用功能
1 sap外觀 幫助圖示右側的按鈕是customizing of local layout 定製本地布局 按鈕,可以用它來變更sap gui顯示介面的風格。2 sap導航 1 在sap print list視窗裡,如果不想在保持期內儲存系統假離線請求,在print screen list 列印頁面列...
IOS 常用功能
對xib檔案的處理 xib的載入可以通過 nsbundle maibundle loadnibnamed nsstring str owner nsstring temp dic nsdictionary dic 載入 xib的fileowner檔案。然後通過下標得到sub 如果要獲取xib中固定的...
PHP常用功能
1 字串 主要方法有 strops substr str split explode 等,更多方法檢視php官方手冊 字串的方法 strpos substr print r explode str sun of beach 獲取子字串在當前字串的索引位置 echo strpos str,ea 字串的...