Making SOAP calls from SAS! Integrating with web services
One of the issues with SAS for many IT departments is the lack of integration with service oriented architecture (SOA). The good news is with many new features coming online with versions 9.X+ are service oriented.
Lets look quickly at the Proc SOAP procedure now available.
For those SAS programmers out there that aren't familiar with SOAP or services, get your basis here: SOAPUser-Basics
In a nutshell, SOAP is transporting XML data via a HTTP Post. In order to make a successful SOAP call from SAS you need a couple of things.
1. a request XML file
2. a repsonse XML file
3. a webservice URL and WSDL (Web Service Definition Language) -Think webservice users manual
Here is a simple example of a SOAP call we use on a daily job.
filename rqst_xml 'some file system reference';
* Create the XML;
data _null_;
set input_dataset;
file rqst_xml;
if first.records=1 then do;
put '<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Header>
<requestingSystem>SAS</requestingSystem><requestingFunction>DemoSasScript</requestingFunction>
</soap:Header><soap:Body>
<requestedData>';end;
datasetData;
if last.records=1 then do;
put '</requestedData>
</soap:Body></soap:Envelope>';
end;
run;
filename rspns_xml 'some file system reference';
%let URL=http://webservice_url/service;
proc soap in=rqst_xml
out=rspns_xml
url=&url;
run;
Upon executing the call, you can read in the rspns_xml data with the SAS XML engine.
This is meant to be a simple example with very limited scope. Service architecture can quickly get complicated with error and condition handling. Please let us know if you need help with your SAS architecture or coding.
Have you checked out RStudio?
We have a special place in our heart for the R language. Extremely powerful and compact (not a chatty language).
One of the complaints we have had with R is the crazy interface neccessary to do programming. Well that may all change.
Recenlty a small group of developer / designers got together to build an open source IDE for R called RStudio. It is worth checking out.
Tech savvy? Think again..
Do you think your group is forward thinking and tech savvy?
How about your customers? They are probably smarter than you think..
Can you describe cloud computing? What about when you were 10?
Our friends over at Accenture put this together.
SQL tip – Inner join shorthand with USING
We write a LOT of SQL here and although SQL is a powerful database language, it can be tedious. So here is one tip for shortening all that typing.
Typical join sytax:
select some_columns
from one_table join another_table on one_table.column_1 = another_table.column_1 and one_table.column_2=another_table.column_2
where some_column > someother_column ;
Not too bad, right?
In order for this tip to work, you must be joining on columns with the same name (ie. column_1 and column_2 have the same name in both tables).
Here it is:
select some_columns
from one_table join another_table using (column_1, column_2)
where some_column > someother_column ;
Now, in our example it's not a drastic difference in coding, but as any programmer knows, this shorthand example doesn't accurately represent the real world. So give this syntax a try on your next project and let us know if it doesn't save you some typing.
CRM technologies
As we begin to add posts in 2011, we stepped back to look at our business and our blog. We realized that the two are perfectly aligned. Although the majority of our focus is within the SAS product suite, our focus is marketing analytics and operations.
Given that, it is time for us to expand our commentary. So, in the coming weeks you will begin to see more content regarding some of our other technology partners including Teradata, Netezza and Unica.
If you have a question about a particular technology or topic, we'd love to hear from you. Comment below or email us a hello@afhood.com .
Developing an effective contact strategy
There are few things that seperate the good marketers from the bad. In our opinion contact strategy is one of those things that few organizations understand and all should consider. When you are trying to decide who you should contact, through what channels and how many times, here are a couple of things to think about.
1. Not all customers are created equal - Nor do they have the same appetite for your marketing efforts. We recommend you spend time looking at your customers and how many times you contacted them in the past. A good cluster analysis will begin to help you understand that some groups prefer 10 'sale' messages and 2 'partner' messages before opting out. Put this cluster with other customer breakouts and you have the basis for your contact strategy.
2. Not all messages are created equal - As we eluded to above, you can not simply look at the recency and frequency of your messages to determine how much is too much. You need to understand the message types or objectives. Customers have varying appetites for your credit card solicitations and that appetite is much different from your best customer sales messages.
3. Implementing your strategy may be harder than developing it - So now you know what you want to implement. Customer segment X gets Y transactional messages a month and Z surveys a month. But how do you insure that they only get what you've prescribed? There are a variety of ways to accomplish this with either process changes and / or technology solutions (One of our favorites is Unica's Optimize.).
If you are considering a contact strategy for your organization, we would love to help you understand your customers and improve your communications.
SAS / Teradata Fastexport – dbsliceparm = all
Fastexport is the fastest way to get large data out of teradata. Fastexport utilizes multiple connections to deliver data and therefore speeding up the transfer of data between Teradata and SAS.
Here are a few examples of fastexport.
/* libname statement*/
libname teradb teradata username=&un password=&pw dbsliceparm=all;
/* explicit sql */
proc sql;
connect to teradata(username=&un password=&pw dbsliceparm=all);
<SQL STATMENT>
quit;run;
How do you know if fastexport was used?
Use this option:
options sastrace=',,,d' sastraceloc=saslog;
If it is working, you should see something in your log like:
Select was processed with fastexport.
There are many other factors that come into play if fastexport doesn't work. Check the requirements on the SAS support page for troubleshooting.
Analyzing Paid/Owned/Earned Marketing
As more is written about various categories of marketing, we can't help but think analytically about the implications of approaching marketing problems given their categorical differences. Of late, much has been written about 3 specific communication or marketing types:
- Paid media
- Owned media
- Earned media
This breakout is logical, however any marketing breakout must be based on some common public thinking about 'channels'. Thus customers must interact and respond differently to those categories. During some of our most recent analysis, we found that applying some of our traditional segmentation matrices to the response indicators for these categories told a specific story for one client. Various customer types respond distinctively different and to varying degrees to each type of marketing.
Now this might not be ground breaking on it's appearance, but if an organization could understand it's customer base to the point of actioning it's marketing toward the most profitable segments within each category, therefore maximizing it's return in paid, owned, and earned, great efficiencies could be made. It would be apparent which channels need the most focus and are the most profitable for an organization.
In the case of owned or earned media, organizations could save large portions of marketing dollars from being wasted in the paid category by maximizing 'word of mouth'.
Yet I digress. All this to say, understanding one's customers and the preferred and most profitable interactions of those customers is what creates efficient and effective marketing. Paid, owned and earned is no Earth shattering new marketing breakout, but if this is how marketing thinks about it's channels, it is how analytics should organize to help them understand where their attention should be focused.
4 tips for integrating CRM technology
If you have worked with marketing technologies for any length of time, you've encountered this problem. How can we integrate our CRM with the rest of our organization? How does CRM interact with our call center, website, applications, database, loyalty system, etc., etc.
We've been there.
Throughout our travels, we've picked up a few tips. Hopefully they'll help you.
- Tight integration is dangerous. Just don't do it. - Marketing technology changes faster than fashion. Today's latest and greatest is quickly replaced with tomorrow's new market maker.
- Integrate through marketing concepts not technical application specs. - Abstracting technologies through the use marketing concepts like 'campaign', 'offer', 'contact history', 'registration', 'enrollment', etc. Define what these mean for the organization and build a data structure flexible enough for all applications to contribute to those concepts.
- Databases and services are the lifeline. - Long term success hinges on ease of use and flexibility. Simple services allow for plug and play scenarios. Well designed databases create environments that record interrelated transactions based on their role or concept. This makes business people happy. They can measure, analyze and predict without spending precious hours compiling, cleaning, and organizing data.
- Think replaceable. - Always remember that what you are adding to your technology stack could be replaced in a year and you will need to re-integrate something else. How much of your current work will be thrown away? Minimize the one-time development and maximize your efficiency and cost savings to the organization over the long haul.
We like to think we aren't integrating technology. We are simply making all of our applications play nicely together.
There is much more to this topic, but these 4 tips can minimize your stress for ears to come.
Default value to macro variable
NOTE: This is a great one we picked up from our friends over at the SAS community.
We have run across this literally hundreds of times while programming SAS macros. You need to have a default value for a variable and you don't want to write another macro to set it if it doesn't exist.
This simple fix allows you to check for a value and set a default even in open SAS code.
%global myParameter; /* ensure it exists */ %let myParameter = %sysfunc(coalescec(&myParameter,default-value));
Pure awesomeness..
Credit goes to Don Henderson and the SAS community for this one.
http://www.sascommunity.org/wiki/Tip_of_the_Day:October_12
