BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

Ok. That is trivial.  No need for a MACRO.

So let's assume you have a control dataset and a list of selected items. You could then go through the data set and spit out which ones are selected.

data degree_list ;

  input code :$5. name $20.;

cards;

D Associate Degree

D1 Bachelor Degree

D2  Masters Degree

D3  Doctorate

;;;;

%let choice=D D1 D2 ;

data _null_;

  set degree_list ;

  if indexw("&choice",code) then put 'Has ' name ;

run;

Has Associate Degree

Has Bachelor Degree

Has Masters Degree

DavidPhillips2
Rhodochrosite | Level 12

I need the macro for 7 other dropdowns.

Tom
Super User Tom
Super User

Write the code to do one.  Then figure out how to make it flexible.

So if you have 7 different menus then your control data set needs another column to indicate which menu it is.

Tom
Super User Tom
Super User

if menu = "&menu_name" then put code name @;

if indexw("&choice",code) then put 'selected' @ ;

put ;

DavidPhillips2
Rhodochrosite | Level 12

I coded the dropdowns outside of the checkboxes a while back.  Both features are working.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 19 replies
  • 4567 views
  • 6 likes
  • 5 in conversation