BookmarkSubscribeRSS Feed
prholland
Fluorite | Level 6
I'm developing an EG 4.1 Add-In using VB.Net. I'm currently using SASVariableSelector.GetAssignedVariable(ROLE,n) to extract the name of a variable in a Role list. Is there a method or property I can use to extract the label of that variable, instead of the name?

.........Phil
3 REPLIES 3
ChrisHemedinger
Community Manager
Phil,

You can use the ISASTaskData and ISASTaskDataColumn interfaces to get this information.

Here is a C# snippet that should translate to VB.NET fairly easily.

[pre]
using SAS.Shared.AddIns;

ISASTaskData data = Consumer.ActiveData;
ISASTaskDataAccessor da = data.Accessor;
// to do that, we need to "open" the data to get a peek at the column
// information
if (da.Open())
{
for (int i=0; i < da.ColumnCount; i++)
{
ISASTaskDataColumn ci = da.ColumnInfoByIndex(i);
cmbReport.Items.Add(ci.Label);
}
da.Close();
}
[/pre]

Chris
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
prholland
Fluorite | Level 6
Chris,

I found something similar to your code in the Compare Add-In code in the VB.Net Samples. Unfortunately, although it works very well when picking up the labels from the underlying data set, if I've changed the label or format in the SAS Variable Selector object, it ignores those changes.

Is there any interface to the SAS Variable Selector object that can give me the changed label or format? If there isn't anything suitable, I might try to include user-editable labels and formats in the SAS Variable Properties object instead.

.........Phil
ChrisHemedinger
Community Manager
Phil,

Have you tried the GetVariablesFormat(string varname) call on the SASVariableSelector control?

You can also subscribe to an event: VariableFormatChanged. With the event you can be notified when the user changes the value. Using GetVariablesFormat(), you can query for the new or current value.

Chris
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 522 views
  • 0 likes
  • 2 in conversation