Saturday, February 25, 2012

Pass-through to SAS

Is it possible from sql to use SAS as an object? And if so how?

I was recently tasked with Data Profiling and sitting next to me is a SAS developer, who just has to run a couple of functions, to do what has taken me days (and I haven't finished!). If I could call out to SAS and run the SAS functions it would be great. I have looked on the net and can see SAS calling out to SQL but not the other way round. Technically I'm probably not up to this but I don't want this to hold me back... so any help would be great.It probably is possible, and the method depends on exactly what you want to do. I'm sorry I can't be more specific, but without more to go on that is the best I can do.

If you have the ODBC driver for SAS, that would help a lot. If not, but you can execute master.dbo.xp_cmdshell and put the SAS client on the server, that might help too.

-PatP|||Uhmmm, what are you trying to do? Maybe there is a faster method that you are not aware of...|||Sorry for the delay I've been away....

I'm going to leave the communication to SAS from SQL for now, but I had a look at another thread 'Cursor or temp table' which seemed appropriate, I'm well aware coming from Foxpro to SQL I have a lot to learn.

I was tasked with data profiling on our warehouse and so set to writing some generic functions to gather some basic statistics on the dml layer. (Looked at what SAS could provide and it was just over the top)

1. How many nulls
2. Frequency on values
3. Min & Max values

I gathered the database info from information_schema, added an extra column to tag the tables and columns I was interested in and then used this to run the MAX(), MIN() and COUNT(*) functions and then stored the results to a table.

My questions are: I'm I missing something, could I have done this without a cursor? 2) Would it have been faster and better to create a temp table and then skipped thru that? 3) I couldn't have done all this in a select could I?|||Yeah, you could probably do it all in a SELECT, unless there are some odd complications you not telling us about.

No comments:

Post a Comment