Skip to content

Commit

Permalink
feat(qualify_xxx): 新增输出变量 IDT,可用于辅助排序 (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snoopy1866 authored Jan 15, 2025
1 parent a61d168 commit 68a75c7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
3 changes: 3 additions & 0 deletions gbk/qualify.sas
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Version Date: 2023-03-08 1.0.1
2024-11-13 1.0.25
2024-11-14 1.0.26
2025-01-09 1.0.27
2025-01-14 1.1.0
===================================
*/

Expand Down Expand Up @@ -687,6 +688,7 @@ Version Date: 2023-03-08 1.0.1
proc sql noprint;
create table tmp_qualify_outdata_label as
select
0 as IDT,
0 as SEQ,
%unquote(%superq(label_sql_expr)) as ITEM
%if &total = TRUE %then %do;
Expand Down Expand Up @@ -717,6 +719,7 @@ Version Date: 2023-03-08 1.0.1
proc sql noprint;
create table tmp_qualify_outdata_level_&i as
select
1 as IDT,
&i as SEQ,
%unquote(%superq(indent_sql_expr)) || %unquote(&&var_level_note_&i) || %unquote(%superq(suffix_sql_expr))
as ITEM,
Expand Down
2 changes: 2 additions & 0 deletions gbk/qualify_multi.sas
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Version Date: 2023-12-26 0.1
2024-06-13 0.9
2024-07-15 0.10
2024-11-14 0.11
2025-01-14 0.12
===================================
*/

Expand Down Expand Up @@ -359,6 +360,7 @@ Version Date: 2023-12-26 0.1
proc sql noprint;
create table tmp_qualify_m_outdata as
select
sum.idt,
sum.seq,
sum.item label = "分类",
%do i = 1 %to &group_level_n;
Expand Down
13 changes: 10 additions & 3 deletions gbk/qualify_multi_test.sas
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Version Date: 2024-01-08 0.1
2024-11-13 0.11
2024-11-14 0.12
2025-01-08 0.13
2025-01-14 0.14
===================================
*/

Expand Down Expand Up @@ -309,14 +310,16 @@ Version Date: 2024-01-08 0.1
select * from DICTIONARY.COLUMNS where libname = "WORK" and memname = "TMP_QMT_CHISQ";
%if &SQLOBS = 0 %then %do; /*行或列的非缺失观测少于2,无法计算统计量*/
create table tmp_qmt_stat
(seq num, item char(%eval(%length(%bquote(&indent_sql_expr)) + 12)), value_1 char(10), value_2 char(10));
(idt num, seq num, item char(%eval(%length(%bquote(&indent_sql_expr)) + 12)), value_1 char(10), value_2 char(10));
insert into tmp_qmt_stat
set seq = &desc_seq_max + 1,
set idt = 1,
seq = &desc_seq_max + 1,
item = &note_stat,
value_1 = "-",
value_2 = "-";
insert into tmp_qmt_stat
set seq = &desc_seq_max + 2,
set idt = 1,
seq = &desc_seq_max + 2,
item = &note_pvalue,
value_1 = "-";
%end;
Expand All @@ -325,13 +328,15 @@ Version Date: 2024-01-08 0.1
%if &chisq_warn = 1 %then %do; /*卡方检验不适用*/
create table tmp_qmt_stat as
select
1 as idt,
&desc_seq_max + 1 as seq,
&note_stat as item,
"Fisher精确检验" as value_1,
"-" as value_2
from tmp_qmt_chisq
outer union corr
select
1 as idt,
&desc_seq_max + 2 as seq,
&note_pvalue as item,
strip(put(XP2_FISH, &p_format)) as value_1
Expand All @@ -344,13 +349,15 @@ Version Date: 2024-01-08 0.1
%end;
create table tmp_qmt_stat as
select
1 as idt,
&desc_seq_max + 1 as seq,
&note_stat as item,
"卡方检验" as value_1,
strip(put(_PCHI_, &ts_format)) as value_2
from tmp_qmt_chisq
outer union corr
select
1 as idt,
&desc_seq_max + 2 as seq,
&note_pvalue as item,
strip(put(P_PCHI, &p_format)) as value_1
Expand Down
3 changes: 3 additions & 0 deletions utf8/qualify.sas
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Version Date: 2023-03-08 1.0.1
2024-11-13 1.0.25
2024-11-14 1.0.26
2025-01-09 1.0.27
2025-01-14 1.1.0
===================================
*/

Expand Down Expand Up @@ -687,6 +688,7 @@ Version Date: 2023-03-08 1.0.1
proc sql noprint;
create table tmp_qualify_outdata_label as
select
0 as IDT,
0 as SEQ,
%unquote(%superq(label_sql_expr)) as ITEM
%if &total = TRUE %then %do;
Expand Down Expand Up @@ -717,6 +719,7 @@ Version Date: 2023-03-08 1.0.1
proc sql noprint;
create table tmp_qualify_outdata_level_&i as
select
1 as IDT,
&i as SEQ,
%unquote(%superq(indent_sql_expr)) || %unquote(&&var_level_note_&i) || %unquote(%superq(suffix_sql_expr))
as ITEM,
Expand Down
2 changes: 2 additions & 0 deletions utf8/qualify_multi.sas
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Version Date: 2023-12-26 0.1
2024-06-13 0.9
2024-07-15 0.10
2024-11-14 0.11
2025-01-14 0.12
===================================
*/

Expand Down Expand Up @@ -359,6 +360,7 @@ Version Date: 2023-12-26 0.1
proc sql noprint;
create table tmp_qualify_m_outdata as
select
sum.idt,
sum.seq,
sum.item label = "分类",
%do i = 1 %to &group_level_n;
Expand Down
13 changes: 10 additions & 3 deletions utf8/qualify_multi_test.sas
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Version Date: 2024-01-08 0.1
2024-11-13 0.11
2024-11-14 0.12
2025-01-08 0.13
2025-01-14 0.14
===================================
*/

Expand Down Expand Up @@ -309,14 +310,16 @@ Version Date: 2024-01-08 0.1
select * from DICTIONARY.COLUMNS where libname = "WORK" and memname = "TMP_QMT_CHISQ";
%if &SQLOBS = 0 %then %do; /*行或列的非缺失观测少于2,无法计算统计量*/
create table tmp_qmt_stat
(seq num, item char(%eval(%length(%bquote(&indent_sql_expr)) + 12)), value_1 char(10), value_2 char(10));
(idt num, seq num, item char(%eval(%length(%bquote(&indent_sql_expr)) + 12)), value_1 char(10), value_2 char(10));
insert into tmp_qmt_stat
set seq = &desc_seq_max + 1,
set idt = 1,
seq = &desc_seq_max + 1,
item = &note_stat,
value_1 = "-",
value_2 = "-";
insert into tmp_qmt_stat
set seq = &desc_seq_max + 2,
set idt = 1,
seq = &desc_seq_max + 2,
item = &note_pvalue,
value_1 = "-";
%end;
Expand All @@ -325,13 +328,15 @@ Version Date: 2024-01-08 0.1
%if &chisq_warn = 1 %then %do; /*卡方检验不适用*/
create table tmp_qmt_stat as
select
1 as idt,
&desc_seq_max + 1 as seq,
&note_stat as item,
"Fisher精确检验" as value_1,
"-" as value_2
from tmp_qmt_chisq
outer union corr
select
1 as idt,
&desc_seq_max + 2 as seq,
&note_pvalue as item,
strip(put(XP2_FISH, &p_format)) as value_1
Expand All @@ -344,13 +349,15 @@ Version Date: 2024-01-08 0.1
%end;
create table tmp_qmt_stat as
select
1 as idt,
&desc_seq_max + 1 as seq,
&note_stat as item,
"卡方检验" as value_1,
strip(put(_PCHI_, &ts_format)) as value_2
from tmp_qmt_chisq
outer union corr
select
1 as idt,
&desc_seq_max + 2 as seq,
&note_pvalue as item,
strip(put(P_PCHI, &p_format)) as value_1
Expand Down

0 comments on commit 68a75c7

Please sign in to comment.