BookmarkSubscribeRSS Feed
ksamm
Calcite | Level 5

I have a number of large SybaseIQ SQL scripts (5000+ lines each). The READ statement for each contains a number of parameters. Is there a way to execute the READ through the Proc SQL procedure using the SAS/ACCESS for SybaseIQ interface?

 

many thanks in advance

K

7 REPLIES 7
SASKiwi
Opal | Level 21

Can you post an example of a SybaseIQ READ statement? Normally non-standard SQL can be executed via SAS's PASSTHRU EXECUTE statement.

ksamm
Calcite | Level 5
Thanks for looking at this !!!

parameters parm1 parm2
read ‘’ {source}
[parm1]
[parm2]
{output}

SASKiwi
Opal | Level 21

Here is how you do an EXECUTE statement. All you need to do is put your Sybase code inside the brackets. Does this produce a result set by the way? If so then you may need to take a different approach.

 

documentation.sas.com/?docsetId=acreldb&docsetTarget=n0pj5uu3i328pmn1fackclh2xnd9.htm&docsetVersion=...

 

 

 

 

ksamm
Calcite | Level 5

Thanks SAS Kiwi,

Yes it produces a very large result set. Also, inserting the code between braces is not practical because as I mentioned, some of these queries are 5000+ lines long.

 

regards

K

SASKiwi
Opal | Level 21

You could wrap the SQL code into an SQL stored procedure, then call that. You will also need to create a temporary table or view instead of producing a result set and then query the table / view in a following "normal" SQL passthru query.

ksamm
Calcite | Level 5

Good idea !!  This sounds feasible, I'll give it a go on Monday and let you know how it goes.  However I think there is still one potential issue which I forgot to mention earlier.  Some of the parameters to the SQL script need to bee macro variables.  

SASKiwi
Opal | Level 21

Shouldn't be a problem. The usual hassle is most databases require parameters to be wrapped in single quotes but this technique gets around that problem:

 

%str(%')&MyMacroVar%str(%')

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 7 replies
  • 696 views
  • 1 like
  • 2 in conversation