BookmarkSubscribeRSS Feed
Quentin
Super User

Suppose I have a source SAS dataset, can I register the table but only have it include a subset of rows?

 

For example, using sashelp.class as a source dataset, register the table as ClassFemales and have the registered metadata table only have the rows for females in it. 

 

Can I do that subsetting when I register the table?  That is, can I  register sashelp.class(where=(sex='F'))  ?

 

Or would I need to use an infomap?

 

Big picture is I have a SAS dataset that will eventually feed prompts.  SAS dataset is like:

Prompt    Value   Label
Prompt1   A         Pretty A
Prompt1   B         Pretty B
Prompt2   X         Pretty X Label
Prompt2   Y         Pretty Y Label
....

So that one dataset defines selection options for several prompts. 

 

 

My goal is to make a separate registered table for each prompt, to use as a dynamic lookup.  But I'm hoping not to split the OS dataset into n datasets, one for each prompt.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
2 REPLIES 2
LinusH
Tourmaline | Level 20
Not sure if I entirely understand your application.
You cannot enter a filter as such in a metadata object. You can do some dynamic filtering if you are using metabound libraries, but that is primarily target for row level access purposes.
It's sounds like you need views or infomaps for this.
Data never sleeps
Quentin
Super User

Thanks @LinusH.  General application is wanting to have a single SAS dataset that has the data to define the response options for a set of prompts.  Similar to how you can make one CNTLIN dataset that defines a set of formats.

 

I hadn't thought of using permanent views.  Assuming I can register a view and then use it as a source for a prompt, that could work.  So I would have the data for all the prompts stored in one dataset.  Then would have a separate view for each prompt which subsets the data.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 888 views
  • 1 like
  • 2 in conversation