Syntax Supported by the IML Procedure and the iml Action
TABLEGETVARINFORMAT Function
TABLEGETVARINFORMAT (table <, cols>) ;
This function is supported by the IML procedure and the iml action.
The TableGetVarInformat function returns a row vector that contains the informats of the specified columns. Blank strings are returned for columns that do not have informats.
The function takes the following input arguments:
- table
specifies an existing table.
- cols
specifies the columns of the table. The cols argument can be a numeric vector of column numbers (such as {2 4 7}) or a character vector of names (such as {"X" "Y"}). If this argument is omitted, the informats for all columns are returned.
The following statements create a SAS data set whose variables contain informats. The subsequent PROC IML statements create a table from the data set. The TableGetVarInformat retrieves the informats, which are displayed in Figure 414.
data Statisticians;
informat First $8. Last $CHAR10. BirthDate YYMMDD8.;
format BirthDate DATE10.;
input First $ Last $ BirthDate;
datalines;
Karl Pearson 18570327
William Gossett 18760613
Ronald Fisher 18900217
;
proc iml;
tbl = TableCreateFromDataSet("Statisticians");
Name = TableGetVarName(tbl);
informats = TableGetVarInformat(tbl);
All = Name` || informats`;
cnames = {"VarName" "Informats" "Length(informat)"};
print All[L="All Informats" c=cnames];
Figure 414: Column Informats
| All Informats | |
|---|---|
| VarName | Informats |
| First | $8. |
| Last | $CHAR10. |
| BirthDate | YYMMDD8. |