BookmarkSubscribeRSS Feed
Vimal_U
Calcite | Level 5

Can anyone know how to integrate SAS with PHP?

18 REPLIES 18
LinusH
Tourmaline | Level 20

Kind of open question.

If you could give some examples of your requirements, it would be simpler to point in the right direction.

Data never sleeps
Vimal_U
Calcite | Level 5

We want to access SAS datasets for data manipulations like creating new DS from raw datasets. And we want to write SAS codes inside the PHP to handle the DSs.

Is this is possible. If so, how?

Note: We are trying to create a web based application using this.

LinusH
Tourmaline | Level 20

Not being a PHP-programmer, just trying to interpet web information...

One obviuos way is for you to talk to SAS via ODBC/JDBC. Unfortunately, your SAS installation needs to licensed to act as a ODBC Server (SAS/SHARE and SAS/SHARE*NET).

Another way to integrate with SAS is to use the API for IOM (Integrated Object Model). Check out the on line doc and resources to see whether this is feasible for you. i think this method requires a license for "SAS Integration Technologies".

Data never sleeps
Vimal_U
Calcite | Level 5

Ya.Thanks a lot. We are having license for SAS/SHARE.. But how can we use that to integrate with PHP?

Is there any kind of procedures to follow?

LinusH
Tourmaline | Level 20

You also need a license for SHARE*NET (it's just a license add on, not a real product that needs to be installed).

That will give you the possibility to access SAS via ODBC, hence giving you possibility to read and manipulate data via SQL.

The procedure is to have a SAS/SHARE server up and running, and then define it as a data source in your ODBC manager (which of course requires that you have the SAS ODBC driver installed on that host).

SAS ODBC Drivers

Data never sleeps
Vimal_U
Calcite | Level 5

Is there any possibility of accessing using "SAS/ACCESS Interface to ODBC"?

LinusH
Tourmaline | Level 20

That's the other way around, that module is used by SAS for accessing other data sources.

A possible solution is to use any other ODBC database, and have your web app access that (and SAS can then access that data separately). But then the question is, what role has SAS in your application, other than a data store...?

Data never sleeps
Vimal_U
Calcite | Level 5

We want to use SAS as our back end.

Vimal_U
Calcite | Level 5

Actually we want to run SAS codes inside the PHP to generate SAS DS. And we can reuse the new DS as well.

LinusH
Tourmaline | Level 20

Perhaps you could write some SAS Stored Process, which you could call from PHP (via http calls)....? ODBC won't let you run SAS specific code, just ANSI-like SQL.

Data never sleeps
chrisj75
Calcite | Level 5

I'd done something similar whereby SAS calls PHP via a URL fileref, but never with PHP controlling SAS.

Also, be aware that the terms of your SAS licence prohibit exposing of SAS functionality to a web-based environment, i.e. you are not allowed to take a HTML form submission containing SAS code, and pass it back to SAS for processing.

Vimal_U
Calcite | Level 5

We have license version of SAS 9.3 so it may not lead any issues i think.

chrisj75
Calcite | Level 5

From the PHP snippet, it seems you're invoking SAS on a local machine. The licence will cover that machine only. Exposing SAS functionality via a web-based / PHP-processed form to multiple users is a breach of that single PC/user licence.


Tom
Super User Tom
Super User

If SAS is installed on the same server that is running the PHP code then you can just call SAS the same as you would call any other operating system command.  Not necessarily as interactive of using IOM, but probably a lot simpler to get started.

http://chipmunkninja.com/Program-Execution-in-PHP%3A-exec-m@

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 18 replies
  • 5511 views
  • 7 likes
  • 4 in conversation