Desktop productivity for business analysts and programmers

SAS EG Scripting (VB.NET): Importing data sets and running code on this does not work

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

SAS EG Scripting (VB.NET): Importing data sets and running code on this does not work

Hi,

 

I am working on a little VB.NET program to automate some stuff we are doing on a regular basis with SAS EG 5.1. The SAS EG projects contains a process flow that first imports an excel xlsx file into the WORK library and then I run some SAS code on this file. 

The VB.NET code looks like this:

 

 

Dim app As SAS.EG.Scripting.Application
Dim prjObject As SAS.EG.Scripting.Project

app = New SAS.EG.Scripting.Application()
prjObject = app.Open("Test.egp", "")
prjObject.Run()

When I look into the log file of the code I run in the debugger (prjObject.ContainerCollection.Item("Prozessfluss").Items(2).Log.Text) I find the following error:

 

[...]
41 proc sql;
42 select *
43 from work.test
44 ;
ERROR: File WORK.TEST.DATA does not exist.
[...]

But I can export the file with the following code:

 

Dim file As SAS.EG.Scripting.File = prjObject.ContainerCollection.Item("Process Flow").Items("Test.xlsx")
file.Tasks(0).Run()
file.Tasks(0).OutputDatasets(0).SaveAs("C:\temp\test.html")

What's going on here?


Accepted Solutions
Solution
‎09-29-2016 03:52 AM
Occasional Contributor
Posts: 12

Re: SAS EG Scripting (VB.NET): Importing data sets and running code on this does not work

No, we ar not running a SAS Grid Computing environment. My solution now is, thanks for your suggestion, to import the file to a permanent library.

 

Thanks everyone for your help!

View solution in original post


All Replies
Super User
Posts: 11,129

Re: SAS EG Scripting (VB.NET): Importing data sets and running code on this does not work

I don't speak VB.net but the third snippet of code does not appear to reference a SAS data set. Is the result perhaps SAS Log items or proc output?

 

Does the TEST.egp have a hard coded reference to read a specific XLSX file? If so I would examine the log for that bit way before the Proc SQL you show.

Community Manager
Posts: 2,889

Re: SAS EG Scripting (VB.NET): Importing data sets and running code on this does not work

It looks like the Project.Run() isn't executing the Import Data task -- or the task is creating WORK data in a session that's different than the next step uses.  Are you running in a SAS Grid Computing environment, where you might need to target a shared WORK location or permanent library for the data that you import?

Solution
‎09-29-2016 03:52 AM
Occasional Contributor
Posts: 12

Re: SAS EG Scripting (VB.NET): Importing data sets and running code on this does not work

No, we ar not running a SAS Grid Computing environment. My solution now is, thanks for your suggestion, to import the file to a permanent library.

 

Thanks everyone for your help!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 604 views
  • 0 likes
  • 3 in conversation