4月 192010
 
###################################################
# HOW TO DEFINE SQLITE FUNCTIONS WITHIN PYTHON    #
# ----------------------------------------------- #
# REFERENCE:                                      #
#  Chris Newman, SQLite, Sams Publishing          #
# ----------------------------------------------- #
# WISH LIST:                                      #
#  LOOKING FORWARD TO SUCH NEAT THING IN R        #
###################################################

import sqlite3
import math

# USE IRIS DATA AS AN EXAMPLE
con = sqlite3.connect("d:\mydb")
cur = con.cursor()

cur.execute("select * from mytab limit 3")

for row in cur:
  print row

# OUTPUT:  
# (5.0999999999999996, 3.5, 1.3999999999999999, 0.20000000000000001, u'setosa')
# (4.9000000000000004, 3.0, 1.3999999999999999, 0.20000000000000001, u'setosa')
# (4.7000000000000002, 3.2000000000000002, 1.3, 0.20000000000000001, u'setosa')

# DEFINE A MOD() FUNCTION  
def mod(x, y):
  return math.fmod(x, y)

# REGISTER THE FUNCTION
con.create_function("mod", 2, mod)

cur.execute("select sepal_length, mod(sepal_length, 2) from mytab limit 3")

for row in cur:
  print row

# OUTPUT:
# (5.0999999999999996, 1.0999999999999996)
# (4.9000000000000004, 0.90000000000000036)
# (4.7000000000000002, 0.70000000000000018)

# DEFINE A MEDIAN() AGGREGATE FUNCTION  
class median:
  def __init__(self):
    self.reset()

  def reset(self):
    self.values = []
    
  def step(self, val):
    self.values.append(float(val))

  def finalize(self):
    self.values.sort()
    n = len(self.values)
    if mod(n, 2) == 1:
      return self.values[n // 2]
    else:
      return (self.values[n // 2 - 1] + self.values[n // 2]) / 2

# REGISTER THE FUNCTION
con.create_aggregate("median", 1, median)

cur.execute("select species, median(sepal_length) from mytab group by species")
for row in cur:
  print row

# OUTPUT:  
# (u'setosa', 5.0)
# (u'versicolor', 5.9000000000000004)
# (u'virginica', 6.5)
 Posted by at 4:07 上午
4月 172010
 


When printing multiple files, or sorting multiple datasets, the traditional method is to write multiple steps as below. Proc print data=libref.ae; var _all_; run; Proc print data=libref.conmed; var _all_; run; Proc print data=libref.demog; var _all_; run; Proc print data=libref.lab; var _all_; run; Proc print data=libref.medhist; var _all_; run; If you are like me who likes to simplify the traditional SAS code here is the tip. CALL EXECUTE comes to rescue here. *Using Disctionary Tables and Call Execute; proc sql; create table dsn as select distinct memname from dictionary.tables where libname="LIBREF" and memtype="DATA"; quit; *Sorts all the datasets using Call Execute; data _null_; set dsn; call execute ("proc sort data=final.||'memname||';by usubjid; run;"); run; *Prints all the datasets using Call Execute; data _null_; set dsn; call execute ("proc print data=final.||'trim(memname)||';var _all_; run;"); run; *Using Proc Contents and Call...

[[ This is a content summary only. Visit my website for full links, other content, and more! ]]
 Posted by at 8:45 下午
4月 172010
 


When printing multiple files, or sorting multiple datasets, the traditional method is to write multiple steps as below. Proc print data=libref.ae; var _all_; run; Proc print data=libref.conmed; var _all_; run; Proc print data=libref.demog; var _all_; run; Proc print data=libref.lab; var _all_; run; Proc print data=libref.medhist; var _all_; run; If you are like me who likes to simplify the traditional SAS code here is the tip. CALL EXECUTE comes to rescue here. *Using Disctionary Tables and Call Execute; proc sql; create table dsn as select distinct memname from dictionary.tables where libname="LIBREF" and memtype="DATA"; quit; *Sorts all the datasets using Call Execute; data _null_; set dsn; call execute ("proc sort data=final.||'memname||';by usubjid; run;"); run; *Prints all the datasets using Call Execute; data _null_; set dsn; call execute ("proc print data=final.||'trim(memname)||';var _all_; run;"); run; *Using Proc Contents and Call...

[[ This is a content summary only. Visit my website for full links, other content, and more! ]]
 Posted by at 8:45 下午
4月 172010
 


Panelists (left to right):

  • Deb Orton, SAS, Moderator
  • Brad Fiery, Vice President, Database Marketing and Analytics, The Lacek Group
  • Heather Valteris, Vice President Database Marketing Center of Excellence, GE Capital – Retail Customer Finance
  • Theresa Kushner, Director, Integrated Customer Intelligence, Cisco Systems
  • Jim Foreman, Director of Circulation and Analytics, Staples, Inc.

It’s no secret to any marketer that we are seeing dramatic changes in the ways we approach and segment our audiences. We’ve never been able to gather more data about consumers, but we’re still faced with the challenge of how to use it. And consumers expect more and more from brand interactions. They want what they want when and how they want it.

In this panel at the SAS Global Forum Executive Conference, Deb Orton from SAS led a discussion of four seasoned marketing leaders in the brave new world of marketing, attempting to uncover the path to marketing success in a world of empowered consumers.

Deb began by asking the panelists what they’re seeing as the most dramatic changes in marketing. According to Heather, the consumer mindset is completely changing.

“Ten years ago our customers were telling us they were overloaded. Now, a lot of that noise is getting organized, in blogs and wikis and virtual communities.” Those communities have leverage and influence, she added.

“It’s not just the technology that’s changing, it’s the consumer mindset. As a marketer, how do you move to a customer engagement model? If you’re truly a customer-centric organization, that shouldn’t scare you, but not a lot of us are there yet.”

Heather also pointed to mobile as a key growth area. Mobile phones are already an e-commerce tool in Asia, for instance, and we’ll see that soon in North America as well, for shopping, for making payments, and as a way to distribute coupons and bar codes. Companies need to address how they will market to those channels.

Theresa emphasized the value of data, and real-time, thoughtful analytics. Data must be available to marketers 24 hours a day, seven days a week.

Battling data segmentation is a challenge, according to Brad. “Managing the complexity and scale can be daunting,” he said. “We’re moving toward real-time, point-of-behavior, interactive marketing.”

To differentiate yourself from your competitors, you need to add value and engage customers in the way they want to be engaged, and doing that properly requires an unprecedented level of creativity.

Customer expectations are becoming more sophisticated, Jim added. “Now you need a targeted message that relates specifically to them,” he said. “If you don’t have the infrastructure and support, you’ll pay the price.” You can amass huge amounts of data on your customers, but how does the personal message scale?

“Where we’ve gotten the most bang for the buck,” Jim said, “is layering other aspects on top.” Examine a customer’s buying pattern and see how it’s different from other customers.

You may have two customers who spend $5,000 a year in your store, but one might come into the store regularly and spend $500, and one might come in twice a year and spend $2,500. Those two customers may have an equal value to your company, but your message to each would be significantly different.

“It’s all about intelligent segmentation,” he concluded.

The panel also addressed the differences between B2B marketing and B2C marketing and found that there are obviously differences, but powerful similarities as well.

Jim pointed out the need to understand the people you are trying to market to, and use all the data at your disposal, combined with whatever behavioral and psychographic layers you can apply.

As to the differences between B2B and B2C marketing, he said, “The tenets are basically the same.”

Cisco is exploring the issue through social media, and looking at the places where business people are making decisions. The social media principles that make your message attractive and memorable for consumer audiences apply to business audiences as well.

In considering the B2B vs. B2C question, keep in mind that “every decision maker is a C in some shape or form,” Jim suggested. If a person has a particular bias or belief, they will have that both at home and at work.

But people act differently when they’re spending their own money versus the company’s money, he suggests. If you’re a one-person company, you’ll have a different set of wants and needs from an office supply company than a vice president with a large budget.

Deb added that the complexity of the decision and how many people are involved in the decision is a factor as well.

“As we come out of the recession we see more and more people involved in a buying decision,” she said. Having more internal stakeholders makes it even more valuable to engage multiple people at different levels of an organization.

Consumers not only want to be engaged and entertained, they also expect instant response to their questions and concerns. The always-on nature of the online world will only continue to increase that expectation. Customer analytics can help, suggested Brad.

When a customer calls an 800 number, he or she expects the rep on the phone to know that she’s submitted a request through the Web site. If she gets transferred to another rep, she expects that rep to have the history of her interaction.

“Consumers expect a relationship today,” he said.

Customer analytics helps you build scorecards for your customers, Brad said, that help you understand, for instance, their likelihood to travel, or to join a loyalty program.

“We’re looking at using SAS to take those scorecards and optimize those experiences for all the customers and make a seamless and instant interaction with the customer to drive more transactions.”

The need for customer analytics is fluid, Heather added.

“We think of segmentation as static, but we need to think about where customers are going, because we need to get there first,” she said.

“Modeling in terms of behavior is critical. It’s really tough to get your data and your technology lined up. You’ve got to automate it and put rules in place.”

Centers of excellence, like the one Heather leads for GE Capital, can play an important role in driving these innovations and sharing the knowledge across organizations.

“Every day we need to make a business case to our internal customers about why they should invest in us,” Heather said. “It’s dangerous to have the attitude that you know best and the rest of the organization has to listen to you.”

Know what can be centralized and what can’t, advises Brad. “The key is to centralize what you can for cost advantages and de-centralize what’s critical for strategic advantage.”

Even if you don’t centralize, you can still coordinate, according to Theresa. “Understand where the pockets of analytics are in your company,” she advised. “We have to build an organic organization and a community of analysts.”

The Whats, Whys, and Wherefores of Topic Discovery and Management: Part One

 Jim Cox  The Whats, Whys, and Wherefores of Topic Discovery and Management: Part One已关闭评论
4月 162010
 
Those of you who have seen the new version of SAS Text Miner know that we are transitioning from a “document clustering” approach towards a “topics in documents” approach. I have received a lot of questions about this, so I thought I would address some of them in a multi-part series on this blog. This is part One.

An obvious question is: How do document "topics" and "clusters" differ?

Well, thanks for asking! The simple answer is that documents are characterized by exactly one cluster, but they contain zero or more topics. Okay, let’s try an exercise: look around your room and take note of where everything is positioned. Now imagine that the room is totally empty. Assume you have a collection of documents, perhaps letters that you have received in the mail, and you can put each one anywhere in the room that you like, without worrying about gravity or anything else --- they will always stay exactly where you place them. Furthermore, you want to arrange them so that similar documents are close to each other, while very different documents are far apart.

Now, the way you want to arrange the documents depends on the purpose of the arranging. One way is to set them up so that different parts of the room correspond to ideas characterizing each document in that part of the room. For example, all the documents in the left corner are letters to/from my sister Sally, all the documents in the right upper left are bills that I need to pay, etc. This corresponds to a “Text Clustering” exercise. You are putting every document in a single category of interest. But things become complicated if you have letters that belong to more than one category. For example, if you are renting your home from your sister Sally and you receive a bill from her, where do you put that?

This leads to the alternative approach where you arrange the documents along “dimensions”or directions of interest. Assume that the room is rectangular, and one wall points directly North. In this case, there are three directions --- East to West, North to South, and Floor to Ceiling. You might then decide to represent your documents by three dimensions, say: Business correspondence goes North, Personal Correspondence goes East, and important correspondence near the floor (e.g. Junk mail at the ceiling, a letter from the utility company threatening to cut off your water tomorrow at the bottom). So your rent bill from your sister Sally would go North-East near the bottom, while the personal letter might go South-East somewhere midway between floor and ceiling since the importance is not all that relevant. This alternative approach corresponds to Document topics.

Some of you may know that in SAS Text Miner, we have a way of semi-magically creating this space, which could be many more than the three dimensions in this toy example. It is called the Singular Value Decomposition (or SVD) and it has the mathematical property that it creates an N-dimensional space that is proven to lose as little information as possible when converting (or projecting) documents in this space. Furthermore, the SVD plays a prominent role in both document clustering (as in the original Text Miner Node) and in topic modeling, as in the Text Topic Node that is new in SAS Text Miner 4.2. But more about that in the next part in this series. Stay tuned. I'll post it sometime next week.

Learning from Our Learners: Education’s Customer Summit

 Herb Kirk, SAS customers, sas education, SAS Global Forum Takeaways, sas training  Learning from Our Learners: Education’s Customer Summit已关闭评论
4月 162010
 
For a service organization like ours, there are few things more valuable, let me correct that, nothing is more valuable, than feedback from our users. We are really lucky in this regard; SAS users are not bashful about sharing their opinions when it comes to “their” software.

We certainly benefited from this during Education’s 4th annual Global Forum Customer Summit. The Education Customer Summit brings in 20 or so of our largest customers to discuss training issues and to hear how well we are meeting their business needs. From past summits, we have had such revolutionary ideas as Fast Track courses (several courses combined into one 5-day course) and a suggestion to present our curriculum by job role to help customers identify courses they need to become more efficient SAS users.

This year’s feedback and ideas were equally valuable. The information we gathered during this two-hour session will help drive our work for the rest of the year. I thought I’d share some of the valuable feedback we received.

Lights, Camera, Action
One interesting idea was a request for a SAS Education Infomercial. (I have to admit I was a little surprised to hear this one!)

It turns out that many of the participants at the summit are the primary SAS expert at their site, and by default, the one who receives questions from colleagues interested in taking SAS classes. Our summit participants said that an introductory video from SAS Education would make their jobs easier by outlining all of our training offerings and delivery methods for their colleagues and keeping subsequent conversations focused on content rather than about what SAS Education has to offer.

One user even suggested the infomercial would be very helpful for him to advance SAS within his organization. He said that executives in his company really didn’t know about the power of “new SAS” and all of the capabilities of the new platform.

One size fits all?
We currently offer customized training, but we have also tested the idea of a new “plus one mentoring.” This idea involves leaving an instructor at a site an extra day or two to lead the customer through one-on-one mentoring engagement using their data and addressing real business problems unique to the organization. There was unanimous support for this service among customers. We’re fired up about it too because it would give our instructors real life, industry-specific problems to solve which would be helpful in teaching future classes.

We also asked our users to brainstorm courses they’d like to see Education create in the near future. There were a number of suggestions, but the most intriguing might have been the request for more robust training in support of SAS’ complementary products. Specifically mentioned were courses on “how to use SAS on top of Teradata” and “how to use SAS on top of Oracle.” We’ll scope these out completely in the next few weeks.

Finally, we tested the idea of a new SAS Training offering called our Deployment and Migration Service. These customized courses would help companies who are considering or have recently migrated to SAS 9.2 learn how to deploy the system on a broad scale or migrate their current applications to the new platform. Because the course would teach IT professionals how to provide these services in a widespread way, it would help them deploy and migrate other departments or groups within their company.

Let me close by saying how incredible it was to get this feedback from our users. Not only did we get great ideas for future work to improve our business, but our users really appreciated the opportunity to share with us what we were doing right, where we could improve and what topics they'd like to see us pursue.

We’re looking forward to implementing some of their suggestions.


Regards,

Herbert Kirk, Vice President, SAS Education
4月 162010
 
We can use data _null_ to write a customized cover letter in job application.


options nodate nocenter nonumber  LEFTMARGIN=1in RIGHTMARGIN=1in TOPMARGIN=1in BOTTOMMARGIN=1in; ;
title;footnote;

%let N1=Chen Junfang;

data company;
input person $20.
/title $20.
/ company $20.
/ address $20.
/ contact $20.
/ require1 $80.
/qual1 $80.
;
cards;
John Kennedy
Supervisor
monsanto
Apt 23, Jackson Dr.
afdfafadfa@dfdf.com
SAS Macro and SQL
I know SAS Macro and SQL
;
run;
ods pdf file='d:\Charlie_cl3.pdf' style=statdoc;
data _null_;
set company;
file print pagesize = 70 linesize = 80;

put @50 "Chao(Charllie) Huang" /
@50 "Apt27, N Husband " /
@50 "Stillwater, OK"/
@50 "74075" /
@1/
@1 "&sysdate9." /
@1 /;
put @1 person $20.;
put @1 title $20.;
put @1 Company $20.;
put @1 address $20.;
put @1 Contact $20.;
put @1/ "Dear &person ";
put @1 "My friend, &n1, suggested me to apply for this post. With the job description of this opening, I believe that my educational background in statistics, along with my professional experience, makes me an excellent candidate for this position."/
@1/
@1 " Your requiement" @40 "My qualification" / ;
put @1 "--------------------------------------------------------------------" / ;
put @1 require1 $40. @40 qual1 $40.;
put @1/;
put @1 "If you have questions, or if you want to schedule an interview, please contact me at 405-269-6033. I look forward to meeting you to further discuss employment opportunities with COMSYS SAS Practice. "/
@1/;
put @1 "Sincerely,"/
@1 /
@1 "Chao(Charlie) Huang"/

;run;
ods pdf close;

4月 162010
 
To those who joined us in Seattle this week for SAS Global Forum or SGF Executive Conference, thank you! We had a wonderful time meeting you all during the few exciting and exhausting days we had together. And to those who missed being with us in person, we hope you were able to follow along with the live webcasts and Twitter streams (and we hope to see you next year).

Over the next week or so we’ll be publishing a number of posts related to the event (highlights, session recaps, lessons learned, and more). But before we do, here is a summary of the customer intelligence activities during the week.

Sunday, April 11: 9:00 p.m.
SAS Seattle Tweetup! at Tap House Grill, 1506 Sixth Avenue, Seattle, WA

What a great Tweetup. The venue, with 160 beers on tap and an unexpectedly large and inviting space, was a perfect setting for our group.

The list of journalists, bloggers, analysts and influencers in attendance reads as a who's-who of social media and social CRM. To mention a few: Queen of Measurement Katie Paine. New Marketing Labs general manager Justin Levy. Marshall Lager, President of The Third Idea (he forgot the first two ideas – but the third one works great). Noted author and CRM authority Paul Greenberg. David Myron, Editor in Chief of CRM Magazine. Alex Williams, a senior editor at ReadWriteWeb. Joshua Greenbaum. Research Analyst, Speaker and Consultant, Esteban Kolsky. CRM analyst, Denis Pombriant. Brent Leary, Co-founder and Partner of CRM Essentials. Social Media Strategists Wayne Sutton and Shannon Paul. Dave Evans, author of Social Media Marketing: An Hour a Day. And on. And on.

From SAS, we had our Social Media Analytics mavens John Bastone and Mark Chaves. SAS marketing management, including Adele Sweetwood and Deb Orton. SAS Social Media manager David B. Thomas. Our editor of blogs and social content, Alison Bolen. SAS Customer Intelligence PR managers Angela Lipscomb and Mike Nemecek. Peter Dorrington, SAS EMEA marketing. And many others.


Monday, April 12: 8:00 a.m.
SAS Social Media Analytics Solution Launch at the Washington State Convention & Trade Center

You never know exactly how a launch will be accepted, but so far, so good. A Google search for “SAS social media analytics” turns up hundreds of positive news results and mentions; here are a few worth highlighting:

  • Katie Paine (@kdpaine), CEO of KDPaine & Partners, wrote “when I started KDPaine & Partners 8 years ago, I had in mind a system that would somehow, (I didn't know how at the time) connect the dots between outputs and outcomes. That's what [SAS Social Media Analytics] does.” (From KDPaine finally finds an automated analysis tool she can love.)

  • Louis Columbus (@LouisColumbus), Market & industry analyst, blogger, market researcher & strategist, commented on the execution of the launch, saying “Televising the launch event live…was a brilliant decision.” Louis went on to conclude that “SAS has set a new standard on how to successfully launch a new service using social media.” (From Lessons Learned from the SAS Launch of Social Media Analytics.)

  • Paul Greenberg (@pgreenbe), author of the best-selling CRM at the Speed of Light: Essential Customer Strategies for the 21st Century, commented “not only has SAS released a truly excellent social media analytics product - a unique one in fact, but they have attacked the market and their own culture in a way that has transformed the company to something new and perhaps equally as good as their “place to work” accolades indicate.” (From SAS's Coming Out Party - Analyze This!)

  • Shannon Paul (@ShannonPaul), marketing and social media strategist, wrote “…the just-launched SAS Social Media Analytics platform looks to be the most comprehensive, in-depth social media monitoring and analytics platform I’ve seen yet…” (From SAS Social Media Analytics Product Launch: Initial Thoughts.)

Continue reading "Customer Intelligence and SAS Social Media Analytics at SAS Global Forum"

SAS CMO Jim Davis Talks about SAS Social Media Analytics, Technology

 analytics, dave thomas, Inside SAS Global Forum, jim davis, social media analytics  SAS CMO Jim Davis Talks about SAS Social Media Analytics, Technology已关闭评论
4月 142010
 

Dave Thomas interviews SAS CMO Jim Davis at SAS Global Forum 2010 in Seattle. Davis talks about the launch of SAS Social Media Analytics and the apparently awakening over analytics even in a tough economy.

Web Links:
YouTube:
http://www.youtube.com/watch?v=-ZgSLLIkAgE

SAS.com:
http://www.sas.com/apps/webnet/SGF2010VideoBlog/index.html?videoID=isgf10episode12

4月 142010
 

SAS CEO Jim Goodnight talks about SAS' new offerings in High Performance Computing and Social Network Analysis, price changes for SAS OnDemand for Education and this year's SAS Global Forum conference in Seattle.

Web Links:
YouTube:
http://www.youtube.com/watch?v=zBdv5ofvaGk

SAS.com:
http://www.sas.com/apps/webnet/SGF2010VideoBlog/index.html?videoID=isgf10episode11