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
I need the macro for 7 other dropdowns.
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.
if menu = "&menu_name" then put code name @;
if indexw("&choice",code) then put 'selected' @ ;
put ;
I coded the dropdowns outside of the checkboxes a while back. Both features are working.
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.
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.