proc sql;
create table A as
select
case when year(zdrq) in (2011) and month(zdrq) in (1,2,3) then '2011Q1'
when year(zdrq) in (2011) and month(zdrq) in (4,5,6) then '2011Q2'
when year(zdrq) in (2011) and month(zdrq) in (7,8,9) then '2011Q3'
when year(zdrq) in (2011) and month(zdrq) in (10,11,12) then '2011Q4'
when year(zdrq) in (2012) and month(zdrq) in (1,2,3) then '2012Q1'
when year(zdrq) in (2012) and month(zdrq) in (4,5,6) then '2012Q2'
when year(zdrq) in (2012) and month(zdrq) in (7,8,9) then '2012Q3'
when year(zdrq) in (2012) and month(zdrq) in (10,11,12) then '2012Q4'
when year(zdrq) in (2013) and month(zdrq) in (1,2,3) then '2013Q1'
when year(zdrq) in (2013) and month(zdrq) in (4,5,6) then '2013Q2'
when year(zdrq) in (2013) and month(zdrq) in (7,8,9) then '2013Q3'
when year(zdrq) in (2013) and month(zdrq) in (10,11,12) then '2013Q4'
when year(zdrq) in (2014) and month(zdrq) in (1,2,3) then '2014Q1'
when year(zdrq) in (2014) and month(zdrq) in (4,5,6) then '2014Q2'
when year(zdrq) in (2014) and month(zdrq) in (7,8,9) then '2014Q3'
when year(zdrq) in (2014) and month(zdrq) in (10,11,12) then '2014Q4'
when year(zdrq) in (2015) and month(zdrq) in (1,2,3) then '2015Q1'
when year(zdrq) in (2015) and month(zdrq) in (4,5,6) then '2015Q2'
when year(zdrq) in (2015) and month(zdrq) in (7,8,9) then '2015Q3'
when year(zdrq) in (2015) and month(zdrq) in (10,11,12) then '2015Q4'
when year(zdrq) in (2016) and month(zdrq) in (1,2,3) then '2016Q1'
when year(zdrq) in (2016) and month(zdrq) in (4,5,6) then '2016Q2'
when year(zdrq) in (2016) and month(zdrq) in (7,8,9) then '2016Q3'
when year(zdrq) in (2016) and month(zdrq) in (10,11,12) then '2016Q4'
when year(zdrq) in (2017) and month(zdrq) in (1,2,3) then '2017Q1'
when year(zdrq) in (2017) and month(zdrq) in (4,5,6) then '2017Q2'
when year(zdrq) in (2017) and month(zdrq) in (7,8,9) then '2017Q3'
when year(zdrq) in (2017) and month(zdrq) in (10,11,12) then '2017Q4'
when year(zdrq) in (2018) and month(zdrq) in (1,2,3) then '2018Q1'
when year(zdrq) in (2018) and month(zdrq) in (4,5,6) then '2018Q2'
when year(zdrq) in (2018) and month(zdrq) in (7,8,9) then '2018Q3'
when year(zdrq) in (2018) and month(zdrq) in (10,11,12) then '2018Q4'
when year(zdrq) in (2019) and month(zdrq) in (1,2,3) then '2019Q1'
when year(zdrq) in (2019) and month(zdrq) in (4,5,6) then '2019Q2'
when year(zdrq) in (2019) and month(zdrq) in (7,8,9) then '2019Q3'
when year(zdrq) in (2019) and month(zdrq) in (10,11,12) then '2019Q4'
when year(zdrq) in (2020) and month(zdrq) in (1,2,3) then '2020Q1'
when year(zdrq) in (2020) and month(zdrq) in (4,5,6) then '2020Q2'
when year(zdrq) in (2020) and month(zdrq) in (7,8,9) then '2020Q3'
when year(zdrq) in (2020) and month(zdrq) in (10,11,12) then '2020Q4'
when year(zdrq) in (2021) and month(zdrq) in (1,2,3) then '2021Q1'
when year(zdrq) in (2021) and month(zdrq) in (4,5,6) then '2021Q2'
when year(zdrq) in (2021) and month(zdrq) in (7,8,9) then '2021Q3'
when year(zdrq) in (2021) and month(zdrq) in (10,11,12) then '2021Q4'
when year(zdrq) in (2022) and month(zdrq) in (1,2,3) then '2022Q1'
when year(zdrq) in (2022) and month(zdrq) in (4,5,6) then '2022Q2'
when year(zdrq) in (2022) and month(zdrq) in (7,8,9) then '2022Q3'
when year(zdrq) in (2022) and month(zdrq) in (10,11,12) then '2022Q4'
when year(zdrq) in (2023) and month(zdrq) in (1,2,3) then '2023Q1'
when year(zdrq) in (2023) and month(zdrq) in (4,5,6) then '2023Q2'
when year(zdrq) in (2023) and month(zdrq) in (7,8,9) then '2023Q3'
when year(zdrq) in (2023) and month(zdrq) in (10,11,12) then '2023Q4'
when year(zdrq) in (2024) and month(zdrq) in (1,2,3) then '2024Q1'
when year(zdrq) in (2024) and month(zdrq) in (4,5,6) then '2024Q2'
when year(zdrq) in (2024) and month(zdrq) in (7,8,9) then '2024Q3'
when year(zdrq) in (2024) and month(zdrq) in (10,11,12) then '2024Q4'
else 'error' end as zdrq
,dktx
from tzyh.Dbdktz;
quit;



雷达卡




京公网安备 11010802022788号







