|
Ken:
Here is a sample code showing how init_string does work when a libref
is created with either LIBNAME statement or LIBNAME function.
Note that when the function is used, the second argument is null.
--------------------------------
/**/
%let data_folder = %sysfunc(pathname(WORK));
ods listing close;
ods csv file="&data_folder.\myData.csv";
proc print noobs data=sashelp.class;
run;
ods csv close;
ods listing;
/**/
libname
csvdata
oledb
preserve_tab_names = yes /* so proc datasets will list the text
files */
/**/
init_string
= "Provider=Microsoft OLE DB Provider for ODBC Drivers;
DSN=Text Files;
DBQ=&data_folder;
DefaultDir=&data_folder;
DriverId=27;
MaxBufferSize=2048;
PageTimeout=5;
"
/**/
;
proc datasets lib=csvdata;
run;
data classFromCsv;
set csvdata.'myData.csv'n;
run;
libname csvdata;
data _null_;
rc = libname (
'datafldr'
,
, 'oledb'
, 'init_string=' ||
quote
( catx
( ';'
, 'Provider=Microsoft OLE DB Provider for ODBC Drivers'
, 'DSN=Text Files'
, "DBQ=&data_folder"
, "DefaultDir=&data_folder"
, 'DriverId=27'
, 'MaxBufferSize=2048'
, 'PageTimeout=5'
)
)
);
run;
data class2FromCsv;
set datafldr.'myData.csv'n;
run;
libname datafldr;
--
Richard A. DeVenezia
http://www.devenezia.com
|