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 Win31 DLLs with SAS Software

Question Answer
How can I make a Windows-style message box, with OK and Cancel buttons, from SAS Software? First create a flat file, e.g. C:\WINAPI.TXT, to store the following lines of code:
routine MessageBox
  module=USER
  arch=BIT16
  returns=SHORT
  stackpop=CALLED
  minarg=4
  maxarg=4
  stackorder=L2R
;
arg 1 input format=pib2. byvalue;
arg 2 input format=$cstr200.;
arg 3 input format=$cstr200.;
arg 4 input format=pib2. byvalue;

This flat file needs to be given a fileref of SASCBTBL, and the message box is created using the MessageBox function:

filename sascbtbl 'c:\winapi.txt';
 
data _null_;
  length rc hWnd style 8 text caption $200;
  hWnd=0;
  text='Text';
  caption='Caption';
  style=(0*4096)+(0*256)+(2*16)+(1*1);
    * 0021 = Question mark icon + OK/Cancel *;
  rc=modulen('*ie','MessageBox',hWnd,text,caption,style);
  if (rc=0) then put 'ERROR: Cannot create message box';
  put rc=;
run;

The button style values are:
OK=0, OK/Cancel=1, Abort/Retry/Ignore=2, Yes/No/Cancel=3, Yes/No=4, Retry/Cancel=5
The icon style values are:
Stop sign=10, Question mark=20, Exclamation mark=30, Information sign=40
The possible return values are:
Error state=0, OK=1, Cancel=2, Abort=3, Retry=4, Ignore=5, Yes=6, No=7

How can I find out the versions of Windows and DOS being used from SAS Software? First create a flat file, e.g. C:\WINAPI.TXT, to store the following lines of code:
routine GetVersion
  module=KERNEL
  arch=BIT16
  returns=ULONG
  stackpop=CALLED
  minarg=0
  maxarg=0
  stackorder=L2R
;

This flat file needs to be given a fileref of SASCBTBL, and the message box is created using the GetVersion function:

filename sascbtbl 'c:\winapi.txt';
 
data _null_;
  length temp 8 dosver winver $5;
  rc=modulen('*e','GetVersion');
  temp=rc;
  dosver='  .  ';
  winver='  .  ';
  substr(dosver,1,2)=put(mod(temp,256),2.);
  temp=int(temp/256);
  substr(dosver,4,2)=put(mod(temp,256),z2.);
  temp=int(temp/256);
  substr(winver,1,2)=put(mod(temp,256),2.);
  temp=int(temp/256);
  substr(winver,4,2)=put(mod(temp,256),z2.);
  put winver= dosver=;
run;
How can I find out the screen size being used from SAS Software? First create a flat file, e.g. C:\WINAPI.TXT, to store the following lines of code:
routine GetSystemMetrics
  module=USER
  arch=BIT16
  returns=SHORT
  stackpop=CALLED
  minarg=1
  maxarg=1
  stackorder=L2R
;
arg 1 input format=pib2. byvalue;

This flat file needs to be given a fileref of SASCBTBL, and the message box is created using the GetSystemMetrics function:

filename sascbtbl 'c:\winapi.txt';
 
data _null_;
  length index 8;
  index=0; * Width of screen (pixels) *;
  width=modulen('*e','GetSystemMetrics',index);
  put 'Screen width: ' width;
  index=1; * Height of screen (pixels) *;
  height=modulen('*e','GetSystemMetrics',index);
  put 'Screen height: ' height;
run;

     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!