quest q3 tips from the techies - sas institute...sep 04, 2014  · tips from the techies tip1 –di...

23
Tips from the Techies Leonard Scuderi 4 th September 2014

Upload: others

Post on 21-May-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tips from the TechiesLeonard Scuderi

4th September 2014

Page 2: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

About Me

Contracting in the Business Intelligence / Data

Warehousing space for the last 12 years in Brisbane,

Sydney and London.

Experience in Banking, Telecommunications, Insurance,

Government, and Loyalty Marketing industries.

Training Courses This Year

"Tackling the Challenges of Big Data“ - Massachusetts Institute of

Technology

"Data Vault Modelling" - Data Vault Academy

Tips are some of the things I have picked up from client

sites and blogs.

Page 3: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tips from the Techies

Tip1 – DI Studio Performance Tweak

Tip2 – DI Studio User Written Transforms

Tip3 – Using Unicode variables in your Reports

Tip4 – Using Index in SAS Datasets

Page 4: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 1- Studio DI

Performance Tweak

Page 5: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 1 – DI Studio Performance Tweak

Table 20GB in size with 120 Million Observations.

Taking 1 hour with table Loader to append 100,000 Observations.

Dataset is not compressed so it SHOULD use fast append.

Page 6: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 1 – DI Studio Performance Tweak

SAS 9.2 the Table Loader

sometimes in inserts this

code to create a view of

your input dataset

before the append to

your final dataset.

View prevents Fast

Append.

We need to get rid of

this view so that SAS will

use Fast Append.

Page 7: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 1 – DI Studio Performance Tweak

Change Table loader to

“User Written Body” and

change the VIEW to a

TABLE.

Job ran in 5 minutes to

append since fast append

is available.

Remember to add a NOTE

to your job to document

WHY you have done it!

Page 8: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 2- DI Studio

User Written Transform

Page 9: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 2 – DI Studio User Written Transforms

Seen on previous sites where coders have not using macro variable available in

your user written transforms in DI Studio (when you HAVE to write SAS code)

SAS temporary table names are coded the UWT. (eg W6E64OBZ)

data TRANSACTION_CODE_NO_DUPS;

set W6E64OBZ;

by TRANSACTION_CODE;

if first.TRANSACTION_CODE;

run;

Page 10: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 2 – DI Studio User Written Transforms

UWTs have the following

macro variables available to

hook up your job.

_INPUTn and _OUTPUTn where

n is the number of input and

output nodes.

data &_output1.;

set &_input1.;

by TRANSACTION_CODE;

if first.TRANSACTION_CODE;

run;

Page 11: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 2 – DI Studio User Written Transforms

Also Column Variables

%let _OUTPUT1_col0_name =

TRANSACTION_CODE;

So I could have actually coded

data &_output1;

set &_input1;

by &_OUTPUT1_col0_name;

if first.&_OUTPUT1_col0_name;

run;

Only works if your key field is

the first in your dataset

Page 12: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 2 – DI Studio User Written Transforms

Now when we have our job we can just attach the UWT as it if is a normal DI transform without having change the names of the work datasets

Page 13: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 3- SAS Reports

Using Unicode Values

Page 14: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 3 – Adding Unicode Values to Reports

SAS Reports can use Unicode values to enhance reports.

Unicode numerical values to symbols (similar to your

Webdings Winding which are available on your Microsoft

products) which are in HEX format.

Examples

is Unicode 2605

is Unicode 2713

Page 15: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 3 – Adding Unicode Values to Reports

• Example of the “Miscellaneous

Symbols”

• Thousands check out

http://www.unicode.org/charts/

Page 16: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 3 – Adding Unicode Values to Reports

How is this useful?

Using the some code link this

we can use these Unicode

Symbols with colours.

We can use a format to replace

our values with the Unicode

Symbols.

Give Numbers and Descriptions

Colours and Symbols e.g. star

ratings or green tics and red

crosses for targets.

Page 17: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 3 – Adding Unicode Values to Reports

/* ODS EXCAPECHAR needed to set style/unicode cues */

ods escapechar='~';

/* Captured these in macro variables for readability and */

/* easy maintenance */

%let Sunny = ~{style [color=red] ~{unicode '2600'x}};

%let Cloudy = ~{style [color=Grey] ~{unicode '2601'x}};

%let Rainy = ~{style [color=Blue] ~{unicode '2602'x}};

%let Snowy = ~{style [color=Black ] ~{unicode '2603'x}};

%let Hot = ~{style [color=red] ~{unicode '26AB'x}};

%let Comfortable = ~{style [color=orange] ~{unicode '26AB'x}};

%let Cool = ~{style [color=yellow] ~{unicode '26AB'x}};

%let Cold = ~{style [color=blue] ~{unicode '26AB'x}};

proc format lib=work;

value $Weather

'Sunny' = "&sunny"

'Cloudy' = "&Cloudy"

'Rainy' = "&Rainy"

'Snowy' = "&Snowy";

value Temp

0 - 10 = "&Cold"

11 - 20 = "&Cool"

21 - 30 = "&Comfortable"

30 - 40 = "&Hot";

title "Weather Report for 04SEP2014";

proc print data=work.Weather noobs;

format Weather $Weather. Temp Temp.;

run;

Page 18: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 4 – Recreating Indexes

Page 19: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 4 – Re-Creating Indexes

Modify an existing data set.

Delete Duplicate Observations

Remove Erroneous Rows

SAS data set has Index on City that we need to preserve.

Page 20: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 4 – Re-Creating Indexes

Use PROC SQL statement using a Delete Step (to

preserve index) however you end up with Deleted

Observations in your SAS Dataset.

Page 21: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 4 – Re-Creating Indexes

Use a Data Step instead to delete data.

Yes - I don’t have deleted observation.

Oh no - I have lost the indexes that were on the SAS Dataset.

Page 22: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Tip 4 – Re-Creating Indexes

Need to recreate the

index.

If you have DI Studio

you’re lucky you can

just go back to your

DI studio job

The Table Loader or

SCD Loader step in

the code gives you

the code to re-create

your index.

Page 23: QUEST Q3 Tips from the Techies - Sas Institute...Sep 04, 2014  · Tips from the Techies Tip1 –DI Studio Performance Tweak Tip2 –DI Studio User Written Transforms Tip3 –Using

Questions

References

http://www.unicode.org/charts/

http://blogs.sas.com/content/sasdummy/2014/06/10/sas-stars-on-thars/

Leonard Scuderi

Kalebo Komputing

[email protected]