Private Sub Command2_Click() 'This is a VB6 program which calls PC SAS by passing the libname 'and file name and then calls PROC FSVIEW to browse the data. 'This shows how SAS can be called from VB and either left open to 'use SAS and examine SAS output, or hide SAS completely in the 'background to do certain tasks like sort data, do regressions, 'etc. You can either submit commands to SAS one at a time or 'build a batch routine and submit it all at once. 'by Jeffrey S. Morrison Set SASObj = CreateObject("SAS.Application") 'Set following line to False if you don't want to see SAS at all - i.e. keep in background. SASObj.Visible = True SASObj.Wait = True 'get SAS libname from path myperm = main.Label23.Caption myfile = main.Label25.Caption mystring = "libname perm '" & myperm & "';" SASObj.submit (mystring) 'get sas dataset name from path 'read in dataset but include processing for any new variables mystring = "Data work." & myfile & ";set perm." & myfile & ";" & preprocess.Text1 & "run;" SASObj.submit (mystring) SASObj.submit ("proc fsview data=" & myfile & ";run;") End Sub