簡體   English   中英

PROC SQL:如何將多個查詢合而為一,以便解決方案並排?

[英]PROC SQL: How do i put multiple queries in one so the solutions are side by side?

我有三個查詢。 1)計算*在一個表中的記錄2)對匹配的記錄或由於原因1不使用的記錄進行計數3)對匹配的記錄並且因原因2不使用的記錄進行計數

如何將3個查詢放到一個查詢中,然后一次將2和3查詢一起添加,所以我不必兩三列。 因此,在excel中看起來像:[1]: http : //imgur.com/IQp82sx

 /* 1 */ /* This finds amount of records */
    proc sql; 
    create table
      work.Original_count
    as 
    select
        count(*) as occurences
    from 
        WORK.query_for_reports1 as t1;
    quit;

    /* 2 *//* counts how many records are already matched  in technique ED*/ /* 10 */ 
    proc sql; 
    create table
         work.occ_matched_T1
    as 
    select
        count(*) as occurences 
    from 
       work.QUERY_FOR_REPORTS1 as t1 
    where t1.EdSYS is not null;
    quit;

    /*3 */ /* Counts how many records are already matched with IP */ /* 9 */
    proc sql; 
    create table 
        work.occ_matched_t1_1
    as 
    select 
           count(*) as occurences 
    from 
        work.E_DATA_UNMATCHED as t1
    where t1.Ip is not null;

quit;
proc sql;
create table wanted as
select t1.occurences as original_count
      ,t2.occurences as matched_by_T1
      ,t3.occurences as matched_by_T2
      ,t2.occurences+t3.occurences as B2_C2
from (select count(*) as occurences from query_for_reports1) t1
    ,(select count(*) as occurences from query_for_reports1 where edsys is not null) t2
    ,(select count(*) as occurences from e_data_unmatched where ip is not null) t3
;
quit;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM