I’m writing a VB.Net program that uses SASEGScripting to populate parameter values and run SAS EG projects. The particular project I’m using for testing contains three different parameter types: “ProjectParamTypeString(5)”, "ProjectParamTypeString(0)", and "ProjectParamTypeDate(0)".
"ProjectParamTypeString(5)" is easy enough, I simply assign a string value to Project.Parameter(i).Value. How do I assign values to the other two types? Is there some documentation on ProjectParamTypes and how to use them in .Net?
Please post a section of code so it provides some context. I use C# but might be able to help if I can see the context that you are referring to.
EG is written (a lot) in C#. FRirst of all, I suggest using C# in .NET vs VB.NET: it will make your life easier...and is a better language IMO.
Let's take a look at one piece of code in your program (converted to C#):
// Date range: From Date and Thru Date
// prm.Value = ?
case "SVC_DT": // ProjectParmTypeDate(0)
{
break;
}
The type is Date so it expects a date. .NET does not have a Date type so you need to use a DateTime value. Hence, it needs to either be cast or converted. Sample C# code:
prm.Value = (DateTime) ProjectParmTypeDate(0);
...or...
prm.Value = DateTime.Parse(ProjectParmTypeDate(0));
The right-hand side of the equals sign needs to match the type on the left. .NET (VB or C#), are strongly typed languages. if you are getting your parms as strings, they don't fit inside of a DateTime.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.