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.

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!

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.

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