1
proc sql;
connect to odbc as odbc("......");
create table work.market as select distinct * from connection to odbc(
select distinct C.Product#, A.county, B.DT, profit2, Rev2)
From Mtable.duv A, Ttable.duv B, otable C
Where B.Product# = C.Product#
and B.Product# = A.Product#
and B.Dt = C.Dt
and B.dt between A.dt_start and dt_end
and B.dt between 20140331 and 20170630
);
disconnect from odbc;
quit;
data work.smallmarket;
set work.market;
where country=Nigeria;
NetMargin=profit2/Rev2;
keep Product# NetMargin DT;
run;
1)如果DT是我的日期,我该如何改变从YYYYMMDD日期格式像01Jan1960一个SAS日期格式?当我运行上面的代码时,我得到了我的数据,但日期以20170630为例。我如何转换日期列以30Jun2017格式显示。我发布了我的初始数据集“work.market”,以防万一这是问题的一部分。抱歉不能发布日志。你能帮忙吗?
请包括来自该代码的日志,它看起来不正确。显示的代码也与您的问题无关。你可以发布你试过的与你的问题相关的内容,以及你的数据是什么样的? – Reeza
第一个问题很好,我认为你拥有它的方式。第二,你需要单独询问,因为Reeza指出你需要展示你的尝试。 – Joe