2013-02-14 35 views
0
%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也有被叫標識列,所以我想我導出將其設置爲&標識符不__extra_nos__我如何使用PROC EXPORT將值賦給列?

我該怎麼做?

回答

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; 
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;