Hello everyone,
Could anyone tell me what SAS environment can run the SAS code below?
I submit this code in SAS base will cause error.
Thanks
Mike
Dim obSAS As SAS.Workspace
Dim obWorkspaceManager As New SASWorkspaceManager.WorkspaceManager
Private Sub Form_Load()
Dim obConnection As New ADODB.Connection
Dim obRecordSet As New ADODB.Recordset
Dim errorString As String
Set obSAS = obWorkspaceManager.Workspaces.CreateWorkspaceByServer(
"MyWorkspaceName", VisibilityProcess, Nothing, "", "",
errorString)
obSAS.LanguageService.Submit "data a; x=1; y=100; output; x=2;
y=200; output; run;"
obConnection.Open "provider=sas.iomprovider.1; SAS Workspace ID="
+ obSAS.UniqueIdentifier
obRecordSet.Open "work.a", obConnection, adOpenStatic,
adLockReadOnly, adCmdTableDirect
obRecordSet.MoveFirst
Debug.Print obRecordSet(1).Value
End Sub
Private Sub Form_Unload(Cancel As Integer) ' If we don't close SAS, the
' SAS process might run forever
If Not (obSAS is Nothing) Then
obWorkspaceManager.Workspaces.RemoveWorkspace obSAS
obSAS.Close
End If
End Sub
I'm sorry but the sample above is not to be executed within SAS.
From the looks, this is Basic language from the windows/microsoft .NET framework.
What are you trying to achieve?
Cheers from Portugal.
Daniel Santos @ www.cgd.pt
Which is under the "Windows Clients" Section.
Still don't know what are your needs, but if you're interested in interacting with SAS from the Windows Platform you should read this before trying to run the samples:
http://support.sas.com/rnd/itech/doc9/dev_guide/dist-obj/winclnt/index.html
Cheers from Portugal.
Daniel Santos @ www.cgd.pt
My question is :
what SAS environment can run the SAS code below?
and if it is not a SAS code, under what condition it could be run?
Thanks
Mike
Take a look at the code closely.
You'll see some base sas code in there.
data a; x=1; y=100; output; x=2;
y=200; output; run
This is how you would call that code from Windows using Microsoft .NET integration services.
So to answer your direct question, BASE SAS or a SAS SERVER being called through a .NET interface.
Hi Reeza,
Thank you very much for your help.
But I am so confused about what you are trying to explain to me,
let me refresh my question,could you run this:
/***********************************************code begin************************************************************************/
Dim obSAS As SAS.Workspace
Dim obWorkspaceManager As New SASWorkspaceManager.WorkspaceManager
Private Sub Form_Load()
Dim obConnection As New ADODB.Connection
Dim obRecordSet As New ADODB.Recordset
Dim errorString As String
Set obSAS = obWorkspaceManager.Workspaces.CreateWorkspaceByServer(
"MyWorkspaceName", VisibilityProcess, Nothing, "", "",
errorString)
obSAS.LanguageService.Submit "data a; x=1; y=100; output; x=2;
y=200; output; run;"
obConnection.Open "provider=sas.iomprovider.1; SAS Workspace ID="
+ obSAS.UniqueIdentifier
obRecordSet.Open "work.a", obConnection, adOpenStatic,
adLockReadOnly, adCmdTableDirect
obRecordSet.MoveFirst
Debug.Print obRecordSet(1).Value
End Sub
Private Sub Form_Unload(Cancel As Integer) ' If we don't close SAS, the
' SAS process might run forever
If Not (obSAS is Nothing) Then
obWorkspaceManager.Workspaces.RemoveWorkspace obSAS
obSAS.Close
End If
End Sub
/*****************************************************end of code*********************************************************************************/
in SAS base?
you said base sas being called through a .NET interface could run this code,I don't have too much knowledge of .NET interface,
what is "Dim" here means? is that a program language outside SAS?
could you give me an example?
Thanks a lot!
Mike
I think this is a VB6 program under .net frame to call SAS
please advise
Thanks
Right idea .
Not sure if its VB6 or .NET though, guessing .NET
Some Microsoft language.
You need a SAS server under IOM (Integrated Open Model) framework to run this code .Search it at support.sas.com you will find more information.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.