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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.