All YOUR Questions Answered at
[sas.answers @ Holland Numerics]
WebRing
Sponsored Links for SAS Software Users
Careers, Jobs and Contracts, Services and Products

Frequently Asked Questions about SAS Software

The following Question & Answer List is based on SAS questions received by the author.

Using DDE with SAS Software

Question Answer
How do you run some SAS code while using VB? Provided you only want to run a simple program that would normally run in the SAS Program Editor, you can use VB and DDE, like in the following VB code, to simulate the typing of a SAS programmer, e.g.:
	rc = Shell("c:\sas\sas.exe", vbMaximizedFocus)	'start SAS in maximized window
	For i = 1 to 1000	'wait for SAS to initialize
		DoEvents()
	Next i
	SendKeys "%GP", True	'Globals, Program Editor
	SendKeys "{%}let macrovar = 1234;~", True	'set SAS macro variable
	SendKeys "dm 'af c=lib.cat.prog.frame' af;~", True	'run AF application
	SendKeys "%LS"	'Locals, Submit
	SendKeys "%GP", True	'Globals, Program Editor
	SendKeys "endsas;~", True	'Exit SAS
	SendKeys "%LS"	'Locals, Submit
This is the same as starting a SAS session, typing the following Base SAS code in the Program Editor, submitting the SAS code, which also ends the SAS session after the AF Frame application has completed:
	%let macrovar = 1234;
	dm 'af c=lib.cat.prog.frame' af;
	endsas;

     Back to Main FAQ Menu
Number of visitors = Counter (since 15th May 2000)

Email: Phil Holland <phil.holland@bcs.org.uk>

Web Design by Holland Numerics

Valid HTML 4.01!