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;
}
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
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
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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.