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.

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!

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.

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
  • 668 views
  • 0 likes
  • 2 in conversation