Presentation is loading. Please wait.

Presentation is loading. Please wait.

Making Remote Processing Less Remote

Similar presentations


Presentation on theme: "Making Remote Processing Less Remote"— Presentation transcript:

1 Making Remote Processing Less Remote
By Chris Moriak

2 What is Remote Processing?
Local Remote Office Unix T-1 Home 56 Kbps 4/7/2019 By Chris Moriak

3 This presentation explains how to use remote processing.
ABSTRACT This presentation explains how to use remote processing. This presentation does not explain how to establish a remote processing link. 4/7/2019 By Chris Moriak

4 This presentation is for anyone that… Has SAS on the PC
ABSTRACT Most programming books either ignore this topic of using remote processing or relegate their discussion to the client-server connection. This presentation is for anyone that… Has SAS on the PC A connection to a remote server, such as UNIX, that has SAS installed Does not know how to submit SAS code to the UNIX via the PC 4/7/2019 By Chris Moriak

5 What Can Remote Processing Do for You?
Take advantage of the remote server’s greater computing power (UNIX vs. PC) Free up valuable PC resources Avoid using UNIX interactive SAS 4/7/2019 By Chris Moriak

6 Connection Script Connection scripts can be obtained at www.sas.com
Sample SAS code accessing UNIX script: %LET rlink= tcpunix_sas82a.scr; %LET MYUNIX = ; %LET HOST=myunix ; %LET SCRIPT = &RLINK ; FILENAME RLINK "&SCRIPT" ; OPTIONS COMAMID=TCP REMOTE= &HOST; signon myunix ; 4/7/2019 By Chris Moriak

7 Separate But Linked The local (PC) SAS session and the remote (e.g. UNIX) SAS session are separate SAS sessions. Using SAS/CONNECT® software links them. 4/7/2019 By Chris Moriak

8 Separate But Linked Office Unix Home T-1 56 Kbps 4/7/2019
By Chris Moriak

9 Separate But Linked The local and remote SAS sessions do not share:
Libnames WORK libraries Formats Macros Variables Programs Access to programs 4/7/2019 By Chris Moriak

10 RSUBMIT / ENDRSUBMIT To submit code on the remote session from the local session, simply add the command “RSUBMIT;” before the block of code, followed by the command “ENDRSUBMIT;”. RSUBMIT tells SAS to submit the subsequent block of code on the remote session. ENDRSUBMIT tells SAS to stop submitting code to the remote session. 4/7/2019 By Chris Moriak

11 RSUBMIT / ENDRSUBMIT rsubmit; data new; myvar=today(); run;
set new; newvar=myvar/3.14;   endrsubmit; 4/7/2019 By Chris Moriak

12 What About the Log? After the remote session is finished, the log information will be transferred to the local log. All the remote session’s log options (e.g. mprint, symbolgen) will be used. NOTE: Remote submit to USOC commencing. NOTE: The data set WORK.MYDAT has 1 observations and 1 variables. NOTE: DATA statement used: real time seconds cpu time seconds NOTE: Remote submit to USOC complete. 4/7/2019 By Chris Moriak

13 What About the Output? After the remote session if finished processing, all output created will be transferred to the local OUTPUT window. The remote session’s output options (e.g. LS, PS) will be used. 4/7/2019 By Chris Moriak

14 LIBNAMES Creating local libname to remote directory:
libname libref “directory” server=server_id ; Creating libname on remote session: rsubmit; libname libref “directory”; endrsubmit; 4/7/2019 By Chris Moriak

15 LIBNAMES Example to create libref “mydata” on both sessions: rsubmit;
libname mydata “/tmp/mydata”; endrsubmit; libname mydata “/tmp/mydata” server=usoc; - or - libname mydata server=usoc slibref=mydata; 4/7/2019 By Chris Moriak

16 LIBNAMES Creating local libname to remote WORK library:
libname libref server=server_id slibref=work; Example: libname rwork server=usoc slibref=work; 4/7/2019 By Chris Moriak

17 Access and Viewing Remote Data
The local libref to the remote directory allows the user to access and view the data as if it were local. Double-click on data set in SAS Explorer Use FSEDIT libref.data_set Use as valid libref in SAS programs 4/7/2019 By Chris Moriak

18 Local Libref to Remote Directory vs. Remote Processing
Example: Using Local Libref to UNIX proc sort data=s123.pft out=pft; by subject _timept asm_dat act_tim; run; NOTE: There were observations read from the data set S123.PFT. NOTE: The data set WORK.PFT has observations and 84 variables. NOTE: PROCEDURE SORT used: real time seconds cpu time seconds 4/7/2019 By Chris Moriak

19 Local Libref to Remote Directory vs. Remote Processing
Office Unix T-1 56 Kbps Home 4/7/2019 By Chris Moriak

20 Local Libref to Remote Directory vs. Remote Processing
Example: Using RSUBMIT to UNIX rsubmit; proc sort data=s123.pft out=pft; by subject _timept asm_dat act_tim; run; endrsubmit; 4/7/2019 By Chris Moriak

21 Local Libref to Remote Directory vs. Remote Processing
Example: Using RSUBMIT to UNIX NOTE: Remote submit to USOC commencing. NOTE: There were observations read from the data set S123.PFT. NOTE: The data set WORK.PFT has observations and 84 variables. NOTE: PROCEDURE SORT used: real time seconds cpu time seconds NOTE: Remote submit to USOC complete. 4/7/2019 By Chris Moriak

22 Local Libref to Remote Directory vs. Remote Processing
Office Unix T-1 56 Kbps Home 4/7/2019 By Chris Moriak

23 PROC UPLOAD / DOWNLOAD These two procedures from SAS®/CONNECT allow the user to upload to and download from the remote session data, catalogs, and files. These procedures are executed on the remote session, thus they must be enclosed in a RSUBMIT/ ENDRSUBMIT block. PROC UPLOAD / DOWNLOAD is significantly faster in transferring data between the local and remote sessions than a data step. 4/7/2019 By Chris Moriak

24 PROC UPLOAD / DOWNLOAD Syntax for Data: rsubmit;
proc upload data = local_libref.dataset out = remote_libref.dataset; run; proc download data = remote_libref.dataset out = local_libref.dataset; endrsubmit; 4/7/2019 By Chris Moriak

25 Formats Problem: The local and remote SAS sessions do not have access to each other’s formats in SAS 6.12. In SAS v8, the remote session still does not have access to the local session’s formats. Although the user can copy the PROC FORMAT code and surround it with the RSUBMIT and ENDRSUBMIT statements, this can be impractical when there are many formats or if the user does not have access to the PROC FORMAT code. 4/7/2019 By Chris Moriak

26 Formats Solution: PROC UPLOAD / DOWNLOAD allows the user to quickly pass formats via the FORMATS catalog to the other session. 4/7/2019 By Chris Moriak

27 Formats Syntax for Catalogs: rsubmit;
proc upload incat = local_libref.catalog outcat = remote_libref.catalog ; select entry_list.entry_type; run; endrsubmit; 4/7/2019 By Chris Moriak

28 Formats Syntax for Catalogs: **transfer formats numfmt. and $charfmt.;
rsubmit; proc upload incat=formats outcat=formats ; select numfmt.format charfmt.formatc; run; endrsubmit; 4/7/2019 By Chris Moriak

29 Macro Variables Problem: The local and remote SAS sessions do not have access to each other’s macro variables. Thus, just like with formats, the user must define macro variables in the specific sessions. 4/7/2019 By Chris Moriak

30 Macro Variables Solution: To pass remote macro variables to the local session, SAS/CONNECT comes with the SAS system macro %SYSRPUT. To pass local macro variables to the remote session, use the macro %SYSLPUT that is a SAS system macro in Version 8. 4/7/2019 By Chris Moriak

31 Macro Variables Creating local macro variables from remote macro variables: rsubmit;  %sysrput newvar=&oldvar ; endrsubmit;   4/7/2019 By Chris Moriak

32 Macro Variables rsubmit; %let x = Hello; %sysrput z = &x; endrsubmit;
NOTE: Remote submit to USOC commencing. NOTE: Remote submit to USOC complete. ===> Hello 4/7/2019 By Chris Moriak

33 Macro Variables Creating remote macro variables from local macro variables:  %syslput newvar=&oldvar ; 4/7/2019 By Chris Moriak

34 Macro Variables %let s = Goodbye; %syslput w = &s; rsubmit;
endrsubmit; NOTE: Remote submit to USOC commencing. ===> Goodbye NOTE: Remote submit to USOC complete. 4/7/2019 By Chris Moriak

35 Executing Other Programs
Problem: The local and remote SAS sessions do not have access to each other’s programs unless the systems are mounted. At times, the user may want to submit a program on the remote server. Although the user could surround the program code with RSUBMIT and ENDRSUBMIT, this can be impractical or impossible. 4/7/2019 By Chris Moriak

36 Executing Other Programs
Solution: Use PROC UPLOAD to either upload the file to the remote server, or upload a catalog containing the program source code. 4/7/2019 By Chris Moriak

37 Executing Other Programs
Uploading a file and submitting it: filename local_fileref “local_file_path”; rsubmit; filename remote_fileref “remote_file_path”; proc upload infile =local_fileref outfile=remote_fileref ; run; %include remote_fileref ; endrsubmit; 4/7/2019 By Chris Moriak

38 Executing Other Programs
Uploading a file and submitting it: filename myfile “c:\temp\sortit.sas”; rsubmit; filename a_file “/tmp/mydata/sortit.sas”; proc upload infile = myfile outfile= a_file ; run; %include a_file ; endrsubmit; 4/7/2019 By Chris Moriak

39 Conclusion By understanding the two sessions are separate and learning the techniques outlined in this presentation, hopefully remote processing is now less remote to you. 4/7/2019 By Chris Moriak

40 References SAS Institute Inc., SAS/CONNECT® Software: Usage and Reference, Version 6, Second Edition, Cary, NC: SAS Institute Inc., 1994. Moriak, Chris. “Making Remote Processing Less Remote.” NESUG ’01 Proceedings, pp 4/7/2019 By Chris Moriak


Download ppt "Making Remote Processing Less Remote"

Similar presentations


Ads by Google