Jiangtang('Jiang') HU
Jan 3, 2010
Blog Moves to Wordpress
Jiangtang('Jiang') HU
Dec 4, 2009
Work With Oracle: A Quick Sheet for SAS Programmers
(Note: All the followings are tested on Windows XP environment.)
0. Install Oracle Database 10g Express Edition
Fast (and free) to download, easy to deploy and simple to admin--for learning and testing purpose, Oracle Database 10g Express Edition (Oracle Database XE, a mini version of Oracle Database 10g Release 2) are strongly recommended:
0.1 Download it at its homepage(206MB);
0.2 Install it following default settings;
0.3 Unlock accounts for HR and SCOTT. In a windows DOS prompt, using the following scripts:
sqlplus sys/YourSysPassword as sysdbaalter user HR account unlockalter user HR identified by YourHRPasswordalter user SCOTT account unlockalter user SCOTT identified by TIGER
Or you can accomplish these tasks within the Oracle web application:
http://localhost:8081/apex
1. Connect Oracle using SAS libname engine
libname SCOTT oracle user="SCOTT" password="TIGER" path='xe' ;
Note: xe is the default path for Oracle Database XE.
2. Connect Oracle using SQL Procedure Pass-Through Facility
proc sql ;
connect to oracle as orcl
(user="SCOTT" password="TIGER" path='xe');select *
from connection to orcl(
SELECT …
) ;
disconnect from orcl;
quit;
Note: 1) In this approach, Oracle, instead of SAS, processes the SQL statement (i.e., you use the more powerful and flexible Oracle SQL syntax instead of SAS Proc SQL procedure for querying. For more, see SAS Doc).
2) Your Oracle SQL codes should be placed in the RED blocks, and end without a semicolon(;):
select *
from emp
3) Only basic Oracle SQL statements (select, create table, . . .)can pass through this facility.
3. Load SAS datasets to Oracle database
proc copy in=sashelp
out=scott;
select class;
run;
4. Misc: Some differences between Oracle SQL and SAS Proc SQL
4.1 Table aliases
Oracle: from employees a;
SAS: from employees a; or
from employees as a;
4.2 Column aliases
Oracle: don’t use single quotation marks(‘’).
select job_id as job, job_id job, job_id as "job" ,
job_id as ‘job’
SAS:
select job_id as job, job_id "job" , job_id 'job',
job_id job
4.3 Literal Character Strings
Oracle: Date and character literal values must be enclosed within single quotation marks(‘’).
SAS: Use both single and double quotation marks.
4.4 Order the null value
Oracle: Null values are displayed last for ascending sequences and first for descending sequences.
SAS: Null values are displayed first for ascending sequences and last for descending sequences.
4.5 Nesting Group Functions
select max(avg(salary))
from employees
group by department_id
SAS log:
Optional approach for SAS:ERROR: Summary functions nested in this way are not supported.
select max(avg) as max
from(
select avg(salary) as avg
from employees
group by department_id )
4.6 row number(_n_)
Oracle:
select rownum
from employees
SAS:
select monotonic()
from employees
Note: monotonic() is an undocumented function of SAS, seehttp://www2.sas.com/proceedings/sugi29/040-29.pdf
Mar 20, 2009
Run data mining codes following William Potts
Mar 2, 2009
Feb 17, 2009
Jan 13, 2009
FYI: Dashboard using SAS/Graph

see, http://support.sas.com/kb/26/134.html
- Slider chart indicator:
- Slider chart dashboard:
- Bullet graph indicator:
- Bullet graph dashboard:
- Dial meter indicator:
- Dial meter dashboard:
- Bar chart indicator:
- Bar chart dashboard:
- Telesales dashboard:
- Web marketing analysis dashboard:
You would also like, Santa's Dashboard:
http://jiangtanghu.blogspot.com/2008/12/santa-and-sas-again-santa-dashboard.html
R or SAS: Quick Links to the Recent Debates
Original post, 7 Jan, 2009
Key Point
A Controversial Review by Anee Milley from SAS
7 Jan, 2009, SAS-L
7 Jan, 2009, R-help
8 Jan, 2009, Ashlee Vance's blog
9 Jan, 2009, SAS Consulting
9 Jan, 2009, Anee Milley
For more, see Google Blog Search.
Jan 6, 2009
Options Pricing Using SAS
There are some new financial functions in SAS9.2 Base, including 8 options pricing functions(formerly in SAS Risk Dimension). These functions can compute the price of both call and put options on different underlying assets (stock, futures, currency, and exchange asset), using the following models respectively:
- Black-Scholes model,the traditional stock options pricing model, see Fischer Black and Myron Scholes (1973) ;
- Black model,extension of Black-Scholes model on futures option (also called Black-76 model),see Fischer Black(1976);
- Garman-Kohlhagen model,pricing model on foreign currency options,see Mark Garman and Steven Kohlhagen(1983) ;
- Margrabe model,on exchange options,see William Margrabe(1978).
| Model | Underlying | Call | Put |
| Black model | Futures | BLACKCLPRC | BLACKPTPRC |
| Black-Scholes model | Stock | BLKSHCLPRC | BLKSHPTPRC |
| Garman-Kohlhagen model | Currency | GARKHCLPRC | GARKHPTPRC |
| Margrabe model | Exchange | MARGRCLPRC | MARGRPTPRC |
- BLACKCLPRC: calculates the call price for European options on futures, based on the Black model.
- BLACKPTPRC: calculates the put price for European options on futures, based on the Black model.
- BLKSHCLPRT: calculates the call price for European options, based on the Black-Scholes model.
- BLKSHPTPRT: calculates the put price for European options, based on the Black-Scholes model.
- GARKHCLPRC: calculates the call price for European options on currencies, based on the Garman-Kohlhagen model.
- GARKHPTPRC: calculates the put price for European options on currencies, based on the Garman-Kohlhagen model.
- MARGRCLPRC: calculates the call price for European options on exchange assets, based on the Margrabe model.
- MARGRPTPRC: calculates the put price for European options on exchange assets, based on the Margrabe model.
For more,see SAS9.2 online help,Functions and CALL Routines by Category: Financial:
http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000245860.htm
Note: A good web site for options pricing with different models, http://www.montegodata.co.uk/
Jan 1, 2009
Happy New Year
Bonne Année,
Nav varsh ki shubh kamnayey,
Felice Anno Nuovo,
Feliz Año Nuevo,
Feliz Ano Novo,
明けましておめでとうございます (Akemashite Omedetô),
Gelukkig Nieuwjaar,
Szczęśliwego Nowego Roku,
Καλή Χρονιά (Kalí Chroniá),
Seh Heh Bok Mani Bat Uh Seyo,
חג חנוכה שמח (Hag Hanukkah Sameah),
Cчастливого Нового Года,
Dec 25, 2008
Links: Risk Intelligence Vendors Review: 2008
FinTech100(2008)
Dec 24, 2008
Links--BI Industry 2008: Review and Prospect
/*Thanks the hints supplied by:
A look back at 2008 and some crystal ball predictions..., byTammi Kay Geroge, from SASBlog*/
Major Data Warehousing Events of 2008 (and Predictions for 2009), by Michael Schiff, from TDWI,
Major Data Warehousing Events of 2008:
- Everyone had an appliance story
- Industry consolidations continued
- The recessionary environment encourage further BI developments
- Open source grew
Predictions for 2009:
- Further industry consolidation(Informatica by HP, SPSS by SAP)
- Cloud computing will come down to earth
- Open source growth will accelerate
- The IT world will become greener
- Major emphasis on solutions rather than tools and technology
BusinessIntelligence Tools: Year in Review,by Cindi Howson, from BeyeNetwork
Top Virtualization Trends for 2009, by John Suit, from ZDNet
Surround the Warehouse: Prediction for 2009 , by Neil Raden, from IntelligentEnterprise
Dec 19, 2008
Industry Review: SAS and Teradata Partnership
SAS and Teradata Partnership: Press
- Leading Companies See Value in SAS and Teradata Partnership
- SAS and Teradata Unveil Advantage Program to Bring Powerful In-Database Solutions and Services to Customers
- SAS and Teradata Enter into Strategic Partnership
In BI industry, the pure players such as SAS, Teradata and Microstrategy, need to demonstrate their indispensable values against the megavendors, IBM (acquired Cognos), SAP (acquired Business Object), Oracle (acquired Hyperion) and Microsoft. Teradata is solely focused on enterprise data warehouse. SAS, dominating in business analytics (e.g. advanced statistics and data mining), will check and balance the BI industry due to the private-hold structure. SAS and Teradata Advantage Program partnership, includes wide business lines, such as Analytics, AML (Anti-Money Laundering), Credit Risk, Enterprise Intelligence and Optimization Services. I think It's a effective way to learn from each other in mutual emulation and counterbalance the concentration market.
Dec 18, 2008
Santa and SAS Again: Santa's Dashboard
(santaDashBoard.png, With permission by Mr. Robert Allison)
Merry Christmas again. SAS marketing staff started up an interesting Christmas campaign on how Santa operates his workshop. Here is another wonderful work about Santa's Dashboard, created by SAS senior R&D staff, Robert Allison.
Robert is a master of graphics and visualization. You can view his SAS/Graph examples in the following link:
Dec 17, 2008
The Making of an Analyst: A Supplement to What Makes a Good Business Analyst
Dec 16, 2008
Learn Time Series Analysis: Free Materials for SAS Users
1. Forecasting an Autoregressive Progress
2. Forecasting a Moving Average Process
3. Forecasting a Seasonal Process
4. Seasonal Adjustment and Forecasting
5. Forecasting with Transfer Function Models
6. Forecasting with Intervention Models
7. Forecasting Multivariate Time Series
8. Preparing Time Series Data for Forecasting
9. Using Macros for Forecasting Tasks
10. Fitting and Forecasting a Linear Model by OLS
11. Testing Forecasting Models for Break Points with Chow Tests
12. Fitting and Forecasting Linear Models with Linear Restrictions
13. Fitting and Forecasting a Linear Model with an AR Error Correction
14. Fitting Linear Models with Heteroscedastic Error Terms
15. Fitting Linear Models with ARCH-GARCH Error Terms
16. Assessing Forecast Accuracy
17. Forecasting Using a Lagged Dependent Variable Model
18. Static and Dynamic Forecasting Using a Lagged Dependent Variable Model
19. Fitting and Forecasting Polynomial Distributed Lag Models
20. Fitting and Forecasting Restricted Polynomial Distributed Lag Models
21. Fitting and Forecasting a Linear System by SUR and ITSUR
22. Testing and Restricting Parameter Estimates in a Linear System Forecast
23. Producing Goodness-of-Fit Statistics for Forecasts of a Linear System o
24. Fitting a Linear System by Instrumental Methods
25. Linear System Diagnostics and Autoregressive Error Correction
26. Creating Forecast confidence Limits with Monte Carlo Simulation
27. Fitting and Forecasting a Nonlinear Model
28. Restricting and Testing Parameters of a Nonlinear Forecasting Model
29. Producing Forecasts Automatically Using the Time Series Forecasting Sys
30. Developing Forecasting Models Using the Time Series Forecasting System
Dec 14, 2008
Delivers the Right Toys and Goodies to the Right Boys and Girls: Story of Santa and SAS
How to purchase toys and goodies with a balance of costs and profits? and how to deliver them more efficiently?
There are lots of questions in the list of Santa, CEO of Santa's Workshop. SAS's marketing staff held a very creative champion for the coming Christmas. You can watch the interview with Santa in youtube.com, or read the success story about Santa, Santa's Secret: Magic? No. It's SAS(R) Business Analytics.
Merry Christmas.
If You Can Make it Here, You Can Make it Anywhere: On What Makes a Good Business Analyst by Rajan Chandras
- Ability to think abstractly, identify patterns, and generate ideas and solutions
- Understanding of when and how to escalate issues or needs
- Understanding of and ability to delivery the appropriate level of detail needed for each task
- Interest in exploring and understanding new concepts and topic areas
- Emotionally invested in the work
- Ability to learn by shadowing stakeholders
- Ability to clearly articulate technology in terms stakeholders can understand
- Understanding of the organizational culture and its impact on processes and projects (this one seems obvious, but the latter phrase is more profound than might seem at first glance)
- Ability to drive a decision analysis and selection process
- Ability to recognize patterns in requirements and categorize them appropriately
- Know the organization's external environment: its competitive position, current state of the industry, geographical & social factors, etc.
- Know the organization's internal environment: its financial position, organization culture, IT maturity, etc.
- Adapt to the needs (your language, dress etc.), but be yourself. Imperfect, yet genuine, is fine; falsity comes through easily, and will destroy your credibility in no time.
Dec 13, 2008
Data Mining in Stock Market
I know I might hold some academic doctrines, so I have interest to monitor any effort to try to forecast stock prices using data mining techniques. Some links from a popular data mining blog , Data Mining Research, are listed as follows:
Dec 10, 2008
Haiku from SAS R&D staff
First prompts are silent.
Subsequent prompts loud and clear.
Now all prompts are heard.
Poem from R&D staff?
Yes. Rhyming sonnets were shakespeare-like complex;
they wrote Japanese haiku, showed as above.
The SAS R&D staff should complete some paper work in defects system before changing a code. They use informal descriptive language(HAIKUUU!) in the early stage. Chris Hemedinger, a senior software engineer at SAS, collected some haikus in his blog to show the humor side of SAS R&D staff. It's interesting to cite one of the most famous haikus by Matsuo Bashō for comparison:
Old pond
a frog jumps
the sound of water
Happy grow up
Happy hearts and happy faces,I read this verse in W. Bennentt's popular book, The Book of Virtues, during the bus-to-company time this morning. It's interesting to read Stevenson's Treasure Island, of course in Chinese edition when I was young.
Happy play in grassy places--
-Good and Bad Children by Robert Louis Stevenson
