next presentation: using sas® enterprise guide® the same...

17
Next Presentation: Using SAS® Enterprise Guide® the Same Way asBase SAS® and More Presenter: Rahman Sarker Rahman is an experienced data mining professional. He has been working in the data analytics arena for the last eight years. Currently he is working with Royal Bank of Canada and is responsible for Dashboard Reporting. His immense enthusiasm in software programming and eagerness to learn, have helped him to gain a good grasp of different SAS tools including SAS Advanced Programming, Enterprise Guide, and BI.

Upload: others

Post on 22-Sep-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

Next Presentation: Using SAS® Enterprise Guide® the Same Way asBase SAS® and More

Presenter: Rahman Sarker

Rahman is an experienced data mining professional. He has been working in the data analytics arena for the last eight years. Currently he is working with Royal Bank of Canada and is responsible for Dashboard Reporting. His immense enthusiasm in software programming and eagerness to learn, have helped him to gain a good grasp of different SAS tools including SAS Advanced Programming, Enterprise Guide, and BI.

Page 2: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

SAS® connects to UNIX using Metadata Server

It runs on remote mode – no need to print ‘RSUBMIT’ and ‘ENDRSUBMIT’

SAS® Enterprise Guide® (Typical Scenario for Server version of SAS® Enterprise Guide® )

1

Roadblocks to 100% execution of Base SAS code:

‘PROC UPLOAD’ and ‘PROC DOWNLOAD’ do not work

- WARNING: PROC UPLOAD must be invoked with

the RSUBMIT command

Page 3: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

SAS® Enterprise Guide® (Typical Scenario for Server version of SAS® Enterprise Guide® )

2

Roadblocks to 100% execution of Base SAS code (contd.)

DDE functionality cannot be used, as “X” command usually does not work in SAS® EG and the tool does not recognize the local machine (local and network drives)

‘PROC EXPORT’ and ‘PROC IMPORT’ do not work from UNIX to ‘Local’ and vice versa

Page 4: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

3

Open a program node and write the following piece

of code

Connect to UNIX the same way as Base SAS® (Way of performing everything in SAS EG the same way we perform in Base SAS®)

Remote server

name

Page 5: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

4

- Update ‘TCPUNIX.SCR’ file with a valid ‘userid’ and

‘password’

/*- Update ‘TCPUNIX.SCR’ file in the highlighted

spots (in blue) below */

/*------------------ UNIX LOGON ----------*/

/*input 'Userid?';*/

type "&ruser" LF;

waitfor 'Password', 30 seconds : nolog;

/* input nodisplay 'Password?';*/

type "&rpwd" LF;

Connect to UNIX the same way as Base SAS® (Way of performing everything in SAS EG the same way we perform in Base SAS®)

Page 6: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

Connect to UNIX the same way as Base SAS® (contd.)

5

Page 7: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

6

Connect to UNIX the same way as Base SAS® (contd.)

A bridge is being established between ‘Local’ and ‘UNIX’

Page 8: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

7

rsubmit;

proc upload data =

pc.client_list out =

r_server.client_list;

run;

endrsubmit;

Connect to UNIX the same way as Base SAS® (contd.)

Page 9: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

SAS® Enterprise Guide® Usage (With customized connection):

We can connect to remote the same way as Base SAS® using ‘SAS/CONNECT’ spawner

We can toggle between code that can be run from ‘Local’ and ‘UNIX’ server and can get our job done

8

Page 10: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

EG can create an ‘Ordered List’ that gives us the control to choose the sequence in which code needs to be run

9

SAS® Enterprise Guide® Usage (contd.) (Ordered List):

Page 11: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

Open SAS® Enterprise

Guide® project that we want

to schedule and click ‘File’

Schedule followed by -

’Project Name’

It should take us to the

screen on the right hand side

(final step of Windows Task

Scheduler – first tab

‘Task’):

SAS® Enterprise Guide® Usage (contd.) (Scheduling jobs - SAS® Enterprise Guide® 4.2):

10

Page 12: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

SAS® Enterprise Guide® Usage (contd.) (Scheduling jobs: Tab ‘Schedule’):

11

Prerequisites:

Save the project on the local drive

Computer has to stay turned on at the scheduled time of the job

Page 13: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

Confirm that the scheduled job has completed without any errors

• Add the following code at the beginning of the job which will send out the log for the job to a pre-determined location for review

12

Scheduling … (Good to have ‘code’ in automated/scheduled job/project)

%let prog = weekly_abc_dashboard;

%let logdir = /sas/user/jobs/logs/prod;

proc printto log =

"&logdir./&prog._%sysfunc(today(),yymmdd

n8.)_%sysfunc(compress(%sysfunc(time(),t

ime6.),:)).log"

new; run;)

Page 14: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

13

Scheduling … (Good to have ‘code’ in automated/scheduled job/project … contd.)

Add the following code to send an email confirmation once the job is complete

data _null_;

timp= time();

call symput(‘tt’,”’”||put(timp,

time.)||”’”);

run;

filename mail email

[email protected]

subject = "&sasjob. finished at &tt";

data _null_; file mail;

put "Hi Rahman - "&sasjob. finished at

&tt.,";

run;

Page 15: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

Conclusion

SAS® programmers of all skill levels (even Advanced Base SAS® users) can benefit from using SAS® EG

14

SAS® Enterprise Guide® offers us the following:

» Flexibility of performing everything in SAS® Enterprise Guide® (via coding) the same way we perform in Base SAS® (provided SAS® EG is connected to the remote server via ‘SAS/CONNECT’ spawner)

» Ability to organize our project by creating ‘Ordered List’ that gives us the control to choose the sequence in which code needs to be run

» Ability to automate/schedule SAS® job/project

Page 16: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

Questions?

Thank you

Contact: [email protected]

Page 17: Next Presentation: Using SAS® Enterprise Guide® the Same ...torsas.ca/attachments/File/06082012/Rhaman.pdf · Base SAS® users) can benefit from using SAS® EG 14 SAS® Enterprise

Paper Used for this Presentation

Usage Note 18249: Setting up SAS® Enterprise Guide® to access remote data from a SAS® /Connect spawner or server.

http://support.sas.com/kb/18/249.html

Programming with Enterprise Guide 4 1 (Find Out What You’re Missing: Programming with SAS® EG - presented in RBC SAS® User Group Meeting Oct 21 2008 by Kamran Jafry)