Skip to content

Instantly share code, notes, and snippets.

@Benjit87
Created November 27, 2012 01:14
Show Gist options
  • Save Benjit87/4151759 to your computer and use it in GitHub Desktop.
Save Benjit87/4151759 to your computer and use it in GitHub Desktop.
/* Assign the library named SAMPLE to the ODBC data source *
* the library sample will contain the tables of the database */
LIBNAME SAMPLE ODBC DATASRC=mysqlData;
/* Use SQL query to create a dataset in Work.Sample *
* using sample1 table from the SAMPLE library which is defined as *
* the ODBC datasource */
PROC SQL outobs=10; *Limit output to 10 only;
CREATE TABLE Work.Sample AS
SELECT t1.Id,
t1.POBOX,
t1.Name,
t1.Country
FROM SAMPLE.sample1 t1;
QUIT;
/* Alternative is to use SQL Passthrough */
PROC SQL;
CONNECT TO ODBC as con1
( user="benji" pw="XXXXXX" datasrc="mysqlData");
SELECT *
FROM CONNECTION TO con1 (
SELECT *
FROM sample1);
DISCONNECT FROM con1;
QUIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment