%if %sysfunc(exist(working.__extra_nos__)) %then %do;
proc export data=working.__extra_nos__
dbms=oracle replace;
password="&password.";
tablename="sch.no_selection_&env_type.";
url="&dburl.";
username="&user.";
run;
sch.no_selection_& env_type也有一个名为identifier的列,它不在__extra_nos__
中,因此我想在导出它时将其设置为& identifier。
我该怎么做?
答案 0 :(得分:1)
通过LIBNAME而不是PROC EXPORT访问数据库DBMS要容易得多。 http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a003113591.htm
libname mydblib oracle user=testuser password=testpass path=hrdept_002;
[调整你的oracle安装细节]
然后,您只需使用普通语言(SQL或数据步骤)创建或修改表格,而不是导出...
proc sql;
create table mydblib.sch.no_selection_&env_type. as
select *, "&identifier" as identifier from work.tempextras;
quit;
或
data mydblib.sch.no_selection_&env_type.;
set work.tempextras;
identifier="&identifier";
run;
答案 1 :(得分:0)
从__extra_nos__
创建数据集,然后输入标识符。然后导出该数据集。
data work.tempextras; set working.__extra_nos__; identifier = &identifier.; run; %if %sysfunc(exist(working.__extra_nos__)) %then %do; proc export data=work.tempextras; dbms=oracle replace; password="&password."; tablename="sch.no_selection_&env_type."; url="&dburl."; username="&user."; run; proc datasets library = work; /*delete the temp dataset*/ delete tempextras; run;