What’s New in SAS 9 Rick LangstonTitle Microsoft PowerPoint - wisug20042 Created Date...

Preview:

Citation preview

Copyright © 2004, SAS Institute Inc. All rights reserved.

What’s New in SAS 9

Rick LangstonSAS Institute Inc.

Platform R&D Division

Rick.Langston@sas.com

Copyright © 2004, SAS Institute Inc. All rights reserved. 2

Outline

� The Billy Ts

� So many things, so little time

� ANYDATE

� MP/Connect

� DATA step

� Threads and PROC SUMMARY

Copyright © 2004, SAS Institute Inc. All rights reserved. 3

Outline continued

� ODS

� Release Schedule

� Summary (not PROC SUMMARY)

Copyright © 2004, SAS Institute Inc. All rights reserved. 4

Billy T. ?

Copyright © 2004, SAS Institute Inc. All rights reserved. 5

William T.?

Copyright © 2004, SAS Institute Inc. All rights reserved. 6

Four Pillars

� Usability

� Scalability

� Interoperability

� Manageability

Copyright © 2004, SAS Institute Inc. All rights reserved. 7

The Intelligence Value Chain

Copyright © 2004, SAS Institute Inc. All rights reserved. 8

Copyright © 2004, SAS Institute Inc. All rights reserved. 9

Copyright © 2004, SAS Institute Inc. All rights reserved. 10

SAS ® 6.09 Usability Experience…circa 1990

Copyright © 2004, SAS Institute Inc. All rights reserved. 11

SAS ® Usability Experiences Today

Copyright © 2004, SAS Institute Inc. All rights reserved. 12

Usability – SAS ® 9SAS® Web Report Studio

Copyright © 2004, SAS Institute Inc. All rights reserved. 13

Usability – SAS ® 9SAS® Enterprise Guide 2.0

� Compatible withSAS V8 & SAS 9

� New analytictasks

� More controls� New Graph styles� New extensibility

features

Copyright © 2004, SAS Institute Inc. All rights reserved. 14

Q Import XML documentsto SAS ® data sets

Q Export SAS ® data setsto XML documents

Q XML Map extensionsadd flexibility & powerto schema definitions

Q Java ® GUI maps XMLto SAS ® data & vice-versa

Java-based SAS ® XML Mapper client

Interoperability in SAS® 9SAS ® XML Mapper

Copyright © 2004, SAS Institute Inc. All rights reserved. 15

Copyright © 2004, SAS Institute Inc. All rights reserved. 16

So many things...

� Not enough time for everything!

� SQL improvements

� OLAP

� SPDS

� SAS Management Console

� Metadata Servers

Copyright © 2004, SAS Institute Inc. All rights reserved. 17

“ANYDATE” informats

O ANYDTDTE, ANYDTDTM, ANYDTTME

O Handles most acceptable input d/t/dt informats

O mdy ambiguities handled

Copyright © 2004, SAS Institute Inc. All rights reserved. 18

1 data _null_;2 input x: anydtdte20.; list; put x=date9.; cards;

x=01JAN20023 01jan2002x=31DEC20024 12/31/2002x=01MAY20025 may2002x=01JAN20026 01jan2002:12:34:56x=01JAN20027 2002-jan-01x=01JAN20028 2002001

Copyright © 2004, SAS Institute Inc. All rights reserved. 19

11 options datestyle=mdy;12 data _null_;13 input x: anydtdte20.; list; put x=date9.; cards;

x=02JAN200314 01/02/03x=31DEC200215 12/31/2002x=31DEC200216 31/12/2002x=19MAR195517 55/03/19x=19MAR195518 19/03/55

19 run;20

Copyright © 2004, SAS Institute Inc. All rights reserved. 20

21 data _null_;22 input x: anydtdtm20.; list; put x=datetime.; cards;

x=01JAN02:12:34:5623 01jan2002:12:34:56x=01JAN02:00:00:0024 01jan2002x=01JAN60:12:34:5625 12:34:56

Copyright © 2004, SAS Institute Inc. All rights reserved. 21

28 data _null_;29 input x: anydttme20.; list; put x=time8.; cards;

x=12:34:5630 01jan2002:12:34:56x=0:00:0031 01jan2002x=12:34:5632 12:34:56

Copyright © 2004, SAS Institute Inc. All rights reserved. 22

New in Connect

� MP connect is not new, but we are still “gettingthe word out”

� PIPES are new….

� hook your job steps together without using work files

Copyright © 2004, SAS Institute Inc. All rights reserved. 23

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 © 2004, SAS Institute Inc. All rights reserved. 24

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 © 2004, SAS Institute Inc. All rights reserved. 25

SAS9 Common BI Infrastructure

SAS ServersOpen Metadata (OMS) Workspace Server Stored Process Data Storage

SAS Foundation Services

System Mgmt InformationUser EventConnection

SAS Query and Reporting Services

Business Metadata ReportingQuery

JNI – Interfaces

Windows Based BI ToolsSAS®

EnterpriseGuide

SAS®Information

DeliveryPortal

SAS®AppDevStudio

Dev Env.

SAS® WebReport Studio

SAS® Information Map Studio

Java Based BI Tools

SAS® ETL StudioSAS® Management Console

Portal

Re-usable COM ComponentsSAS Java Components

SAS®Add-in forMS Office

Copyright © 2004, SAS Institute Inc. All rights reserved. 26

SAS 9.1.3 Shipping!

Copyright © 2004, SAS Institute Inc. All rights reserved. 27

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 © 2004, SAS Institute Inc. All rights reserved. 28

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 © 2004, SAS Institute Inc. All rights reserved. 29

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 © 2004, SAS Institute Inc. All rights reserved. 30

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 © 2004, SAS Institute Inc. All rights reserved. 31

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 © 2004, SAS Institute Inc. All rights reserved. 32

New in the DATA step

� New Functions

� Perl Regular Expressions

� DATA step Hash Tables

Copyright © 2004, SAS Institute Inc. All rights reserved. 33

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 © 2004, SAS Institute Inc. All rights reserved. 34

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 © 2004, SAS Institute Inc. All rights reserved. 35

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 © 2004, SAS Institute Inc. All rights reserved. 36

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 © 2004, SAS Institute Inc. All rights reserved. 37

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 © 2004, SAS Institute Inc. All rights reserved. 38

#1 SASWARE Ballot ItemInteger 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’;

� if x in arrA then

� put ’X in arrA’;

Copyright © 2004, SAS Institute Inc. All rights reserved. 39

Perl Regular Expressions

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.

+

A+

\d

\w

[A-Z]

Search for an “A”.

Search for a “B”.

A

B

Typical start and end delimiter./

Copyright © 2004, SAS Institute Inc. All rights reserved. 40

Perl Regular Expressions

� /abc/

� xyzabc123

� xyzab123c

� /abc+\d/

� xyzabcccc5123

� xyzabcz

Copyright © 2004, SAS Institute Inc. All rights reserved. 41

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 © 2004, SAS Institute Inc. All rights reserved. 42

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 © 2004, SAS Institute Inc. All rights reserved. 43

Data Extraction

� Use parentheses to group part of the regularexpression:

� /\(([2-9]\d\d)\) ?([2-9]\d\d-\d\d\d\d)/

Area CodeSubmatch #1

Local Phone NumberSubmatch #2

Copyright © 2004, SAS Institute Inc. All rights reserved. 44

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 © 2004, SAS Institute Inc. All rights reserved. 45

Search and Replace

� s/(\w+) \1 /\1 /

Copyright © 2004, SAS Institute Inc. All rights reserved. 46

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 © 2004, SAS Institute Inc. All rights reserved. 47

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 © 2004, SAS Institute Inc. All rights reserved. 48

Hash Table – Finding Data

ISBN="0679722769";

rc = ht.find();

if rc = 0 then

putlog "Found " author title;

Copyright © 2004, SAS Institute Inc. All rights reserved. 49

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 © 2004, SAS Institute Inc. All rights reserved. 50

This looks a lot like…

� SET with KEY=

� MERGE with BY

� Custom Format withPUT

data m;

set ids;

set data key=id;

data m;

merge ids data;

by key;

data m;

set ids;

data = put(ids, $LOOKUP.);

Copyright © 2004, SAS Institute Inc. All rights reserved. 51

Hash Table – Performance

Real Time to Perform Lookup

Hash Table 3.43s Load and Search 3.43s

MERGE with BY 9.18s Sort Data Sets 7.58s Search 1.60s

SET with KEY= 47.85s Build Index 3.06s Search 44.79s

Format and PUT() 22.84s Build Format 16.03s Search 6.81s

Copyright © 2004, SAS Institute Inc. All rights reserved. 52

Hash Tables – V9 Experimental

� So send in yourcomments!

� suggest@sas.com

� Embryonic…

� Java Object Class

Copyright © 2004, SAS Institute Inc. All rights reserved. 53

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 © 2004, SAS Institute Inc. All rights reserved. 54

PROC SUMMARY and threads

[procdata temp; input group value; cards;2 61 11 32 41 22 5;proc summary; class group; var value;

Copyright © 2004, SAS Institute Inc. All rights reserved. 55

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 © 2004, SAS Institute Inc. All rights reserved. 56

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 © 2004, SAS Institute Inc. All rights reserved. 57

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 © 2004, SAS Institute Inc. All rights reserved. 58

ODS Updates

� MARKUP/Tagsets

� HTML4

� Style Templates/DOCUMENT

� Page X of Y

� Text insertion

� PDF enhancements

Copyright © 2004, SAS Institute Inc. All rights reserved. 59

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 © 2004, SAS Institute Inc. All rights reserved. 60

Tagsets

� Markup definition file� Defines how the markup should be generated

� Defines the tags and how they should be used

Copyright © 2004, SAS Institute Inc. All rights reserved. 61

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 © 2004, SAS Institute Inc. All rights reserved. 62

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 © 2004, SAS Institute Inc. All rights reserved. 63

Tagsets – SCSV ExampleProc Template;define tagset tagsets.SCSV;parent = tagsets.CSV;define event header; start: put ";" / if !cmp( COLSTART, "1"); put """"; put VALUE; finish: put """";end;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;

Semicolonsinstead ofcommas

Copyright © 2004, SAS Institute Inc. All rights reserved. 64

Tagsets – SCSV Example

" 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 ofcommas

ODS Tagsets.SCSV file = ’Ex.csv’;proc print data=sashelp.class; run;ODS Tagsets.SCSV close;

Copyright © 2004, SAS Institute Inc. All rights reserved. 65

The Transition is Coming

� ODS HTML file = ’Version9.html’;

� will invoke MARKUP destination with HTML4tagset in Version 9.1 by default.

� Current 3.2 spec HTML will be accessible by setting anoption in the registry.

Copyright © 2004, SAS Institute Inc. All rights reserved. 66

MARKUP & TAGSETS

� Provides ability to have Markup output YOURway

� 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 © 2004, SAS Institute Inc. All rights reserved. 67

Copyright © 2004, SAS Institute Inc. All rights reserved. 68

Copyright © 2004, SAS Institute Inc. All rights reserved. 69

ODS DOCUMENT

New ODS destination -- persists output objects inraw format

� Reorder

� Rearrange

� Replay

without rerunning your procedures

Copyright © 2004, SAS Institute Inc. All rights reserved. 70

ODS DOCUMENT

RGV�GRFXPHQW�QDPH VDOHV�ZULWH��7LWOH�¶4XDUWHUO\�6DOHV�%\�3URGXFW·�SURF�WDEXODWH�GDWD VDVKHOS�SUGVDO���������������IRUPDW GROODU�����FODVV�SURGXFW�TXDUWHU�YDU�DFWXDO�WDEOH�SURGXFW��TXDUWHU DFWXDO VXP ¶·�UXQ�RGV�GRFXPHQW�FORVH�

Copyright © 2004, SAS Institute Inc. All rights reserved. 71

ODS DOCUMENT tools

Two new tools to manage ODS Documents

� Proc Document

� Graphical User Interface – ODS DocumentWindow� odsdocument

Copyright © 2004, SAS Institute Inc. All rights reserved. 72

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 © 2004, SAS Institute Inc. All rights reserved. 73

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 © 2004, SAS Institute Inc. All rights reserved. 74

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 © 2004, SAS Institute Inc. All rights reserved. 75

TEXT option

� proc template;

� define style textstyle;

� parent = styles.printer;

� style usertext fromusertext /

� background = lightblue;

� end;

� run;

� ods rtf file = ’textopt.rtf’;

� ods rtf text = "Some text BEFOREProc Report";

� proc report data=sashelp.classnocenter nowd;run;

� ods rtf text = ’Some text AFTERProc Report’ style=textstyle;

� ods rtf close;

Copyright © 2004, SAS Institute Inc. All rights reserved. 76

ODS PDF Enhancements

� Compressed

� MUCH faster

� Embedded fonts – definitely 9.1

Copyright © 2004, SAS Institute Inc. All rights reserved. 77

Other SAS ® 9 FeaturesSoftware Installation

Q Customized software installations

Q Formal distribution of setinits via email

Q Setinit transparently applied by the installprogram

Q Improved “silent” install for Windows installations

Q New InstallCenter on www.sas.com

Copyright © 2004, SAS Institute Inc. All rights reserved. 78

Other SAS ® 9 FeaturesShipping & Packaging

� New installation Kit

� CD packaging is 3-tiered

� All products shipped,making add-onseasy

Copyright © 2004, SAS Institute Inc. All rights reserved. 79

Other SAS ® 9 Features

Section 508 Compliant

�SAS WindowingEnvironment

�Output Delivery System

National Language Support

�Japanese, Chinese, Korean

�French, German, Italian,Polish, Hungarian

SAS Display Manager in Kanji

Copyright © 2004, SAS Institute Inc. All rights reserved. 80

� 9.0

� 9.1

� 9.1.2

� 9.1.3

� 9.2

����

���4�

���� ����

���4�

���������

���������

Copyright © 2004, SAS Institute Inc. All rights reserved. 81

Copyright © 2004, SAS Institute Inc. All rights reserved. 82

Not carried forward from V8

� Windows 95/98

� CMS

� VAX/VMS

� 32-bit HP, Solaris, AIX

� Mac

� Intel ABI

� MIPS ABI

Copyright © 2004, SAS Institute Inc. All rights reserved. 83

Summary

� Four Pillars (The Billy Ts)

� ANYDATE

� MP/Connect

� DATA step

� Threads and PROC SUMMARY

� ODS

� Release Schedule

� LOTS OF GOOD STUFF!!!

Recommended