PROC SQL:如何将多个查询放在一个查询中,以便并排解决方案?
PROC SQL: How do i put multiple queries in one so the solutions are side by side?
我有三个问题。 1) 计数 * 个记录 table 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;
我有三个问题。 1) 计数 * 个记录 table 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;