BookmarkSubscribeRSS Feed
Mike_Davis
Fluorite | Level 6

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

9 REPLIES 9
DanielSantos
Barite | Level 11

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

DanielSantos
Barite | Level 11

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

Mike_Davis
Fluorite | Level 6

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

Reeza
Super User

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.

Mike_Davis
Fluorite | Level 6

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

Mike_Davis
Fluorite | Level 6

I think this is a VB6 program under .net frame to call SAS
please advise

Thanks

Reeza
Super User

Right idea Smiley Happy.

Not sure if its VB6 or .NET though, guessing .NET

Some Microsoft language.

Ksharp
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 995 views
  • 0 likes
  • 4 in conversation