SAS Example - Using WinExec() to run ppbS

* replace with installed location of ppbS;
%let ppbs = I:\vcProjects\ppbS\Release\ppbS.exe;

data _null_;
  rc = modulen("WinExec","&ppbs Create ""SAS is working on it""",0);
  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VSLIB"" crawltopos 1 20",0);
run;

data _null_; set SASHELP.VSLIB; run;

data _null_;
  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VSTABLE"" setpos 1 20 crawltopos 1 40",0);
run;

data _null_; set SASHELP.VSTABLE; run;

data _null_;

  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VMEMBER"" setpos 1 40 crawltopos 1 60",0);
run;

data _null_; set SASHELP.VMEMBER; run;

data _null_;
  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VCATALG"" setpos 1 60 crawltopos 1 80",0);
run;

data _null_; set SASHELP.VMEMBER; run;

data _null_;
  rc = modulen("WinExec","&ppbs SetText 1 ""Reading VCOLUMN"" setpos 1 80 crawltopos 1 100",0);
run;

data _null_; set SASHELP.VCOLUMN; run;

data _null_;

  rc = modulen("WinExec","&ppbs Shutdown",0);
run;


** a longer running example;
data _null_;
  loops = 2e6;
  updates = 20;

  command = "destroy 1 create ""Looping " || trim(left(put(loops,comma15.))) || " times""";
  rc = modulen("WinExec","&ppbs " || command,0);
  rc = modulen("WinExec","&ppbs showpct 1 yes",0);

  updaten = loops/updates;
  do i = 0 to loops;
    if mod (i,updaten) = 0 then do;
      command = "setpos 1 "      || put(i/loops*100,3.)

             || " crawltopos 1 " || put(i/loops*100+100/updates,3.);
      rc = modulen("WinExec","&ppbs " || command,0);
    end;
  end;

  rc = modulen("WinExec","&ppbs shutdown",0);
run;

You can learn more about SAS at http://www.sas.com.

SAS® software is a registered trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. SAS Institute Inc. is located at SAS Campus Drive, Cary, North Carolina 27513.