BookmarkSubscribeRSS Feed
tulip
Calcite | Level 5
Experts:

I have a list of 200+values in ( , , , ,). If I list them all, it is too much work especially, when I have to use the same statement several times.

Please advise. Thank you very much. Message was edited by: tulip
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
How/where is the list stored? If the list is in a SAS dataset, you can generate SAS code using PROC SQL and build a set of SAS macro variables. Then use those macro variables within a SAS macro to generate other code.

Another technique is referenced in the technical paper below, found at the SAS support website using a Google advanced search argument.

Scott Barry
SBBWorks, Inc.

A Sample Macro for Creating a List on the Fly
Debbie Miller, National Park Service, Denver, CO
http://www2.sas.com/proceedings/sugi30/030-30.pdf


Using the Magical Keyword "INTO:" in PROC SQL
http://www2.sas.com/proceedings/sugi27/p071-27.pdf
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Also consider an alternative which would be using a PROC FORMAT and a DATA step PUT function to do look-ups or for finding match conditions against your list. With such a large list of values, you will likely find the performance to be better using PUT function. And, a DATA step MERGE (or PROC SQL JOIN) to match values against your list may also be a suitable.

Scott Barry
SBBWorks, Inc.
tulip
Calcite | Level 5
Thank you very much. I will try that.
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1300 views
  • 0 likes
  • 2 in conversation