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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.