Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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";
Posted
Updated 25-May-14 20:38pm
v2
Comments
CHill60 29-May-14 7:12am    
And what is wrong with the code? What is your question?

StringBuilder sascode = new StringBuilder();
WorkspaceManager wsm = new WorkspaceManager();
Workspace sasworkspace = (SAS.Workspace)wsm.Workspaces.CreateWorkspaceByServer("", SASWorkspaceManager.Visibility.VisibilityProcess, null, "", "", out xmlInfo);
sascode.Append("%inc '" + Directory.GetCurrentDirectory().Replace("Debug", "SAS_CODE") + "\\MODEL_RUN.sas';");
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";
 
Share this answer
 
Its working for me... Very nice and fast also....
 
Share this answer
 
its working fine and it is very useful to connect sas as back end
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900