Help using Base SAS procedures

What SAS environment could run this SAS code?

Reply
Regular Contributor
Posts: 222

What SAS environment could run this SAS code?

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

Super Contributor
Posts: 474

Re: What SAS environment could run this SAS code?

Posted in reply to Mike_Davis

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

Regular Contributor
Posts: 222

Re: What SAS environment could run this SAS code?

Posted in reply to DanielSantos
Super Contributor
Posts: 474

Re: What SAS environment could run this SAS code?

Posted in reply to Mike_Davis

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

Regular Contributor
Posts: 222

Re: What SAS environment could run this SAS code?

Posted in reply to DanielSantos

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

Super User
Posts: 19,810

Re: What SAS environment could run this SAS code?

Posted in reply to Mike_Davis

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.

Regular Contributor
Posts: 222

Re: What SAS environment could run this SAS code?

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

Regular Contributor
Posts: 222

Re: What SAS environment could run this SAS code?

Posted in reply to Mike_Davis

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

Thanks

Super User
Posts: 19,810

Re: What SAS environment could run this SAS code?

Posted in reply to Mike_Davis

Right idea Smiley Happy.

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

Some Microsoft language.

Super User
Posts: 10,028

Re: What SAS environment could run this SAS code?

Posted in reply to Mike_Davis

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.

Ask a Question
Discussion stats
  • 9 replies
  • 355 views
  • 0 likes
  • 4 in conversation