BookmarkSubscribeRSS Feed
Pato485
Calcite | Level 5

how can i do this, but in sas eg (odbc engine) through implicit statements? 

 

proc sql;
connect to sqlsvr as mydb
(datasrc="SASDATA" user="sas" password="xxx");
select * from connection to mydb
(CREATE INDEX ZP on dashboard_novacik (ZP) ;
CREATE INDEX Fin on dashboard_novacik (Fin) ;
);

QUIT;

 

This code works in SAS Studio (sqlsvr engine).

 

Thanks

3 REPLIES 3
Patrick
Opal | Level 21

Both SAS EG and SAS Studio are clients that connect to a SAS Server where the code executes.

If you're connecting with both clients to the same environment with the same user then the same code will work using either client.

 

Not sure about SQL Server but with many databases a Create Index would fail if the index already exists - meaning you would need to either first drop the index or check for existence.

Something like:

Patrick_0-1694158938710.png

 

Ksharp
Super User
"select * from connection to mydb" is for create a table.
If you want execute other SQL statement,your code should look like this:

proc sql;
connect to sqlsvr as mydb
(datasrc="SASDATA" user="sas" password="xxx");

execute(
CREATE INDEX ZP on dashboard_novacik (ZP) ;
CREATE INDEX Fin on dashboard_novacik (Fin) ;
) by mydb;

QUIT;

I am not very sure,check it more at support.sas.com
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0tpd3yaqvep53n1g8wahav3hgco.htm
Kurt_Bremser
Super User

Create a LIBNAME to the SQL Server schema, then run

proc sql;
create index zp on sqllib.dashboard_novacik (zp);
create index fin on sqllib.dashboard.novacik (fin);
quit;

But I would not be surprised if this does not work and you are forced to use explicit pass-through.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 350 views
  • 3 likes
  • 4 in conversation