Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2006, SAS Institute Inc. All rights reserved. A Sampler of What's New in Base SAS 9.2

Similar presentations


Presentation on theme: "Copyright © 2006, SAS Institute Inc. All rights reserved. A Sampler of What's New in Base SAS 9.2"— Presentation transcript:

1 Copyright © 2006, SAS Institute Inc. All rights reserved. A Sampler of What's New in Base SAS 9.2 Jason.Secosky@sas.com

2 Copyright © 2006, SAS Institute Inc. All rights reserved. Caramel, Nut, or Truffle?  DATA Step User-Written Functions Data Set Lists Current Input Data Set Name INPUT with String Delimiter  PROC SQL Un-PUT Faster DISTINCT  PROC SORT Linguistic Ordering  Encrypted Macro Storage

3 Copyright © 2006, SAS Institute Inc. All rights reserved. Caramel, Nut, or Truffle?  DATA Step User-Written Functions Data Set Lists Current Input Data Set Name INPUT with String Delimiter  PROC SQL Un-PUT Faster DISTINCT  PROC SORT Linguistic Ordering  Encrypted Macro Storage

4 Copyright © 2006, SAS Institute Inc. All rights reserved. Wrap in a Macro %macro study_day(start, event, study_day); n = &event - &start; if n >= 0 then &study_day = n + 1; else &study_day = n; %mend;

5 Copyright © 2006, SAS Institute Inc. All rights reserved. Bug in the Macro data results; set trial_data; n = sum(of visits_jan--visits_dec); %study_day(start, event, study_day) if n > 5 then...

6 Copyright © 2006, SAS Institute Inc. All rights reserved. Bug in the Macro data results; set trial_data; n = sum(of visits_jan--visits_dec); n = event – start; if n >= 0 then study_day = n + 1; else study_day = n; if n > 5 then...

7 Copyright © 2006, SAS Institute Inc. All rights reserved. Protected by a Function data results; set trial_data; n = sum(of visits_jan--visits_dec); study_day = study_day(start, event); if n > 5 then...

8 Copyright © 2006, SAS Institute Inc. All rights reserved. Study Day Function proc fcmp outlib=sasuser.funcs.trial; function study_day(start, event); n = event – start; if n >= 0 then return(n + 1); else return(n); endsub;

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

10 Data Set Lists  #1 on 2006 SASware Ballot  Read Like-Named Data Sets  Syntax borrowed from DROP and KEEP

11 Copyright © 2006, SAS Institute Inc. All rights reserved. Read a Bunch of Data Sets data out; set a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30 a31 a32 a33 a34 a35 a36 a37 a38 a39 a40 a41 a42 a43 a44 a45 a46 a47 a48 a49 a50; run;

12 Copyright © 2006, SAS Institute Inc. All rights reserved. Data Set Lists data out; set a1-a50(pw=pass123); run; data out; set sales.jan:; run;

13 Copyright © 2006, SAS Institute Inc. All rights reserved. String Delimiter  "Top 10" SASware Ballot Item  Difficult to parse multi-character delimiters  INFILE DLMSTR=  Works like DLM=

14 Copyright © 2006, SAS Institute Inc. All rights reserved. String Delimiter data bad_guys; length date time ip $ 16; infile datalines dlm=' ' dsd; input date time ip; datalines; "20APR2007" "12:56:46" "146.16.1.23" run;

15 Copyright © 2006, SAS Institute Inc. All rights reserved. String Delimiter data bad_guys; length date time ip $ 16; infile datalines dlmstr=' ' dsd; input date time ip; datalines; "20APR2007" "12:56:46" "146.16.1.23" run;

16 Copyright © 2006, SAS Institute Inc. All rights reserved. SET with INDSNAME=  "Top 10" SASware Ballot Item  Place current data set name into a variable  SET with INDSNAME = var

17 Copyright © 2006, SAS Institute Inc. All rights reserved. SET with INDSNAME= data results; set gas_price_option gas_rbid_option coal_price_forward coal_rbid_forward indsname = cur_dataset;... run;

18 Copyright © 2006, SAS Institute Inc. All rights reserved. DATA Step JavaObj  "Compute" methods written in Java  Call from DATA Step with JavaObj  Methods like Java Native Interface (JNI)  Uses dot syntax  Production in SAS 9.2  Experimental in SAS 9.1.3

19 Copyright © 2006, SAS Institute Inc. All rights reserved. data results; declare javaobj jo("myclass"); jo.callDoubleMethod("compute", x, y, z, res);... DATA Step JavaObj

20 Copyright © 2006, SAS Institute Inc. All rights reserved. DATA Step IN Operator  IN operator used simple array search  Now, IN searches a binary tree 912141719235054677276

21 Copyright © 2006, SAS Institute Inc. All rights reserved. data _null_; set customers; if state in ('NC', 'SC', 'GA', 'TN', 'FL'); run; DATA Step IN Operator

22 Copyright © 2006, SAS Institute Inc. All rights reserved. Proc SQL Today proc format; value udfmt 1-3='small' 4-6='medium' 7-9='large'; proc sql; select style as SmallStyles from oracle.clothes where put(size, udfmt.) = 'small';

23 Copyright © 2006, SAS Institute Inc. All rights reserved. DBMS Proc SQL Today SAS® Session select style as SmallStyles from oracle.clothes where put(size, udfmt.) = 'small'; SAS/Access Engine select style,size from clothes

24 Copyright © 2006, SAS Institute Inc. All rights reserved. DBMS Proc SQL Today SAS® Session select style as SmallStyles from oracle.clothes where put(size, udfmt.) = 'small'; SAS/Access Engine select style,size from clothes

25 Copyright © 2006, SAS Institute Inc. All rights reserved. SAS® Session select style as SmallStyles from oracle.clothes where put(size, udfmt.) = 'small'; DBMS Proc SQL Tomorrow SAS/Access Engine select style as SmallStyles from oracle.clothes where (1 <= size and size <= 3);

26 Copyright © 2006, SAS Institute Inc. All rights reserved. SAS® Session select style as SmallStyles from oracle.clothes where put(size, udfmt.) = 'small'; DBMS Proc SQL Tomorrow SAS/Access Engine select style as SmallStyles from oracle.clothes where (1 <= size and size <= 3);

27 Copyright © 2006, SAS Institute Inc. All rights reserved. Proc SQL Today proc sql; select name from oracle.employees where put(bday, date5.) = '31OCT';

28 Copyright © 2006, SAS Institute Inc. All rights reserved. Proc SQL Tomorrow proc sql; select name from oracle.employees where month(bday) = 10 and day(bday) = 31;

29 Copyright © 2006, SAS Institute Inc. All rights reserved. Proc SQL Today proc format; value nudfmt 0 = 'RED' 1 = 'NOTRED' 2 = 'GREEN' other = 'BLACK'; proc sql; select * from oracle.data where put(color, nudfmt.) contains "RED";

30 Copyright © 2006, SAS Institute Inc. All rights reserved. Proc SQL Tomorrow proc format; value nudfmt 0 = 'RED' 1 = 'NOTRED' 2 = 'GREEN' other = 'BLACK'; proc sql; select * from oracle.data where color in (0,1);

31 Copyright © 2006, SAS Institute Inc. All rights reserved. PROC SQL  Faster: SELECT DISTINCT  Faster: COUNT(DISTINCT var)  Hash Join Performance  Row Counts from DBMSes

32 Copyright © 2006, SAS Institute Inc. All rights reserved. SELECT DISTINCT proc sql; create table distinct_values as select distinct month, year from customer_info; quit;

33 Copyright © 2006, SAS Institute Inc. All rights reserved. COUNT DISTINCT proc sql; create table count_distinct as select count(distinct customerid) from customer_info; quit;

34 Copyright © 2006, SAS Institute Inc. All rights reserved. Linguistic Sorting ObsBinaryLowfirstLinguistic 1Aaronaardvark 2AztecazimuthAaron 3ZeusAaronazimuth 4aardvarkAztec 5azimuthzebra 6 Zeus

35 Copyright © 2006, SAS Institute Inc. All rights reserved. Linguistic Sorting proc sort data=names out=sorted sortseq=linguistic; by name; run;

36 Copyright © 2006, SAS Institute Inc. All rights reserved. Numeric_Collation=ON ObsBinaryLinguistic 10123 Main St. Apt #12123 Main St. Apt #1 2 123 Main St. Apt #2 3123 Main St. Apt #1030123 Main St. Apt #12 4123 Main St. Apt #2123 Main St. Apt #24 5 123 Main St. Apt #103

37 Copyright © 2006, SAS Institute Inc. All rights reserved. Encrypted Macro Storage %macro mymac(x, y) / store secure;... %mend;

38 Copyright © 2006, SAS Institute Inc. All rights reserved. More Details Search support.sas.com for: Papers: "User-Written DATA Step Functions" "Creating Order out of Character Chaos"


Download ppt "Copyright © 2006, SAS Institute Inc. All rights reserved. A Sampler of What's New in Base SAS 9.2"

Similar presentations


Ads by Google