LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 16 Apr 2009 09:05:31 -0700
Reply-To:   Richard <rdevenezia@WILDBLUE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Richard <rdevenezia@WILDBLUE.NET>
Organization:   http://groups.google.com
Subject:   Re: SCL Libname and OLEDB connection
Comments:   To: sas-l@uga.edu
Comments:   cc: Ken.Barz@cpcmed.org
Content-Type:   text/plain; charset=ISO-8859-1

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


Back to: Top of message | Previous page | Main SAS-L page