Chapter Contents

Previous

Next
SAS/AF Software: Class Dictionary

Using the Radio Box Class


Example 1

This example checks for the active button by testing the variable associated with the radio box name, RBOX1. Each button is assigned a numeric value equal to its button number and links to a program section like the one for STATE1.

MAIN:
   select(rbox1);
      when (1) link state1;
      when (2) link state2;
      when (3) link state3;
      otherwise;
   end;
return;

   /* action for STATE1 */
STATE1:
   _msg_='State 1';
return;

   /* action for STATE2 */
STATE2:
   _msg_='State 2';
return;

   /* action for STATE3 */
STATE3:
   _msg_='State 3';
return;


Example 2

This example returns the current active button by calling the SCL function ISACTIVE:

   button=isactive('rbox1');
   put 'The active button is:' button=;


Example 3

These examples show some different ways to assign values to a radio box using the Fill Type field in the Attributes window.


Filling a Radio Box with Items from an SCL Array

From the Fill Type field in the Attributes window, select SCL array and enter the name of the array variable, DAYS.

In the SCL code, declare and initialize the array variable:

array days[5] $9 ('Monday', 'Tuesday',
                  'Wednesday',
                  'Thursday', 'Friday');


Filling a Radio Box with Items from an SCL List

From the Fill Type field in the Attributes window, select SCL List and enter the name of the SCL list, DAYLIST.

In the SCL code, create the SCL list. This example creates the SCL list DAYLIST from the array, DAYS:

   /* declare the array variable, DAYS */
array days[5] $9 ('Monday', 'Tuesday',
                  'Wednesday',
                 'Thursday', 'Friday');
INIT:
      /* create the SCL list from the
         array */
   daylist = makelist(5);
   do i = 1 to dim(days);
      daylist = setitemc(daylist,days[i],i);
   end;
return;


Filling a Radio Box with Items from an SCL Text String

From the Fill Type field in the Attributes window, select SCL Text String and enter the name of the SCL variable, DAYSTR.

In the SCL code, assign values to the SCL variable:

INIT:
   daystr='Monday Tuesday Wednesday Thursday 
           Friday';
return'


Filling a Radio Box with Items from a LIST Entry in a Catalog

To start this example, create the LIST entry. One way is to issue this command from the catalog directory window:

edit days.list

Or, from the frame, select File --> New and create a new entry, DAYS, of type LIST.

In the LISTATTR window, specify 9 for Length, turn off CAPS and SORT, and select CASE-INSENSITIVE so that the names of the days display in mixed case. Use the END command and enter the names of the days in the LISTVALUES window:

Monday   Tuesday   Wednesday   Thursday
   Friday

Close the LISTVALUES window to create DAYS.LIST.

From the Fill Type field in the Attributes window, select Catalog list entry and enter DAYS.LIST.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.