What’s New in SAS 9
Rick Langston
SAS Institute Inc.
Platform R&D Division
Rick.Langston@sas.com
Copyright © 2002, SAS Institute Inc. All rights reserved.
Outline
The Billy Ts
So many things, so little time
ANYDATE
MP/Connect
DATA step
Threads and PROC SUMMARY
Copyright © 2002, SAS Institute Inc. All rights reserved.
Outline continued
ODS
Release Schedule
Summary (not PROC SUMMARY)
Copyright © 2002, SAS Institute Inc. All rights reserved.
Copyright © 2002, SAS Institute Inc. All rights reserved.
Billy T. ?
Copyright © 2002, SAS Institute Inc. All rights reserved.
William T.?
Usability
Scalability
Interoperability
Manageability
Four Pillars
Copyright © 2002, SAS Institute Inc. All rights reserved.
Copyright © 2002, SAS Institute Inc. All rights reserved.
The Intelligence Value Chain
Copyright © 2002, SAS Institute Inc. All rights reserved.
Copyright © 2002, SAS Institute Inc. All rights reserved.
SAS ® 6.09 Usability Experience…circa 1990
Copyright © 2002, SAS Institute Inc. All rights reserved.
SAS ® Usability Experiences Today
Copyright © 2002, SAS Institute Inc. All rights reserved.
Usability – SAS ® 9
SAS ® Web Report Studio
Copyright © 2002, SAS Institute Inc. All rights reserved.
Usability – SAS ® 9
SAS ® Enterprise Guide 2.0
Compatible with
New analytic
More controls
New Graph styles
New extensibility
Copyright © 2002, SAS Institute Inc. All rights reserved.
Interoperability in SAS ® 9
SAS ® XML Mapper
Import XML documents to SAS
® data sets
Export SAS
® data sets to XML documents
XML Map extensions add flexibility & power to schema definitions
Java
® to SAS
GUI maps XML
® data & viceversa
Java-based SAS
®
XML Mapper client
Copyright © 2002, SAS Institute Inc. All rights reserved.
Copyright © 2002, SAS Institute Inc. All rights reserved.
So many things...
Not enough time for everything!
SQL improvements
OLAP
SPDS
SAS Management Console
Metadata Servers
Copyright © 2002, SAS Institute Inc. All rights reserved.
“ANYDATE” informats
ANYDTDTE, ANYDTDTM, ANYDTTME
Handles most acceptable input d/t/dt informats mdy ambiguities handled
Copyright © 2002, SAS Institute Inc. All rights reserved.
Copyright © 2002, SAS Institute Inc. All rights reserved.
1 data _null_;
2 input x: anydtdte20.; list; put x=date9.; cards; x=01JAN2002
3 01jan2002 x=31DEC2002
4 12/31/2002 x=01MAY2002
5 may2002 x=01JAN2002
6 01jan2002:12:34:56 x=01JAN2002
7 2002-jan-01 x=01JAN2002
8 2002001
11 options datestyle=mdy;
12 data _null_;
13 input x: anydtdte20.; list; put x=date9.; cards; x=02JAN2003
14 01/02/03 x=31DEC2002
15 12/31/2002 x=31DEC2002
16 31/12/2002 x=19MAR1955
17 55/03/19 x=19MAR1955
18 19/03/55
19 run;
20
Copyright © 2002, SAS Institute Inc. All rights reserved.
Copyright © 2002, SAS Institute Inc. All rights reserved.
21 data _null_;
22 input x: anydtdtm20.; list; put x=datetime.; cards; x=01JAN02:12:34:56
23 01jan2002:12:34:56 x=01JAN02:00:00:00
24 01jan2002 x=01JAN60:12:34:56
25 12:34:56
28 data _null_;
29 input x: anydttme20.; list; put x=time8.; cards; x=12:34:56
30 01jan2002:12:34:56 x=0:00:00
31 01jan2002 x=12:34:56
32 12:34:56
Copyright © 2002, SAS Institute Inc. All rights reserved.
New in Connect
MP connect is not new, but we are still “getting the word out”
PIPES are new….
– hook your job steps together without using work files
Copyright © 2002, SAS Institute Inc. All rights reserved.
signon mp1 sascmd="!sascmd"; signon mp2 sascmd="!sascmd"; rsubmit mp1 wait=no; libname temp 'c:\temp'; data newbig; set sashelp.class; do index = 1 to 10000; rand = put(100000 * uniform(123), Z6.0); output; end; run; proc sort data=newbig out=temp.bigsort; by rand; run; endrsubmit;
Copyright © 2002, SAS Institute Inc. All rights reserved.
rsubmit mp2 wait=no; libname temp 'c:\temp'; data newbig2; set sashelp.class; do index = 1 to 10000; rand = put(100000 * uniform(567), Z6.0); output; end; run; proc sort data=newbig2 out=temp.bigsort2; by rand; run; endrsubmit; waitfor _all_ mp1 mp2; signoff mp1; signoff mp2;
Copyright © 2002, SAS Institute Inc. All rights reserved.
SAS9 Common BI Infrastructure
Dev Env.
SAS®
AppDev
Studio
Portal
SAS®
Information
Delivery
Portal
Java Based BI Tools
SAS® Information
Map Studio
SAS® Management Console
SAS® Web
Report Studio
SAS® ETL Studio
Windows Based BI Tools
SAS®
Enterprise
Guide
SAS®
Add-in for
MS Office
SAS Java Components
Re-usable COM Components
JNI – Interfaces
SAS Query and Reporting Services
Business Metadata Query Reporting
System Mgmt
Open Metadata (OMS)
Copyright © 2002, SAS Institute Inc. All rights reserved.
SAS Foundation Services
Connection User Information
SAS Servers
Workspace Server Stored Process
Event
Data Storage
Copyright © 2002, SAS Institute Inc. All rights reserved.
SAS 9.1.3 Shipping!
libname temp 'c:\temp'; data temp.merged; merge temp.bigsort(in=mp1) temp.bigsort2(in=mp2); by rand; if mp1 and mp2; run; proc datasets library=temp kill; run; quit;
Copyright © 2002, SAS Institute Inc. All rights reserved.
signon mp1a sascmd="!sascmd"; signon mp1b sascmd="!sascmd"; signon mp2a sascmd="!sascmd"; signon mp2b sascmd="!sascmd"; rsubmit mp1a wait=no; libname pipe1 sasesock ":pipe1"; data pipe1.newbig; set sashelp.class; length rand $8; do index = 1 to 10000; rand = put(100000 * uniform(123), Z7.0); output; end; run; endrsubmit;
Copyright © 2002, SAS Institute Inc. All rights reserved.
rsubmit mp1b wait=no; libname pipe1 sasesock ":pipe1"; libname pipe2 sasesock ":pipe2"; proc sort data=pipe1.newbig out=pipe2.bigdata1; by rand; run; endrsubmit; rsubmit mp2a wait=no; libname pipe3 sasesock ":pipe3"; data pipe3.newbig; set sashelp.class; length rand $8; do index = 1 to 10000; rand = put(100000 * uniform(123), Z7.0); output; end; run; endrsubmit;
Copyright © 2002, SAS Institute Inc. All rights reserved.
rsubmit mp2b wait=no; libname pipe3 sasesock ":pipe3"; libname pipe4 sasesock ":pipe4"; proc sort data=pipe3.newbig out=pipe4.bigdata2; by rand; run; endrsubmit;
Copyright © 2002, SAS Institute Inc. All rights reserved.
libname pipe2 sasesock ":pipe2"; libname pipe4 sasesock ":pipe4"; data merged; merge pipe2.bigdata1(in=mp1) pipe4.bigdata2(in=mp2); by rand; if mp1 and mp2; run; signoff mp1a; signoff mp1b; signoff mp2a; signoff mp2b;
Copyright © 2002, SAS Institute Inc. All rights reserved.
New in the DATA step
– New Functions
– Perl Regular Expressions
– DATA step Hash Tables
Copyright © 2002, SAS Institute Inc. All rights reserved.
String Concatenation Functions call symput('pat' || trim(left(put(total,BEST12.))) || trim(left(put(bycount,BEST12.))),
'pattern'|| trim(left(put(total,BEST12.))) || trim(left(put(bycount,BEST12.))) ||
' c=pink v=solid ;'); call symput(cats('pat', total, bycount), cats('pattern', total, bycount,
' c=pink v=solid ;'));
Copyright © 2002, SAS Institute Inc. All rights reserved.
String Concatenation Functions a = cat("x ", 12.3, " y"); b = catt("x ", 12.3, " y"); c = cats("x ", 12.3, " y"); d = catx("/","x ",12.3," y");
/* "x 12.3 y" */
/* "x12.3 y" */
/* "x12.3y" */
/* "x/12.3/y" */
Copyright © 2002, SAS Institute Inc. All rights reserved.
Sorting Values data s; array v[50]; set a; call sortq(of v1-v50); data s; array v[50]; set a; call sortq(of v50-v1);
Copyright © 2002, SAS Institute Inc. All rights reserved.
Median and Percentile
y = median(5,8,0,3,4);
/* y is 4 */
lower_quartile = pctl(25,2,4,1,3);
/* lower_quartile is 1.5 */
Copyright © 2002, SAS Institute Inc. All rights reserved.
PUT to LOG == PUTLOG data _null_; file names; input lastName $; put lastName; if lastName =: 'J' then putlog 'NOTE: J last name, ' lastName; datalines;
Harris
Jones
;
Copyright © 2002, SAS Institute Inc. All rights reserved.
#1 SASWARE Ballot Item
Integer Ranges
data a; array arrA[10] (1:10); array arrB[10]; retain arrB (2*1:5);
if x in (1 2 5:10) then put 'X in range';
Copyright © 2002, SAS Institute Inc. All rights reserved.
if x in arrA then put 'X in arrA';
Perl Regular Expressions
/
A
B
+
A+
\d
\w
[A-Z]
Copyright © 2002, SAS Institute Inc. All rights reserved.
Typical start and end delimiter.
Search for an “A”.
Search for a “B”.
Search for prior character one or more times.
Search for one or more “A”s.
Search for a digit character.
Search for a word character, alphanumeric plus _.
Search for character in the range between A and Z.
Perl Regular Expressions
/abc/
xyz abc 123
xyzab123c
/abc+\d/
xyz abcccc5 123
xyzabcz
Copyright © 2002, SAS Institute Inc. All rights reserved.
Data Validation
Validate U.S. phone numbers that look like:
(919) 677-8000
Regular Expression:
/\([2-9]\d\d\) ?[2-9]\d\d-
\d\d\d\d/
Copyright © 2002, SAS Institute Inc. All rights reserved.
Data Validation – The Code data _null_; if _N_ = 1 then do; retain re; re = prxparse("/\([2-9]\d\d\) ?[2-9]\d\d-\d\d\d\d/") ; end; input first last phone & $16.; if ^prxmatch(re, phone) then putlog "NOTE: Invalid, " first last phone; datalines;
Thomas Archer (919)319-1677
Lucy Mallory 800-899-2164
Tom Joad (508) 852-2146
Laurie Jorgensen (252)152-7583
;
Copyright © 2002, SAS Institute Inc. All rights reserved.
Data Extraction
Use parentheses to group part of the regular expression:
/\( ( [2-9]\d\d ) \) ?
( [2-9]\d\d-
\d\d\d\d ) /
Area Code
Submatch #1
Local Phone Number
Submatch #2
Copyright © 2002, SAS Institute Inc. All rights reserved.
Data Extraction – The Code re = prxparse("/\(([2-9]\d\d)\) ?([2-9]\d\d-\d\d\d\d)/");
...
if prxmatch(re, phone) then do; call prxposn(re, 1, pos, len); areacode = substr(phone, pos, len); call prxposn(re, 2, pos, len); localphone = substr(phone, pos, len); end;
Copyright © 2002, SAS Institute Inc. All rights reserved.
Search and Replace
s/(\w+) \1 /\1
/
Copyright © 2002, SAS Institute Inc. All rights reserved.
Search and Replace – The Code data _null_; x = 'it it happened at at SUGI'; re = prxparse('s/(\w+) \1 /\1 /'); call prxchange(re, -1, x); put x=; run;
/* x=it happened at SUGI */
Copyright © 2002, SAS Institute Inc. All rights reserved.
Hash Table – Creating and Adding Data declare Hash ht(); ht.defineKey("ISBN"); ht.defineData("author", "title"); ht.defineDone();
ISBN="0679722769"; author="Joyce"; title="Ulysses"; rc=ht.add();
Copyright © 2002, SAS Institute Inc. All rights reserved.
Hash Table – Finding Data
ISBN="0679722769"; rc = ht.find(); if rc = 0 then putlog "Found " author title;
Copyright © 2002, SAS Institute Inc. All rights reserved.
Hash Table – Loading from a Dataset data purchased_books; if _N_ = 1 then do; declare Hash ht(dataset: "books"); ht.defineKey("ISBN"); ht.defineData("author", "title", "price"); ht.defineDone(); end; length author title $ 64 price 8; set purchased_ISBNs; if ht.find() = 0; run;
Copyright © 2002, SAS Institute Inc. All rights reserved.
This looks a lot like…
SET with KEY= data m; set ids; set data key=id;
MERGE with BY data m; merge ids data; by key;
Custom Format with
PUT data m; set ids; data = put(ids, $LOOKUP.);
Copyright © 2002, SAS Institute Inc. All rights reserved.
Copyright © 2002, SAS Institute Inc. All rights reserved.
Hash Table – Performance
Real Time to Perform Lookup
Format and PUT() 22.84s
Build Format
Search
SET with KEY= 47.85s
Build Index
Search
MERGE with BY
Sort Data Sets
Search
Hash Table
Load and Search
9.18s
3.43s
16.03s
6.81s
3.06s
44.79s
7.58s
1.60s
3.43s
Hash Tables – V9 Experimental
So send in your comments!
suggest@sas.com
Embryonic…
Java Object Class
Copyright © 2002, SAS Institute Inc. All rights reserved.
PROC SUMMARY and threads
What are threads?
Dividing the work
PROC SUMMARY groups by classes
Each thread handles classes
Internally a completely new implementation
Example
Copyright © 2002, SAS Institute Inc. All rights reserved.
PROC SUMMARY and threads data temp; input group value;
2 6 cards;
1 1
1 3
2 4
1 2
2 5
; proc summary; class group; var value;
[proc
Copyright © 2002, SAS Institute Inc. All rights reserved.
Threads
Group 1 gets a thread and a buffer of obs
Group 2 gets the same
Each thread computes the statistics
Brought back together for the output
Copyright © 2002, SAS Institute Inc. All rights reserved.
Threads and I/O
Will CPU outrun the I/O processing?
No - the other way around
Big Unix machines maximize their I/O buffering
We need threads to keep up with the I/O
Copyright © 2002, SAS Institute Inc. All rights reserved.
More to come for threads
SUMMARY, SORT are the first Base apps
REG, GLM in SAS/STAT
More procs will come
Also used in client/server applications
Copyright © 2002, SAS Institute Inc. All rights reserved.
ODS Updates
MARKUP/Tagsets
HTML4
Style Templates/DOCUMENT
Page X of Y
Text insertion
PDF enhancements
Copyright © 2002, SAS Institute Inc. All rights reserved.
ODS MARKUP
TAGSET templates
YOU have the power
Available in 8.2 experimentally
"ODS MARKUP: The Power of Choice & Change" by Eric Gebhart http://www2.sas.com/proceedings/sugi27/p003-27.pdf
also http://www.sas.com/rnd/base/index-v9-resources.html
Copyright © 2002, SAS Institute Inc. All rights reserved.
Tagsets
Markup definition file
– Defines how the markup should be generated
– Defines the tags and how they should be used
Copyright © 2002, SAS Institute Inc. All rights reserved.
SAS-supplied Tagsets
A sampling of some of the available supplied tagsets:
– CSV
– Default (default XML)
– Docbook
– Event_map
– HTML4
– HTMLCSS (Cascading Style Sheets)
– LaTeX
– WML
– and many more!!!
Copyright © 2002, SAS Institute Inc. All rights reserved.
Make your own destination
Don't like the supplied tagsets?
Need a destination that SAS does not supply?
– Create your own
– SYLK tagset created by Jack Hamilton
– DDE to Excel by Frank Poppe
See http://www.sas.com/rnd/base/index-early-faq.html
Copyright © 2002, SAS Institute Inc. All rights reserved.
Tagsets – SCSV Example
Proc Template; define tagset tagsets.SCSV; parent = tagsets.CSV; define event header; start: put ";" / if !cmp( COLSTART, "1"); put """"; put VALUE; finish: put """";
Semicolons instead of end; commas define event data; start: put ";" / if !cmp( COLSTART, "1"); put """"; put VALUE; finish: put """"; end; define event colspanfill; put ";"; end; define event rowspanfill; put ";"; end; end; /* define tagset */ run;
Copyright © 2002, SAS Institute Inc. All rights reserved.
Tagsets – SCSV Example
ODS Tagsets.SCSV
file = 'Ex.csv'; proc print data=sashelp.class; run;
ODS Tagsets.SCSV
close;
" 1";"Alfred";"M";"14";"69.0";"112.5"
" 2";"Alice";"F";"13";"56.5";" 84.0"
" 3";"Barbara";"F";"13";"65.3";" 98.0"
Semicolons instead of commas
Copyright © 2002, SAS Institute Inc. All rights reserved.
The Transition is Coming
ODS HTML file = 'Version9.html';
will invoke MARKUP destination with HTML4 tagset in Version 9.1 by default.
– Current 3.2 spec HTML will be accessible by setting an option in the registry.
Copyright © 2002, SAS Institute Inc. All rights reserved.
MARKUP & TAGSETS
Provides ability to have Markup output YOUR way
Will be the default for HTML in Version 9.1
Uses new TAGSET templates
– otherwise referred to as Markup definitions
Create your own destinations
Copyright © 2002, SAS Institute Inc. All rights reserved.
Copyright © 2002, SAS Institute Inc. All rights reserved.
ODS DOCUMENT
New ODS destination -- persists output objects in raw format
Reorder
Rearrange
Replay without rerunning your procedures
Copyright © 2002, SAS Institute Inc. All rights reserved.
ODS DOCUMENT ods document name=sales(write);
Title ‘Quarterly Sales By Product’; proc tabulate data=sashelp.prdsal2
format=dollar12.2; class product quarter; var actual; table product, quarter*actual*sum=‘’; run; ods document close;
Copyright © 2002, SAS Institute Inc. All rights reserved.
ODS DOCUMENT tools
Two new tools to manage ODS Documents
Proc Document
Graphical User Interface – ODS Document
Window
– odsdocument
Copyright © 2002, SAS Institute Inc. All rights reserved.
RTF: Page X of Y
No more having to insert raw RTF code
NOW: ods escapechar '\'; title 'Hello ' j=r 'Page \ {pageof} ';
BEFORE: title 'Hello ' j=r 'Page {\field{\*\fldinst {\b\i PAGE
}}}{\b\i of }{\field{\*\fldinst {\b\i NUMPAGES }}}';
Copyright © 2002, SAS Institute Inc. All rights reserved.
TEXT option
Some text BEFORE Proc Report
Name Sex Age Height Weight
Alfred M 14 69 112.5
Alice F 13 56.5 84
Barbara F 13 65.3 98
Carol F 14 62.8 102.5
Henry M 14 63.5 102.5
Some text AFTER Proc Report
Copyright © 2002, SAS Institute Inc. All rights reserved.
TEXT option
ODS RTF TEXT = 'Some text before PROC';
ODS PDF TEXT = 'Some text before PROC';
Actually available in V8.2
Improved to allow style option for formatting
Copyright © 2002, SAS Institute Inc. All rights reserved.
ODS PDF Enhancements
Compressed
MUCH faster
Embedded fonts – definitely 9.1
Copyright © 2002, SAS Institute Inc. All rights reserved.
Other SAS ® 9 Features
Software Installation
Customized software installations
Formal distribution of setinits via email
Setinit transparently applied by the install program
Improved “silent” install for Windows installations
New InstallCenter on www.sas.com
Copyright © 2002, SAS Institute Inc. All rights reserved.
Other SAS ® 9 Features
Shipping & Packaging
New installation Kit
CD packaging is 3-tiered
All products shipped,making add-ons easy
Copyright © 2002, SAS Institute Inc. All rights reserved.
Other SAS ® 9 Features
Section 508 Compliant
SAS Windowing
Environment
Output Delivery System
National Language Support
Japanese, Chinese, Korean
French, German, Italian,
Polish, Hungarian
Copyright © 2002, SAS Institute Inc. All rights reserved.
SAS Display Manager in Kanji
2002
9.0
Q4
9.0
9.1
9.1.2
9.1.3
9.2
Copyright © 2002, SAS Institute Inc. All rights reserved.
2003
9.1
Q4
9.1.2
3/31
2004
9.1.3
6/30
Copyright © 2002, SAS Institute Inc. All rights reserved.
Not carried forward from V8
Windows 95/98
CMS
VAX/VMS
32-bit HP, Solaris, AIX
Mac
Intel ABI
MIPS ABI
Copyright © 2002, SAS Institute Inc. All rights reserved.
Summary
Four Pillars (The Billy Ts)
ANYDATE
MP/Connect
DATA step
Threads and PROC SUMMARY
ODS
Release Schedule
LOTS OF GOOD STUFF!!!
Copyright © 2002, SAS Institute Inc. All rights reserved.