BookmarkSubscribeRSS Feed
deleted_user
Not applicable
How can I check, in an EG 4.2 custom task, if a string contains a valid output data set name?

Is there a method provided in the Custom Task API to do that?
6 REPLIES 6
Patrick
Opal | Level 21
Have a look at the SAS functions nvalid() and notname()
deleted_user
Not applicable
Hello,

I'm building a custom task using VB. I cannot run SAS code from within VB.

Thanks.
Patrick
Opal | Level 21
I see. Sorry, misunderstood your question!

I was browsing through the API docu ( http://support.sas.com/documentation/onlinedoc/guide/customtasks/index.htm ) but couldn't find a method covering what you're looking for.

Couldn't you just implement this by using a Regular Expression? I don't think this should be too difficult. http://www.regular-expressions.info/dotnet.html

May be this paper is also helpful for you:
http://www.lexjansen.com/mwsug/2007/ApplicationDev/A10-2007.pdf

HTH (at least a bit)
Patrick
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
When you say "...contains a valid output data set name". How far do you expect the validity check to go - possibly beyond syntax, meaning to check the particular filesystem environment?

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
I use a data set selector. I put the selected data set name into a textbox. The text box is editable. The user can modify the name. After the value has been modified, I would like to validate it.

I would like to do the same thing that the summary statistics does in the Results pane for the statistics data set.
ChrisHemedinger
Community Manager
Rene,

The idea of using a regular expression is a good one. General format is:

Server:Libname.Member

You can use the classes in SAS.Task.Toolkit (SasServer class, Data.SasLibrary class) to verify that the server and library are valid (that they exist). These are in SAS.Task.Toolkit.dll, which you can use in your task (for EG 4.2).

I wish I had a code example handy, but this should give you something to look at.

Chris
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1946 views
  • 0 likes
  • 4 in conversation