【发布时间】:2017-10-13 19:42:01
【问题描述】:
我使用连接
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 更改为 SAS 日期格式,例如 01Jan1960?当我运行上述内容时,我得到了我的数据,但日期显示为 20170630 例如。如何按日期列转换以显示 30Jun2017 格式。我发布了我是如何获得我的初始数据集“work.market”的,以防万一这是问题的一部分。抱歉不能发日志。你能帮忙吗?
【问题讨论】:
-
请包含该代码中的日志,它看起来根本不正确。您显示的代码也与您的问题无关。您能否发布与您的问题相关的尝试以及您的数据是什么样的?
-
第一个问题很好,我认为你有它的方式。第二个你需要单独询问,正如 Reeza 所说,你需要展示你的尝试。