BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

I am a novice trying to write a custom task for eg 4.3 using vs2010 on 32bit windows 7 running sas 9.3 (ts1m0) locally. My custom task is very similar to the "Calculate Lag" task, whose source is available here. I noticed that with the Calculate Lag task, the output dataset opens up when the task is done running. How one can do that? My task is similar in that it takes one input dataset and writes out an output dataset in WORK library. The task works fine -- the output dataset is created correctly. But it is not opened automatically. My main class overrides  both OutputDataCount and OutputDataDescriptorList properties, as shown below. Am I doing this correctly? If so, then what else should I do? Thanks!

public override int OutputDataCount
{
     get { return 1; }
}

public override List<ISASTaskDataDescriptor> OutputDataDescriptorList
{
     get
     {
          var server = Consumer.AssignedServer;
          var lib = "WORK";
          var mem = OutName();
          var lbl = string.Empty;
          var desc = SASTaskDataDescriptor.CreateLibrefDataDescriptor(server, lib, mem, lbl);
          var descs = new List<ISASTaskDataDescriptor>();    
          descs.Add(desc);

          return descs;
     }
}

public override ShowResult Show(IWin32Window Owner)
{
     Form dlg = new Form(this.Consumer);
     dlg.settings = settings;
     if (DialogResult.OK == dlg.ShowDialog(Owner))
     {
          settings = dlg.settings;
          return ShowResult.RunNow;
     }
     else
          return ShowResult.Canceled;
}

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

This looks like the correct code - just make sure that the OutName() routine returns the member name that is in fact generated by your code.  They must match.

You could try returning (-1) from the OutputDataCount, which tells EG to add *all* output data sets that are detected as created/modified as a result of your task.

Chris

Become an Explorer! Join SAS Analytics Explorers to learn and complete challenges that earn rewards!

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

This looks like the correct code - just make sure that the OutName() routine returns the member name that is in fact generated by your code.  They must match.

You could try returning (-1) from the OutputDataCount, which tells EG to add *all* output data sets that are detected as created/modified as a result of your task.

Chris

Become an Explorer! Join SAS Analytics Explorers to learn and complete challenges that earn rewards!
chang_y_chung_hotmail_com
Obsidian | Level 7

Hi, Chris:

You're right on. The OutName() function was returning a two word dataset name, e.g. WORK.TWO, instead of just the member name. Thanks a lot! Thank you also for the information on the -1 OutputDataCount value -- it is good to know.

Chang

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
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
  • 2 replies
  • 2394 views
  • 0 likes
  • 2 in conversation