Top Banner
Copyright © 2013 Quintiles Customizing Project Specific SAS Session Saurabh Patel All opinions expressed in this presentation are the author’s personal views, and may not reflect the opinions or views of Quintiles.
28
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: D2S1T2N4_saurabh

Copyright © 2013 Quintiles

Customizing Project Specific SAS Session

Saurabh Patel

All opinions expressed in this presentation are the author’s personal views, and may not reflect the opinions or views of Quintiles.

Page 2: D2S1T2N4_saurabh

2

We will see….

• What is it?

• Why it's needed?

• How to overcome limitations?

• How it's useful?

• How to implement?

• Benefits

Page 3: D2S1T2N4_saurabh

3

What is it?• Build a Dynamic user friendly project specific SAS session with just one double

click. • Which allows users to Optimum use of system options and Direct access to

project specific documents from SAS window itself instead of windows explorer.

Page 4: D2S1T2N4_saurabh

4

Why it’s needed?

Page 5: D2S1T2N4_saurabh

5

Regular process to initialize project specific SAS session

First createSAS session

Then run particular project specific setup or autoexec file

Ready to work Project specific SAS

Session

1 2 Final

• Two Step (Open and Run) TIME consuming process• Always need to run first autoexec.sas or setup.sas file to initialize library

and import catalog.

Limitations of Regular process

Page 6: D2S1T2N4_saurabh

6

Unable to modify the default Text "SAS" of AWS title bar after startup of SAS .

• AWS title bar will be helpful to distinguish between multiple project SAS sessions.

Limitations of Regular process

Page 7: D2S1T2N4_saurabh

7

Unable to change initial location as project location for Open and Save As dialog after SAS startup.

• Need to update SAS initial folder location manually for each new session.

Limitations of Regular process

Page 8: D2S1T2N4_saurabh

8

Receiving Warning and Note while opening multiple SAS sessions or parallel executing batch submit.

Limitations of Regular process

Page 9: D2S1T2N4_saurabh

9

How to overcome these limitations?

Page 10: D2S1T2N4_saurabh

10

• The SAS configuration file contains only SAS system options that are used to establish SAS session.

• Differences between Configuration and Autoexec Files

• Configuration file can contain only SAS system options settings, while autoexec files can contain any valid SAS statement.

• Configuration files are processed before SAS initializes, while autoexec files are processed immediately after SAS initializes.

• User can edit the default configuration file to add or to change the system option settings, or can create own project specific configuration file.

• Then user can specify own project specific configuration file to act as the configuration file, thus overriding the default SASV9.CFG file.

SASV9.CFG

Page 11: D2S1T2N4_saurabh

11

SASV9.CFG• For, The English language, the default configuration SASV9.CFG file is

stored in "\SASFoundation\9.2\nls\en\sasv9.cfg".

Page 12: D2S1T2N4_saurabh

12

Examples of useful SAS system options

How it's useful?

Page 13: D2S1T2N4_saurabh

13

AWSTITLE

• Syntax-AWSTITLE "title-text"> "Title-text" specifies the text that appears in the title bar of the main

SAS window. > The text must be enclosed in either single or double quotation marks.

-awstitle "ConSPIC 2013"

Page 14: D2S1T2N4_saurabh

14

AUTOEXEC• Syntax

-AUTOEXEC "file-specification"> specifies the SAS autoexec filename with path to initialize library and

import catalog.

-autoexec "C:\users\desktop\ConSPIC 2013\setup.sas"

Page 15: D2S1T2N4_saurabh

15

SPLASH and SPLASHLOC• Syntax

-SPLASH | -NOSPLASH> Specifies whether to display the splash screen (logo screen) when SAS starts.

• -SPLASHLOC DLL-name <res-number> | BMP-filename> Specifies the location of the splash screen bitmap that appears when SAS starts.

-SPLASHLOC "C:\users\desktop\ConSPIC 2013\ConSPIC.bmp"

Page 16: D2S1T2N4_saurabh

16

SASINITIALFOLDER• Syntax

-SASINITIALFOLDER "path of location"> specifies the path of the project folder as the default folder for the

Open and Save As dialog boxes.> If path contains spaces, it must be enclosed in quotation mark.

-SASINITIALFOLDER "C:\Users\Desktop\ConSPIC 2013\"

Page 17: D2S1T2N4_saurabh

17

RSASUSER

• Syntax-RSASUSER| -NORSASUSER> RSASUSER limits access to the Sasuser data library to read-only access.

• So, By defining RSASUSER, User can avoid these note and warnings while opening multiple SAS Sessions and parallel executing batch mode.

Page 18: D2S1T2N4_saurabh

18

REGISTER• Adds an application to the Tools menu in the main SAS window. • If file path contains space then put path in single inverted quotation and

add double quotation with one space as prefix and suffix.

-register "SAP" " 'C:\Users\Desktop\ConSPIC\sap v1\sap.docx' "

-register "Mock Shell" " 'C:\Users\Desktop\ConSPIC\shell\mock shell.rtf' "

-register "Protocol" " 'C:\Users\Desktop\ConSPIC\protocol\protocol.pdf' "

Page 19: D2S1T2N4_saurabh

19

Combine all these options to append default SASV9.CFG and Create a New Project specific ConSPIC2013.CFG file

Page 20: D2S1T2N4_saurabh

20

How to implement Dynamic process with project specific SASV9.CFG?

Page 21: D2S1T2N4_saurabh

21

Dynamic process to initialize project specific SAS session

1

Just execute (double-click) Project Specific Shortcut File

Ready to work Project specific SAS Session

Final

Windows Shortcuts

• Shortcuts are one of the handiest features on the Windows operating system.

• The shortcuts can be kept on the desktop or inside a special folder.

• Double-clicking the icon makes it very convenient to activate the application without keeping track of the application’s actual location.

Page 22: D2S1T2N4_saurabh

22

1. Make a copy from the existing SAS shortcut on the desktop.

2. Right-click on the desktop and click New on the context menu, and then select Shortcut on the extended submenu. Click the Browse button to find the sas.exe file in the !SASROOT directory.

3. Using Shell Scripting or Windows Scrip Host.

A SAS shortcut can be created in a number of different ways:

Page 23: D2S1T2N4_saurabh

23

It is very convenient to open multiple project specific SAS Sessions from location.

But sometimes it will lead to major human error like transfer of one project code to other project.

How to restrict only one project specific SAS Session at a time?

Page 24: D2S1T2N4_saurabh

24

VB Script Shortcut• VBScript has been pre-installed in every Windows OS since Windows 98• It is very simple to create. Create New Notepad file and put below code in text

file and SAVE AS file with .vbs file extension.

Set WshShell = WScript.CreateObject ("WScript.Shell")Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from Win32_Process")For Each objProcess in colProcessListIf objProcess.name = "sas.exe" then

vFound = TrueEnd ifNext

Select case vFoundcase True WshShell.Run("taskkill /im sas.exe /t")case else WshShell.Run("D:\sas\sas.exe -config 'C:\Users\Desktop\ConSPIC 2013\ConSPIC2013.CFG' ")

End Select

It will check whether any SAS Session open or Not?

IF True, Then it will ask to Close first Session

Else, It will initialize Project Specific SAS Session

Page 25: D2S1T2N4_saurabh

25

Benefits

• Dynamic process(single step process) is helpful to save time.

• Just one time creation of customize project specific config file like autoexec file is helpful to optimum use of SAS system options.

• Direct Access to project specific documents from SAS window, is very convenient and user-friendly.

• Specifying latest working version of documents(like SAP, Mock Shell) in Tools Menu bar is reducing ambiguity regarding project specific documents.

• Prevent major human error by allowing only One Project Specific SAS Session at a time.

Page 26: D2S1T2N4_saurabh

26

References

• Cheng, Wei (2003). “Build a SAS Development Environment under Windows,” Proceedings of the 28th annual SAS Users Group Conference

http://www2.sas.com/proceedings/forum2007/063-2007.pdf

• Crawford, Peter (2007) “Easy SAS Session Customization,” Proceedings of the 27th annual SAS Users Group Conference

http://www2.sas.com/proceedings/forum2007/051-2007.pdf

• Hurley, George J. (2007). “Customizing Your SAS Initialization,” Proceedings of the 27th annual SAS Users Group Conference

http://www2.sas.com/proceedings/forum2007/063-2007.pdf

• Thatcher, Clark (2010). “Make Your SAS Code Environmentally Aware,” Proceedings of SAS Global Forum 2010

http://support.sas.com/resources/papers/proceedings10/090-2010.pdf

Page 27: D2S1T2N4_saurabh

27

Page 28: D2S1T2N4_saurabh

28

Contact: [email protected]