我想研究如何从SAS访问SQLite DB.这样做最简单的方法是什么?是否有SAS产品我们可以许可这样做?我不想使用ODBC驱动程序,因为这似乎是很久以前写的,并不是SQLite的正式部分.
SAS支持从管道读取数据(在unix环境中).实际上,您可以设置filename语句以在主机环境中执行sqlite命令,然后处理命令输出,就像从文本文件中读取它一样.
SAS支持页面:http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#pipe.htm
例:
*---------------------------------------------- * (1) Write a command in place of the file path * --> important: the 'pipe' option makes this work *----------------------------------------------; filename QUERY pipe 'sqlite3 database_file "select * from table_name"'; *---------------------------------------------- * (2) Use a datastep to read the output from sqlite *----------------------------------------------; options linesize=max; *to prevent truncation of results; data table_name; infile QUERY delimiter='|' missover dsd lrecl=32767; length numeric_id 8 numeric_field 8 character_field_1 $40 character_field_2 $20 wide_character_field $500 ; input numeric_id numeric_field $ character_field_1 $ character_field_2 $ wide_character_field $ ; run; *---------------------------------------------- * (3) View the results, process data etc. *----------------------------------------------; proc contents; proc means; proc print; run;