Chapter Contents |
Previous |
Next |
FILLIST |
Category: | List |
Syntax |
sysrc=FILLIST(type,source,list-id<,attr-list-id<,description>>); |
0 | successful |
0 | not successful |
Type: Numeric
'CATALOG
<(options)>'
'FILE
<(options)>'
'FILEREF
<(options)>'
'SASICONS
<(numbers)>'
''
for source.)'SEARCH'
''
for source.FILE(PRINT STRIPCC)
for type.
Type: Character
Type: Character
Type: Numeric or List
CATALOG
and the entry
type is LOG, OUTPUT, or SOURCE. An invalid attr-list-id
produces an error condition.
Type: Numeric
FILE
or FILEREF
.
Note: This parameter is an update parameter. See Input, Output, and Update Parameters for more
information.
Type: Character
Type Options |
ADDCC
FILE
, FILEREF
, and CATALOG
and with
catalog entry types LOG
, OUTPUT
, and
SOURCE
.PRINT
FILE
and
FILEREF
.STRIPCC
FILE
, FILEREF
, and CATALOG
and with
catalog entry types LOG
, OUTPUT
, and
SOURCE
.TRIM
FILE
, FILEREF
and CATALOG
and with catalog entry types LOG
, OUTPUT
, and SOURCE
.
TRIM
is used if you
want to use FILLIST to fill a list with items that contain trailing blanks
and then remove the blanks so that they will not be displayed in a pop-up
menu that is produced by POPMENU.Details |
Each line of text in the source file is placed in a separate character item of the list identified by list-id. The number of items in the filled list is determined by the number of lines of text. All SCL lists must be created with MAKELIST before you call FILLIST. FILLIST automatically clears the lists before it fills the lists.
Data from the external file or catalog entry cannot
exceed the maximum length of a character value in an SCL list item, which
is 32,766 characters.
If type is FILE
, then source is
the name of an external file. If type is FILEREF
, then source is a SAS fileref. FILLIST reads each record of
the file
into a separate character item.
If type is CATALOG
and the catalog
entry type in source is SLIST
, then the types of the items in the filled list are determined
by the saved list, and they may be character strings, numbers, or other lists.
All item attributes and names are duplicated, as are the list attributes.
However, the list identifier numbers are different.
If type is CATALOG
and the catalog
entry type in source is LIST
,
FILLIST reads the contents of a SAS/AF LIST entry into list-id. The list contains either all numeric or all character items,
depending on the contents of the LIST entry. The attribute list contains
the following named values, which are all character type:
Y
or N
.Y
or N
.Y
or N
.N
for numeric, C
for character.L
, R
, C
, or N
for left, right, center,
or none.If type is CATALOG
and the entry type
is OUTPUT, LOG
,
or SOURCE
, the first character in each list
item contains a FORTRAN carriage-control character: 1 means that a new page
starts with this line. See STRIPCC
above. ADDCC
converts all carriage-control characters to ' '
(blank).
If type is CATALOG
and the entry type is OUTPUT, LOG
,
or SOURCE
, then any text attributes (such as
color and display attributes), are read one element per line into attr-list-id, if it is specified. These attributes consist
of a character item for each line of text. Each character item contains one
character for each character in the line, plus a prefix descriptor character.
The prefix character is T
for a title line, H
for a header line, or D
for
a data line. The other characters represent the text display attributes and
color, as described in the tables below.
Do not confuse text attributes (color, display, and so on) with list attributes that are specified with SETLATTR.
The attribute list that is filled by FILLIST contains one item for each line of text from the SAS catalog entry. The attribute string for each line has one character for each character of text. Each attribute character represents the SAS windowing environment color and display attribute. Not all display devices support all colors.
Color attributes are represented as follows:
Color | Value | Color | Value |
---|---|---|---|
BLUE | '10'x | WHITE | '70'x |
RED | '20'x | ORANGE | '80'x |
PINK | '30'x | BLACK | '90'x |
GREEN | '40'x | MAGENTA | 'A0'x |
CYAN | '50'x | GRAY | 'B0'x |
YELLOW | '60'x | BROWN | 'C0'x |
Display attributes are represented as follows:
Attribute | Value |
---|---|
NONE | '00'x |
HIGHLIGHT | '01'x |
UNDERLINE | '02'x |
BLINK | '04'x |
REVERSE | '08'x |
You combine the color and display attributes by adding them together. For example, you can specify GREEN UNDERLINE by adding '40'x to '02'x to yield '42'x. To assign GREEN UNDERLINE to the first 4 characters of a string, you could use a statement like:
str = '42424242'x;
See also STRATTR, which creates attribute strings.
You can use GETITEMC or POPC to retrieve an item from this list.
An error condition is produced if
Examples |
Suppose you have an OUTPUT entry named FINANCE.REPORTS.MONTHLY.OUTPUT
that contains the text "Net:($45,034)" on line 45. The text
Net:
is white with no highlight attributes, whereas the text
($45,034)
is red reverse. The following statements read the text and attributes
and print line 45.
INIT: text_list=makelist(); attr_list=makelist(); rc=fillist('CATALOG', 'FINANCE.REPORTS.MONTHLY.OUTPUT', text_list,attr_list); text=substr(getitemc(text_list,45),2); attr=substr(getitemc(attr_list,45),2); len=compress(put(2*length(text), 4.)); attrhex=putc(attr,'$HEX'||len||'.'); put attr; put text; put attrhex; return;
Note: SUBSTR removes the carriage-control
characters.
This example produces the following output:
ppppp((((((((( Net: ($45,034) 7070707070282828282828282828
The line of text consists of five white characters with
no attributes, represented by the attribute value '70'x, followed by nine
red reverse characters, represented by '28'x.
The following statements perform an operation similar to a recursive list copy:
rc=savelist('CATALOG','WORK.TEMP.MYLIST.SLIST', mylist); new_list=makelist(); rc=fillist('CATALOG','WORK.TEMP.MYLIST.SLIST', new_list); rc=delete('WORK.TEMP.TEMP.SLIST','CATALOG');
Lists that are saved in a permanent catalog with SAVELIST
can persist across SAS sessions.
Consider two LIST entries: SASUSER.DATA.A.LIST, which contains some character data, and SASUSER.DATA.DATES.LIST, which contains formatted numeric data. The following program reads the data and attributes from these entries and uses PUTLIST to print the results.
INIT: items=makelist(); attrs=makelist(); rc=fillist('catalog','sasuser.data.a.list', items,attrs); call putlist(items,'A.LIST contents:',0); call putlist(attrs,'A.LIST attributes:',0); rc=fillist('catalog','sasuser.data.dates.list', items,attrs); call putlist(items,'DATES.LIST contents:',0); call putlist(attrs,'DATES.LIST attributes:',0); rc=dellist(items); rc=dellist(attrs); return;The output for these entries may look like this:
A.LIST contents:('THIS ' 'IS ' 'A ' 'LIST ' 'ENTRY ' 'WITH ' 'EIGHT ' 'ITEMS ' )[5] A.LIST attributes:(INFORMAT='' FORMAT='' MESSAGE='' CAPS='Y' SORTED='N' NOHONORCASE='Y' TYPE='C' JUST='L' )[7] DATES.LIST contents:(1765 11162 11813 12072 )[5] DATES.LIST attributes:(INFORMAT='DATE.' FORMAT='DATE.' MESSAGE='' CAPS='Y' SORTED='Y' NOHONORCASE='N' TYPE='N' JUST='L' )[7]
Note: [5] and [7]
are the list identifiers that were assigned when this example was run and
may be different each time the example is
run.
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.