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.
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.
2
We will see….
• What is it?
• Why it's needed?
• How to overcome limitations?
• How it's useful?
• How to implement?
• Benefits
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.
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
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
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
8
Receiving Warning and Note while opening multiple SAS sessions or parallel executing batch submit.
Limitations of Regular process
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
11
SASV9.CFG• For, The English language, the default configuration SASV9.CFG file is
stored in "\SASFoundation\9.2\nls\en\sasv9.cfg".
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"
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"
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"
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\"
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.
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' "
19
Combine all these options to append default SASV9.CFG and Create a New Project specific ConSPIC2013.CFG file
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.
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:
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?
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
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.
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