MySQL Select

Using Proc SQL to query a MySQL database in a script.
See All procedures

Proc SQL Syntax

proc SQL data=DATAFILE db=DBNAME;
connect CONNECT;
SQL;

Proc SQL Parameters Used

There are four primary parameters for the SQL select:
DATAFILE - where the query results will be stored
CONNECT - the name of the mysql connection defined in the Script basic INI file
DBNAME - always MYSQL when running a select against a MySQL database
SQL - the text of the SQL select command

Proc SQL Example Script

*;
* mysql1.ezs;
* Prco SQL script to obtain basic counts;
* for providers by specialty;
*;
libname test 'c:\test\model\tested';
libname drug 'c:\cloop\data';
proc sql data=test.b db=mysql;
connect test;
select count(*) ccount, specialty from provider group by specialty;

The Proc SQL procedure is part of EZ-R Stats for Windows.

Analysts interested in Proc SQL may also be interested in Proc Means, Proc Outlier, Proc Benford and Proc Univariate.



Web Page last updated on 10-24-2006
© EZ-R Stats, LLC 2005-2007

© EZ_R Stats

Visit EZ_R Stats on the web at:

www.ezrstats.com