StringBuilder sascode = new StringBuilder();
WorkspaceManager wsm = new WorkspaceManager();
Workspace sasworkspace = (SAS.Workspace)wsm.Workspaces.CreateWorkspaceByServer("", SASWorkspaceManager.Visibility.VisibilityProcess, null, "", "", out xmlInfo);
sascode.Append("%inc"+Your Sas Code Path);
ILanguageService langservice = sasworkspace.LanguageService;
langservice.Submit(sascode.ToString());
MessageBox.Show(langservice.FlushLog(1000));
if (MessageBox.Show("View SAS Log?", "View SAS Log", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
string saslog = langservice.FlushLog(10000000).Replace("/f", "");
RichTextBox rtb = new RichTextBox();
rtb.Size = new System.Drawing.Size(895, 545);
Form f2 = new Form();
f2.Text = "SAS Log";
f2.ClientSize = new System.Drawing.Size(900, 550);
f2.Controls.Add(rtb);
rtb.Text = saslog;
f2.Show();
}
To flush sas listing use this
if (MessageBox.Show("View SAS Listing?", "View SAS Listing", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
string saslisting = langservice.FlushList(100000000).Replace("ƒ", "_");
RichTextBox rtb2 = new RichTextBox();
rtb2.Size = new System.Drawing.Size(895, 545);
Form f3 = new Form();
f3.Text = "SAS Listing";
f3.ClientSize = new System.Drawing.Size(900, 550);
f3.Controls.Add(rtb2);
rtb2.Text = saslisting;
f3.Show();
}
return "Success";