ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
edison83
Obsidian | Level 7

Hello guys, i am sorry again for my dumb question!

 

I am pretty naive in SAS, and now i have a task that might sounds simple for you guys, however it seems an"UFO" for me.

 

I will start to work with some company data and they sent me a database instance from their AWS database for me

 

They sent me the Host/IP of the database, user and password

 

I don`t even know where to start and how to connect with SAS...I heard something about MySQL, odbc, but those terms sounds like UFO for me hahaha

 

Anyways, just wanted your suggestions on where to get started

 

What do i need to first, do i have to create a database within SAS?

 

Thanks guys

1 ACCEPTED SOLUTION

Accepted Solutions
AnandVyas
Ammonite | Level 13

Hi @edison83 

 

SAS can connect to different databases using access engines native to that database or generic ones like ODBC and JDBC. First of all you should check if your site has these licensed or not. In order to check the license at your site run the following command

 

proc setinit; run;

Once you are sure that the required license i.e. SAS/Access to MySQL for MariaDB or ODBC (as in generic) is installed and with the details i.e. host/port/id/pass already shared, you can write a libname statement to make a connection to the database.

 

SAS/Access to MySQL supports following databases and versions:

 

Support for MySQL
Starting with SAS 9.4M4 SAS/ACCESS Interface to MySQL supports the following:

Amazon RDS Aurora (MySQL engine version 5.6 or later)
Amazon RDS MariaDB (engine version 10.1 or later)
Amazon RDS MySQL (engine version 5.6 or later)
Azure Database for MySQL (engine version 5.6 or later)
Google Cloud Platform Cloud SQL MySQL (engine version 5.6 or later)
MariaDB 10.1 or later
MemSQL 6.0 or later

source: https://support.sas.com/en/documentation/third-party-software-reference/9-4/support-for-database.htm...

 

Example of libname statement:

MySQL LIBNAME Statement Example
In the following example, the libref MYSQLLIB uses SAS/ACCESS Interface to MySQL to connect to a MySQL database. The SAS/ACCESS connection options are USER=, PASSWORD=, DATABASE=, SERVER=, and PORT=.

libname mysqllib mysql user=myusr1 password=mypwd1 database=mysqldb
server=mysrv1 port=9876;

proc print data=mysqllib.employees;
   where dept='CSR010';
run;

Read more about the different options and syntax at this link:

https://go.documentation.sas.com/?docsetId=acreldb&docsetTarget=n1lyg1d0crcejin1v7zaeteeniuu.htm&doc...

 

Hope this helps!

View solution in original post

1 REPLY 1
AnandVyas
Ammonite | Level 13

Hi @edison83 

 

SAS can connect to different databases using access engines native to that database or generic ones like ODBC and JDBC. First of all you should check if your site has these licensed or not. In order to check the license at your site run the following command

 

proc setinit; run;

Once you are sure that the required license i.e. SAS/Access to MySQL for MariaDB or ODBC (as in generic) is installed and with the details i.e. host/port/id/pass already shared, you can write a libname statement to make a connection to the database.

 

SAS/Access to MySQL supports following databases and versions:

 

Support for MySQL
Starting with SAS 9.4M4 SAS/ACCESS Interface to MySQL supports the following:

Amazon RDS Aurora (MySQL engine version 5.6 or later)
Amazon RDS MariaDB (engine version 10.1 or later)
Amazon RDS MySQL (engine version 5.6 or later)
Azure Database for MySQL (engine version 5.6 or later)
Google Cloud Platform Cloud SQL MySQL (engine version 5.6 or later)
MariaDB 10.1 or later
MemSQL 6.0 or later

source: https://support.sas.com/en/documentation/third-party-software-reference/9-4/support-for-database.htm...

 

Example of libname statement:

MySQL LIBNAME Statement Example
In the following example, the libref MYSQLLIB uses SAS/ACCESS Interface to MySQL to connect to a MySQL database. The SAS/ACCESS connection options are USER=, PASSWORD=, DATABASE=, SERVER=, and PORT=.

libname mysqllib mysql user=myusr1 password=mypwd1 database=mysqldb
server=mysrv1 port=9876;

proc print data=mysqllib.employees;
   where dept='CSR010';
run;

Read more about the different options and syntax at this link:

https://go.documentation.sas.com/?docsetId=acreldb&docsetTarget=n1lyg1d0crcejin1v7zaeteeniuu.htm&doc...

 

Hope this helps!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 2907 views
  • 1 like
  • 2 in conversation