Next Presentation: Using SAS® Enterprise Guide® the Same...

Post on 22-Sep-2020

1 views 0 download

Transcript of Next Presentation: Using SAS® Enterprise Guide® the Same...

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.

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

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

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

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®)

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

5

6

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

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

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.)

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

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):

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

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

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;)

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

rahman.sarker@rbc.com

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

data _null_; file mail;

put "Hi Rahman - "&sasjob. finished at

&tt.,";

run;

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

Questions?

Thank you

Contact: rahman.sarker@rbc.com

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)