SASCBTBL Routine Statements

by Richard A. DeVeneziaSend Feedback

These Windows API interfaces have not been peer tested for quality assurance and are presented as-is. Use at your own risk.
Send questions or feedback to Richard A. DeVenezia

SAS DATA Step and SAS/AF SCL programs use the ModuleN() and ModuleC() functions to call routines that reside in external dynamic link libraries (.dll) Each routine you call must be invoked with the proper number of arguments and types (known as attribute information). This information is stored in a text file that is referenced by the fileref SASCBTBL.

I don't know what SASCBTBL stands for exactly, I think of it as "SAS Control Block TaBLe." However, according to a birdie:

It's actually an abbreviation for SAS CoBol Table. Why that? The original version of MODULE was called COBOLINT. It was intended as a COBOL interface for sites that wanted to call COBOL routines from within the DATA step.

Essential References

New samples: MD5
 
rad4sas.dll - Richard A. DeVenezia
Download rad4sas.dllrad4sas.dll Place rad4sas.dll in a folder in your system %PATH%.
Download rad4sas.crad4sas.c rad4sas.dll was compiled by MS Visual C++ 5.0
Routine Purpose Example
DisableProcessWindows-
SystemMenuCloseItem
Disable close item in SAS session window system menu, also greys the X close window icon.

Principal design inspired by discussion in newsgroup comp.soft-sys.sas (SAS-L) regarding how to prevent SAS session exits that would cause a SAS/AF application (typically invoked using SAS -initcmd command line option) to end without running it's TERM section.
sample
GetProcessChildWindows Return into a SAS data step temporary array a list of Win32 window handles of a SAS session's process owned top-level windows and their child windows. Sample includes: GetWindowTextA, GetMenu, GetSubMenu and GetMenuItemInfoA sample
 
user32.dll - Windows API
Routine Purpose Example
MessageBoxA User dialog sample
MessageBeep Play a sound  
FindWindow Get hWnd of a window sample
GetSytemMenu Get hMenu of a window sample
RemoveMenu Manipulate a windows menu sample
 
comdlg32.dll - Windows API
Routine Purpose Example
GetOpenFileNameA Dialog for selecting multiple files sample
 
kernel32.dll - Windows API
Routine Purpose Example
GetCommandLineA How was SAS started ? sample
GetCurrentProcessId What is the SAS session process id ? sample
CopyFileA Copy a file  
MoveFileA Rename or move a file  
DeleteFileA Delete a file sample
GetFileAttributesA
SetFileAttributesA
Get or Set file attributes sample
GetDiskFreeSpaceA Disk information  
RemoveDirectoryA Delete a folder  
CreateDirectoryA Create a folder  
GetCurrentDirectoryA Get current directory  
WinExec Run another program sample
GlobalMemoryStatus    
GlobalAlloc    
GlobalLock    
GlobalUnlock    
GlobalFree    
FindFirstFileA   sample
FindNextFileA  
FindClose  
FileTimeToLocalFileTime  
FileTimeToSystemTime  
RtlFillMemory    
GetCommandLineA
GetBinaryTypeA
GetCompressedFileSizeA
GetFileAttributesA
GetFileAttributesExA
GetFileTimeA
FileTimeToLocalFileTime
FileTimeToSystemTime
CreateFileA
GetFileSize
CloseHandle
These file management routines obtain information about a specific file  
 
advapi32.dll - Windows API
Routine Purpose Example
RegOpenKeyEx
RegCloseKey
RegQueryValueEx
RegSetValueEx
RegQueryInfoKey
RegEnumValue
Manipulate windows registry.
Sample 1 changes registry keys so that the next Enhanced Editor window that opens has a different font.
Sample 2 exposes information Microsoft stores under UserAssist registry key.
sample 1
sample 2
GetUserNameA Determine name of logged in user sample
GetFileSecurityA
GetSecurityDescriptorOwner
LookupAccountSidA
Determine a file's owner sample
 
cryptdll.dll - Windows API
Routine Purpose Example
MD5Init
MD5Update
MD5Final
One way encrypt data values. Useful for password files and blinding personal aspects of data that is distributed for study. sample
 
wsock32.dll - Windows API
WSAStartup
WSACleanup
gethostname
gethostbyname
  sample
 
odbc32.dll - Windows API
SQLAllocHandle
SQLFreeHandle
SQLSetEnvAttr
SQLDataSources
SQLGetDiagRec
Get list of ODBC Data Source Names, SYSTEM or USER or both sample
 
Clipboard Example
user32.dll
FindWindow
RegisterClipboardFormat
OpenClipboard
EmptyClipboard
CloseClipboard
SetClipboardData

kernel32.dll
GlobalAlloc
GlobalLock
GlobalUnlock
RtlMoveMemory
Use DATA Step to programmatically place text, html or rtf in the Windows clipboard so that it may be pasted elsewhere (manually or dde). sample

These Windows API interfaces have not been peer tested for quality assurance and are presented as-is. Use at your own risk.
Send questions or feedback to Richard A. DeVenezia

Can't find Windows functions for direct file management ?
Last I looked it was at this awkward drill:
MSDN Library
 Windows Development
  » Windows Base Services
   » Files and I/O
    » SDK Documentation
     » Storage
      » Storage Reference
       » File Management Reference
        » File Management Functions

This page was last updated 18 November 2008.