RVD5Star
RVD5Star

Reputation: 47

SAS Enterprise Guide Read Uncommitted in Query Builder

I am trying to figure out a way to change the isolation level to read uncommitted (RU) prior to my query running from query builder, as I sometimes need to get data from operational tables.

Is there a way to do this in SAS Enterprise Guide? I know in the Options menu, there is a place to run custom code before task and query code, but I don't know what to enter here to make this happen.

Thanks!

Upvotes: 1

Views: 454

Answers (2)

Allan Bowe
Allan Bowe

Reputation: 12691

The answer - it depends. The part where you force an uncommitted read is configured in the libname definition. If your libname is defined in metadata, then no - you can't do it in EG (at least not using a wizard), you'll need the library manager in SMC or DI studio.

If your libname is defined programmatically, then the syntax depends on what flavour of database you are using. For SQL Server, you'd need to add the following option: Read_Isolation_Level=RU.

Note that this can mean that you read 'dirty data' (see this communities thread).

Upvotes: 2

momo1644
momo1644

Reputation: 1804

In your Auto load program that defines the libraries; you just need to know the name of the SQL library you want to query. Then do the following steps:

  1. In your EG project: create a new program: File / new / Program, This will add a new program to your flow.
  2. If the libname of the SQL library is called 'SQL' and the table you want to query is 'ORDERS'; you use PROC SQL which is very similar to MS-SQL, then click run or F8.

    proc sql; select id, sum(sales) as total_sales from SQL.ORDERS group by id ; quit;

Example

Step 1:

step 1

Step 2: Step 2

New Program

Run

Upvotes: 0

Related Questions