![]() Chapter Contents |
![]() Previous |
![]() Next |
| DECLARE |
| Alias: | DCL |
| Category: | Declarative Statement |
| Syntax | |
| Details | |
| Comparisons | |
| Examples | |
| Defining a Constant List with a Sublist | |
| See Also |
Syntax |
| DECLARE|DCL data-type-1 argument-1 < . . . ,data-type-nargument-n >; |
The following are valid data types:
'CHAR
<(n)>''LIST''NUM''OBJECT'Note: The compiler cannot validate attributes or methods
for objects declared with the OBJECT keyword (generic objects). Consequently,
using generic objects is less efficient (possibly up to 25 percent less efficient)
than declaring objects with the CLASS or INTERFACE keyword. See Objects for more
information. ![[cautend]](../common/images/cautend.gif)
variable
variable = initial-value
variable = expression
variable-1 -- variable-n = (value-1,...,value-n)
listname={value-1,...,value-n }
Constants have the following form:
|
constant-n<=value-n>
Type: Character or Numeric (for variables). Type: Character (for constants). |
| Details |
You can use the DECLARE statement to declare any type of array. However, arrays that are declared with the DECLARE statement are all temporary arrays. See Using Temporary Arrays to Conserve Memory.
| Comparisons |
| Examples |
dcl char s; dcl num x y; dcl char s, num x y; dcl char(10) ar[3] x y z; dcl list mylist; dcl sashelp.fsp.collection.class obj3; dcl object obj4; dcl num m n, char(300) string, list newlist;
dcl num x=1 y=20+x;
dcl num i1-i4=(1, 2, 3, 4);
dcl num arr(3)=(1, 2, 3);
dcl char(10) s='abc';
dcl char sarr(3)=('abc', 'def', 'ghi');
dcl list mylist = {1, 'abc', 2, 'def'}; /* Initialize a list */
dcl list l = (100, 'abc', 200);
| Defining a Constant List with a Sublist |
A constant list can be defined with a sublist.
init: /*To edit a frame. As the frame runs,*/
/*it will display */
dcl list l ; /* a pop-up menu when you hit the ENTER key.*/;
control enter
/* Initialize a list with three pop-menu items: Select 1, Numeric*/
/*and Character. This will also define a separator between item*/
/*'Select 1'and 'Numeric'. */
list = { {text='Select 1',
helpText='This is a selection.',
mnemonic='S',
classifier = 107},
"_",
"Numeric",
"Character"};
return;
main:
rc = popmenu (list);
put rc=;
return;
term:
/* Delete the list recursively to avoid a memory leak */
rc = dellist ( list, 'y');
return;
Note:
The form of the physical filename depends on the
host operating
system. ![[cautend]](../common/images/cautend.gif)
| See Also |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.