Upload
others
View
31
Download
0
Embed Size (px)
Citation preview
Reference for language elementsVersion 3.3
WPS Reference forLanguage Elements
“Look up the syntax of language elementssupported by the World Programming
System (WPS).”
Version: 3.3.12Copyright © 2002-2021 World Programming Limited
www.worldprogramming.com
Reference for language elementsVersion 3.3
2
Contents
How to read EBNF................................................................................. 11
Common Syntax.....................................................................................13Identifying Access and View Descriptors.....................................................................................13
Access Descriptors............................................................................................................13View Descriptors................................................................................................................13
Identifying Views.......................................................................................................................... 13Identifying Datasets......................................................................................................................14
Input dataset......................................................................................................................14Output dataset................................................................................................................... 14Dataset...............................................................................................................................14
Expressions.................................................................................................................................. 14Language of SAS Expressions......................................................................................... 14SQL Expressions...............................................................................................................15
External Files................................................................................................................................16LOCALE Values........................................................................................................................... 16ENCODING Values...................................................................................................................... 19Variable Lists................................................................................................................................26
WPS Core................................................................................................27Global statements........................................................................................................................ 27
Comment.......................................................................................................................... 27CATNAME..........................................................................................................................27DSNEXST.......................................................................................................................... 27ENDSAS............................................................................................................................ 27ENDWPS........................................................................................................................... 28FILENAME Statements......................................................................................................28FOOTNOTE....................................................................................................................... 35%INCLUDE........................................................................................................................ 35LIBNAME........................................................................................................................... 35MISSING............................................................................................................................36ODS Statements................................................................................................................36OPTIONS...........................................................................................................................48PAGE................................................................................................................................. 48RUN................................................................................................................................... 49SKIP...................................................................................................................................49SYSTASK Statements.......................................................................................................49TITLE................................................................................................................................. 50WAITFOR...........................................................................................................................50X Statements..................................................................................................................... 50
Reference for language elementsVersion 3.3
3
System options.............................................................................................................................51Non OS-specific system options....................................................................................... 52IBM mainframe specific system options..........................................................................103
Formats.......................................................................................................................................130Core formats....................................................................................................................131Basic character formats...................................................................................................135Bidirectional formats........................................................................................................ 141Unicode formats.............................................................................................................. 145Simple numeric formats...................................................................................................154Numeric date formats......................................................................................................186ISO8601 date formats..................................................................................................... 234International date formats................................................................................................249NLS-sensitive date formats............................................................................................. 269NLS-sensitive money formats......................................................................................... 284NLS-sensitive numeric formats....................................................................................... 290
Informats.....................................................................................................................................296Core informats................................................................................................................. 298Basic character informats................................................................................................299Bidirectional informats..................................................................................................... 306Unicode informats............................................................................................................308Simple numeric informats................................................................................................316Numeric date informats................................................................................................... 333ISO8601 date informats.................................................................................................. 345NLS-sensitive date informats.......................................................................................... 356NLS-sensitive money informats.......................................................................................358NLS-sensitive numeric informats.....................................................................................361
Components................................................................................................................................364HASH Component........................................................................................................... 364HITER Component.......................................................................................................... 369JAVAOBJ Component..................................................................................................... 370
DATA Step Statements..............................................................................................................373_NEW_.............................................................................................................................373ABORT.............................................................................................................................373ARRAY.............................................................................................................................373ATTRIB............................................................................................................................ 373BY.................................................................................................................................... 373CALL................................................................................................................................ 374CARDS.............................................................................................................................374CARDS4...........................................................................................................................374CONTINUE...................................................................................................................... 374DATA................................................................................................................................374DATALINES..................................................................................................................... 374DATALINES4................................................................................................................... 374DECLARE........................................................................................................................ 375DELETE........................................................................................................................... 375DESCRIBE.......................................................................................................................375
Reference for language elementsVersion 3.3
4
DO....................................................................................................................................375DO, iterative.....................................................................................................................375DO UNTIL........................................................................................................................376DO WHILE.......................................................................................................................376DROP...............................................................................................................................376END..................................................................................................................................376ERROR............................................................................................................................ 376EXECUTE........................................................................................................................ 376FILE..................................................................................................................................377FORMAT..........................................................................................................................380GO TO............................................................................................................................. 380IF, subsetting................................................................................................................... 380IF-THEN/ELSE.................................................................................................................380INFILE..............................................................................................................................381INFORMAT...................................................................................................................... 382INPUT.............................................................................................................................. 383KEEP................................................................................................................................384LABEL..............................................................................................................................384Labels,Statement............................................................................................................. 384LEAVE..............................................................................................................................384LENGTH...........................................................................................................................385LINK................................................................................................................................. 385LIST..................................................................................................................................385MERGE............................................................................................................................385MODIFY........................................................................................................................... 385OUTPUT.......................................................................................................................... 386PUT..................................................................................................................................386PUTLOG.......................................................................................................................... 389REDIRECT.......................................................................................................................389REMOVE..........................................................................................................................389RENAME..........................................................................................................................389REPLACE........................................................................................................................ 389RETAIN............................................................................................................................389RETURN.......................................................................................................................... 390SELECT........................................................................................................................... 390SET.................................................................................................................................. 390SKIP.................................................................................................................................390STOP............................................................................................................................... 391Sum..................................................................................................................................391UPDATE...........................................................................................................................391WHERE............................................................................................................................391DO, iterative.....................................................................................................................391DO UNTIL........................................................................................................................392DO WHILE.......................................................................................................................392GO TO............................................................................................................................. 392IF, subsetting................................................................................................................... 392
Reference for language elementsVersion 3.3
5
IF-THEN/ELSE.................................................................................................................392Describing data in a DATA step..................................................................................... 393
Data Step Functions and Call Routines.................................................................................... 393Bitwise functions..............................................................................................................393Combination functions and call routines......................................................................... 399Input and output functions and call routines................................................................... 407Date and time functions and call routines.......................................................................443Double-Byte functions and call routines..........................................................................479Decision forest functions and call routines..................................................................... 510External file functions and call routines.......................................................................... 514External routine functions and call routines.................................................................... 527Financial functions and call routines...............................................................................528Internet functions and call routines................................................................................. 583ISPF call routines............................................................................................................ 586Macro functions and call routines................................................................................... 587Mathematical functions and call routines........................................................................ 590NLS functions and call routines...................................................................................... 667Probability functions and call routines.............................................................................670Regular expression functions and call routines.............................................................. 693Random number functions and call routines.................................................................. 711Special functions and call routines................................................................................. 792Statistical functions..........................................................................................................803String functions and call routines....................................................................................834Trunc functions and call routines.................................................................................... 968Variable functions and call routines................................................................................ 972Web functions and call routines......................................................................................982Zipcode functions and call routines.................................................................................984
Dataset Options..........................................................................................................................988BUFNO.............................................................................................................................988BUFSIZE..........................................................................................................................988COMPRESS.....................................................................................................................988DROP...............................................................................................................................989FILECLOSE..................................................................................................................... 989FIRSTOBS....................................................................................................................... 989IN......................................................................................................................................990INDEX.............................................................................................................................. 990KEEP................................................................................................................................990LABEL..............................................................................................................................990OBS..................................................................................................................................991OBSBUF.......................................................................................................................... 991OUTREP.......................................................................................................................... 991POINTOBS.......................................................................................................................992RENAME..........................................................................................................................992REPLACE........................................................................................................................ 992SPILL............................................................................................................................... 993WHERE............................................................................................................................993
Reference for language elementsVersion 3.3
6
Procedures..................................................................................................................................993ACCESS Procedure........................................................................................................ 993APPEND Procedure........................................................................................................ 996APPSRV Procedure.........................................................................................................997CATALOG Procedure....................................................................................................1014CDISC Procedure..........................................................................................................1017CHART Procedure.........................................................................................................1020CIMPORT Procedure.....................................................................................................1023COMPARE Procedure...................................................................................................1024CONTENTS Procedure................................................................................................. 1026COPY Procedure...........................................................................................................1027CORR Procedure...........................................................................................................1028CPORT Procedure.........................................................................................................1031DATASETS Procedure.................................................................................................. 1033DBLOAD Procedure...................................................................................................... 1039DELETE Procedure....................................................................................................... 1042EXPORT Procedure...................................................................................................... 1043FMTLIB Procedure........................................................................................................ 1045FORMAT Procedure......................................................................................................1049FORMS Procedure........................................................................................................ 1052FREQ Procedure........................................................................................................... 1053HADOOP Procedure......................................................................................................1060HTTP Procedure............................................................................................................1062IMPORT Procedure....................................................................................................... 1063JSON Procedure............................................................................................................1067JAVAINFO Procedure....................................................................................................1069MEANS Procedure........................................................................................................ 1070OPTIONS Procedure.....................................................................................................1075OPTLOAD Procedure....................................................................................................1075OPTSAVE Procedure.................................................................................................... 1076PDS Procedure..............................................................................................................1076PDSCOPY Procedure....................................................................................................1077PLOT Procedure............................................................................................................1078PRINT Procedure.......................................................................................................... 1079PRINTTO Procedure..................................................................................................... 1082PWENCODE Procedure................................................................................................ 1082R Procedure.................................................................................................................. 1083RANK Procedure........................................................................................................... 1095RELEASE Procedure.....................................................................................................1096REPORT Procedure...................................................................................................... 1097SOAP Procedure........................................................................................................... 1101SORT Procedure........................................................................................................... 1102SOURCE Procedure......................................................................................................1104SQL Procedure..............................................................................................................1105STANDARD Procedure................................................................................................. 1119SUMMARY Procedure...................................................................................................1120
Reference for language elementsVersion 3.3
7
TABULATE Procedure...................................................................................................1125TEMPLATE Procedure.................................................................................................. 1128TRANSPOSE Procedure............................................................................................... 1134TRANTAB Procedure.................................................................................................... 1136UNIVARIATE Procedure................................................................................................1137
Library Engines........................................................................................................................ 1160CVP................................................................................................................................1160SASDASD......................................................................................................................1160SAS7BDAT.................................................................................................................... 1160SD2................................................................................................................................ 1160SASSEQ........................................................................................................................ 1161V8SEQ........................................................................................................................... 1161V9SEQ........................................................................................................................... 1161WPDSEQ....................................................................................................................... 1161WPD...............................................................................................................................1161WPD (z/OS)...................................................................................................................1161WPD1.............................................................................................................................1162WPDV2.......................................................................................................................... 1163WPDV2 (z/OS).............................................................................................................. 1163XML................................................................................................................................1164XPORT...........................................................................................................................1165
Macros...................................................................................................................................... 1165Automatic Macro Variables........................................................................................... 1165Macro Processor Statements........................................................................................ 1170Macro Processor Functions...........................................................................................1174
WPS Graphing....................................................................................1180Global Statements....................................................................................................................1180
AXIS...............................................................................................................................1180FOOTNOTE................................................................................................................... 1181GOPTIONS.................................................................................................................... 1182LEGEND........................................................................................................................ 1183PATTERN...................................................................................................................... 1184SYMBOL........................................................................................................................ 1184
Graphing Procedures............................................................................................................... 1186GANNO Procedure........................................................................................................1186GBARLINE Procedure...................................................................................................1186GCHART Procedure......................................................................................................1189GOPTIONS Procedure.................................................................................................. 1195GPLOT Procedure.........................................................................................................1195GREPLAY Procedure.................................................................................................... 1198GSLIDE Procedure........................................................................................................1199
WPS Statistics....................................................................................1201Statistics Procedures................................................................................................................1201
ACECLUS Procedure.................................................................................................... 1201
Reference for language elementsVersion 3.3
8
ANOVA Procedure.........................................................................................................1202BOXPLOT Procedure.................................................................................................... 1205CANCORR Procedure...................................................................................................1207CANDISC Procedure.....................................................................................................1209CLUSTER Procedure.................................................................................................... 1211CORRESP Procedure................................................................................................... 1213DISCRIM Procedure......................................................................................................1215DISTANCE Procedure...................................................................................................1219FACTOR Procedure...................................................................................................... 1222FASTCLUS Procedure.................................................................................................. 1226GENMOD Procedure.....................................................................................................1228GLM Procedure............................................................................................................. 1236GLMMOD Procedure.....................................................................................................1243KDE Procedure..............................................................................................................1245LIFEREG Procedure......................................................................................................1247LIFETEST Procedure.................................................................................................... 1251LOESS Procedure......................................................................................................... 1256LOGISTIC Procedure.................................................................................................... 1260MI Procedure................................................................................................................. 1267MIXED Procedure..........................................................................................................1271MODECLUS Procedure.................................................................................................1276NESTED Procedure.......................................................................................................1277NLIN Procedure.............................................................................................................1279NPAR1WAY Procedure................................................................................................. 1285PHREG Procedure........................................................................................................ 1288PRINCOMP Procedure..................................................................................................1293PROBIT Procedure........................................................................................................1295REG Procedure............................................................................................................. 1299SCORE Procedure........................................................................................................ 1308SIMNORMAL Procedure............................................................................................... 1310STDIZE Procedure........................................................................................................ 1311STEPDISC Procedure................................................................................................... 1313SURVEYSELECT Procedure........................................................................................ 1315TREE Procedure............................................................................................................1317TTEST Procedure..........................................................................................................1319VARCLUS Procedure.................................................................................................... 1321VARCOMP Procedure...................................................................................................1323
WPS Timeseries................................................................................. 1325Timeseries Procedures.............................................................................................................1325
ARIMA Procedure..........................................................................................................1325EXPAND Procedure...................................................................................................... 1329FORECAST Procedure..................................................................................................1334X12 Procedure...............................................................................................................1336
WPS Communicate............................................................................ 1343
Reference for language elementsVersion 3.3
9
Global Statements....................................................................................................................1343ENDRSUBMIT............................................................................................................... 1343RSUBMIT.......................................................................................................................1343SIGNOFF....................................................................................................................... 1346SIGNON.........................................................................................................................1347WAITFOR.......................................................................................................................1350
Macro Processor Statements...................................................................................................1350%SYSLPUT....................................................................................................................1350%SYSRPUT...................................................................................................................1351
Procedures................................................................................................................................1351DOWNLOAD Procedure................................................................................................ 1351UPLOAD Procedure...................................................................................................... 1354
System Options........................................................................................................................ 1357AUTOSIGNON...............................................................................................................1357COMAMID......................................................................................................................1358CONNECTPERSIST......................................................................................................1358CONNECTREMOTE......................................................................................................1358DMR...............................................................................................................................1359SASCMD........................................................................................................................1359SASSCRIPT...................................................................................................................1359
Data Engines...................................................................................... 1360WPS Engine for Access...........................................................................................................1360
ACCESS........................................................................................................................ 1360WPS Engine for Actian Matrix................................................................................................. 1364
ACTIANMATRIX............................................................................................................ 1364WPS Engine for DB2............................................................................................................... 1369
DB2................................................................................................................................ 1369DB2OLD.........................................................................................................................1379DB2 (for z/OS)...............................................................................................................1386DB2OLD (for z/OS)....................................................................................................... 1393DB2EXT Procedure....................................................................................................... 1397
WPS Engine for Excel............................................................................................................. 1398EXCEL........................................................................................................................... 1398XLSX..............................................................................................................................1402
WPS Engine for Greenplum.................................................................................................... 1403GREENPLUM................................................................................................................ 1403
WPS Engine for Hadoop..........................................................................................................1408HADOOP........................................................................................................................1408
WPS Engine for Informix......................................................................................................... 1412INFORMIX......................................................................................................................1412
WPS Engine for Kognito.......................................................................................................... 1416KOGNITIO......................................................................................................................1416
WPS Engine for MySQL.......................................................................................................... 1421MYSQL...........................................................................................................................1421
WPS Engine for Netezza......................................................................................................... 1426
Reference for language elementsVersion 3.3
10
NETEZZA.......................................................................................................................1426NETEZZAM....................................................................................................................1432
WPS Engine for ODBC............................................................................................................1437ODBC.............................................................................................................................1437
WPS Engine for OLEDB.......................................................................................................... 1444OLEDB...........................................................................................................................1444
WPS Engine for Oracle............................................................................................................1452ORACLE........................................................................................................................ 1452ORACLEM..................................................................................................................... 1461
WPS Engine for PostgreSQL...................................................................................................1471POSTGRESQL.............................................................................................................. 1471
WPS Engine for Sand..............................................................................................................1475SAND............................................................................................................................. 1475
WPS Engine for SQL Server................................................................................................... 1480SQLSERVER................................................................................................................. 1480
WPS Engine for Sybase.......................................................................................................... 1486SYBASE.........................................................................................................................1486
WPS Engine for Sybase IQ..................................................................................................... 1490SYBASEIQ.....................................................................................................................1490
WPS Engine for Teradata........................................................................................................1496TERADATA....................................................................................................................1496
WPS Engine for Vertica........................................................................................................... 1500VERTICA........................................................................................................................1500
Legal Notices......................................................................................1505
Reference for language elementsVersion 3.3
11
How to read EBNFEBNF is a textual notation that accompanies significant language structures such as procedures,statements and so on.
The description of each language concept commences with its EBNF representation .
Entering textText that should be entered exactly as displayed is shown in a typewriter font :
OUTPUT ;
This example describes a fragment of syntax in which the keyword OUTPUT is followed by a semi-coloncharacter: ;. The EBNF version of this fragment is simply the characters: OUTPUT;.
Generally the case of the text is not significant, but in this reference, it is the convention to use upper-case for keywords.
Placeholder itemsPlaceholders that should be substituted with relevant, context-dependent text are rendered in lowercase, surrounded by a box :
OUTPUT data-set-name ;
Here, the keyword OUTPUT should be entered literally, but data-set-name should be replaced bysomething appropriate to the program – in this case, the name of a dataset to add an observation to.
OptionalityWhen items are optional, they appear in square brackets [ ] in EBNF :
OUTPUT [ data-set-name ] ;
RepetitionIn EBNF, repetition is denoted by curly braces and ellipsis { … }. An optional separator for multipleinstances is shown just before the ellipsis.
OUTPUT { data-set-name … } ;
Above, the keyword OUTPUT should be entered literally, and it should be followed by one or morerepetitions of data-set-name - in this case, no separator other than a space has been asked for.
The example below shows the use of a separator.
function-name ( { argument , … } ) ;
Reference for language elementsVersion 3.3
12
ChoicesIn EBNF, the choice is represented by a logical OR symbol | between each option.
GETNAMES [ YES | NO ] ;
In the above example, the keyword GETNAMES should be entered literally, and then either the keywordYES or the keyword NO.
FragmentsWhen the syntax is too complicated to fit in one definition, it might be broken into fragments:
PROC PRINT { option … }
option[ DATA = data-set-name | LABEL ]
Above, the whole syntax is split into separate EBNF fragments. The first indicates that PROC PRINTshould be followed by one or more instances of an option, each of which must adhere to the syntaxgiven in the second diagram.
Help with reading EBNFThe table below summarises the EBNF conventions used in this reference:
Convention Description
[] Optional elements
{…} Repeated group of elements
{,…} Separators that enclose iterations of repeated itemsare shown just before the ellipsis
| Either/or within a selection group enclosed in [ ]. Forexample:
• [A|B] – choose either A or B• [A|B|] – choose A or B or nothing (i.e. omit the
group altogether)
"" Comment – for example, a group title
monospaced Keywords and separators
italics variables
bold Elements presented in their own diagrams, likefragments
underlined Default selection
Reference for language elementsVersion 3.3
13
Common SyntaxMany language elements in this manual refer to common syntax constructs such as expressions,datasets or variable lists. They are detailed below.
Identifying Access and ViewDescriptors
Access Descriptors
Access descriptor[ library . ] access-descriptor-name [ .access ]
View Descriptors
View descriptor[ library . ] view-descriptor-name [ .view ]
Identifying Views[ library . ] view-name
Reference for language elementsVersion 3.3
14
Identifying Datasets
Input dataset
Input dataset with optionsdataset i( { input-dataset-option … } )
i See Dataset.
Output dataset
Output dataset with optionsdataset i( { output-dataset-option … } )
i See Dataset.
Dataset
Dataset[ library . ] dataset-name
Expressions
Language of SAS Expressions
expression[ ( expression ) |
variable |array-name
[ [ { expression, … } ] |
Reference for language elementsVersion 3.3
15
{ { expression, … } } |( { expression, … } )
] |function-name ( { argument , … } ) |[ FIRST. | LAST. ] by-variable-name |expression
[ [ | | ! | OR ] |[ & | AND ]
] expression |[ ~ | NOT ] expression |- expression |expression [ + | - | * | / | ** ] expression |expression
[ [ < | LT ] |[ <= | LE ] |[ > | GT ] |[ >= | GE ] |[ = | EQ ] |[ != | ^= | ¬= | NE ]
] [ : ] expression |expression = "bit-test-constant"X |expression [ NOT ] IN ( { expression, … } ) |expression || expression i |expression <> expression ii |expression >< expression iii
]
i Concatenate.ii Choose maximum.iii Choose minimum.
SQL Expressions
SQL expression[ column |
function-name ( { argument , … } ) |( SQL_expression ) |SQL_expression
[ [ | | ! | OR ] |[ AND | & ]
] SQL_expression |[ ~ | ^ | NOT ] SQL_expression |- SQL_expression |SQL_expression [ + | - | * | / | ** ] SQL_expression |SQL_expression
Reference for language elementsVersion 3.3
16
[ [ < | LT ] |[ <= | LE ] |[ > | GT ] |[ >= | GE ] |[ = | EQ ] |[ != | ^= | ¬= | <> | NE ]
] [ : ] SQL_expression |SQL_expression [ NOT ] BETWEEN SQL_expression AND SQL_expression |SQL_expression IS [ NOT ] [ NULL | MISSING ] |SQL_expression LIKE SQL_expression |SQL_expression [ CONTAINS | ? ] SQL_expression |SQL_expression *= SQL_expression i
]
i Sounds like.
External FilesExternal files can be referenced in a number of ways.
[ "quoted-file-name" |fileref |fileref ( member ) |fileref ( { member … } )
]
Not all of the ways of referring to external files are valid in all circumstances. In particular, whenreferring to output files, at least one file must be identified.
LOCALE ValuesSupported LOCALE Values:
• Arabic_Algeria• Arabic_Bahrain• Arabic_Egypt• Arabic_Jordan• Arabic_Kuwait• Arabic_Lebanon• Arabic_Morocco• Arabic_Oman
Reference for language elementsVersion 3.3
17
• Arabic_Qatar• Arabic_SaudiArabia• Arabic_Tunisia• Arabic_UnitedArabEmirates• Bulgarian_Bulgaria• Byelorussian_Belarus• Croatian_Croatia• Czech_CzechRepublic• Danish_Denmark• Dutch_Belgium• Dutch_Netherlands• English_Australia• English_Canada• English_HongKong• English_India• English_Ireland• English_Jamaica• English_NewZealand• English_Singapore• English_SouthAfrica• English_UnitedKingdom• English_UnitedStates• Estonian_Estonia• Finnish_Finland• French_Belgium• French_Canada• French_France• French_Luxembourg• French_Switzerland• German_Austria• German_Germany• German_Liechtenstein• German_Luxembourg• German_Switzerland• Greek_Greece• Hebrew_Israel
Reference for language elementsVersion 3.3
18
• Hungarian_Hungary• Icelandic_Iceland• Italian_Italy• Italian_Switzerland• Japanese_Japan• Latvian_Latvia• Lithuanian_Lithuania• Norwegian_Norway• Polish_Poland• Portuguese_Brazil• Portuguese_Portugal• Romanian_Romania• Russian_Russia• Serbian_Yugoslavia• Slovak_Slovakia• Slovenian_Slovenia• Spanish_Argentina• Spanish_Bolivia• Spanish_Chile• Spanish_Colombia• Spanish_CostaRica• Spanish_DominicanRepublic• Spanish_Ecuador• Spanish_ElSalvador• Spanish_Guatemala• Spanish_Honduras• Spanish_Mexico• Spanish_Nicaragua• Spanish_Panama• Spanish_Paraguay• Spanish_Peru• Spanish_PuertoRico• Spanish_Spain• Spanish_UnitedStates• Spanish_Uruguay• Spanish_Venezuela
Reference for language elementsVersion 3.3
19
• Swedish_Sweden• Thai_Thailand• Turkish_Turkey• Ukrainian_Ukraine• Vietnamese_Vietnam
Unsupported LOCALE Values:
• Chinese_China• Chinese_HongKong• Chinese_Macau• Chinese_Singapore• Chinese_Taiwan• Korean_Korea
ENCODING ValuesThe following table shows the character encodings supported by WPS. Refer to the Workbench UserGuide for information about setting character encodings and locale (which may be all that is required inmost cases).
Only those encodings indicated by Yes in the table are supported in the ENCODING system option.However, all of the options are available for use with INFILE or FILE and other language statementsfor which the ENCODING option is valid.
Name ShortName
Alternative Name Description 'Yes' =Usableas serverencodingon z/OS
'Yes' =Usableas serverencodingon otherplatforms
ebcdic037 E037 ibm-037 EBCDIC 037 Old NorthAmerica
Yes
ebcdic273 E273 ibm-273 EBCDIC 273 Old Austria/Germany
Yes
ebcdic275 E275 ibm-275 EBCDIC 275 Brazil Yes
ebcdic277 E277 ibm-277 EBCDIC 277 Old Denmark/Norway
Yes
ebcdic278 E278 ibm-278 EBCDIC 278 Old Finland/Sweden
Yes
ebcdic280 E280 ibm-280 EBCDIC 280 Old Italy Yes
Reference for language elementsVersion 3.3
20
Name ShortName
Alternative Name Description 'Yes' =Usableas serverencodingon z/OS
'Yes' =Usableas serverencodingon otherplatforms
ebcdic284 E284 ibm-284 EBCDIC 284 Old Spain/LatinAmerica
Yes
ebcdic285 E285 ibm-285 EBCDIC 285 Old UnitedKingdom
Yes
ebcdic297 E297 ibm-297 EBCDIC 297 Old France Yes
ebcdic420 E420 ibm-420 EBCDIC 420 Old Arabic Yes
ebcdic424 E424 ibm-424 EBCDIC 424 Hebrew Yes
ebcdic425 E425 ibm-425 EBCDIC 425 Arabic Yes
ebcdic500 E500 ibm-500 EBCDIC 500 Old International Yes
ebcdic838 E838 ibm-838 EBCDIC 838 Thai Yes
ebcdic870 E870 ibm-870 EBCDIC 870 Central Europe Yes
ebcdic875 E875 ibm-875 EBCDIC 875 Greek Yes
ebcdic924 E924 ibm-924 EBCDIC 924 European Yes
ebcdic1025 ECYL ibm-1025 EBCDIC 1025 Cyrillic Yes
ebcdic1026 ETUR ibm-1026 EBCDIC 1026 Turkish Yes
ebcdic1047 ELAT ibm-1047 EBCDIC 1047 Latin 1 Yes
ebcdic1112 EBAL ibm-1112 EBCDIC 1112 Baltic Yes
ebcdic1122 EEST ibm-1122 EBCDIC 1122 Estonian Yes
ebcdic1130 EVIE ibm-1130 EBCDIC 1130 Vietnamese Yes
ebcdic1140 E140 ibm-1140 EBCDIC 1140 North America Yes
ebcdic1141 E141 ibm-1141 EBCDIC 1141 Austria/Germany Yes
ebcdic1142 E142 ibm-1142 EBCDIC 1142 Denmark/Norway
Yes
ebcdic1143 E143 ibm-1143 EBCDIC 1143 Finland/Sweden Yes
ebcdic1144 E144 ibm-1144 EBCDIC 1144 Italy Yes
ebcdic1145 E145 ibm-1145 EBCDIC 1145 Spain/LatinAmerica
Yes
ebcdic1146 E146 ibm-1146 EBCDIC 1146 United Kingdom Yes
ebcdic1147 E147 ibm-1147 EBCDIC 1147 France Yes
ebcdic1148 E148 ibm-1148 EBCDIC 1148 International Yes
Reference for language elementsVersion 3.3
21
Name ShortName
Alternative Name Description 'Yes' =Usableas serverencodingon z/OS
'Yes' =Usableas serverencodingon otherplatforms
ebcdic-any EBCD Any FLG_EBCDIC encoding Yes
open_ed-420 EOAR ibm-420,swaplfnl Open Edition 420 Old Arabic Yes
open_ed-424 EOIW ibm-424,swaplfnl Open Edition 424 Hebrew Yes
open_ed-838 EOTH ibm-838,swaplfnl Open Edition 838 Thai Yes
open_ed-870 EOL2 ibm-870,swaplfnl Open Edition 870 CentralEurope
open_ed-875 EOEL ibm-875,swaplfnl Open Edition 875 Greek Yes
open_ed-924 EOLT ibm-924,swaplfnl Open Edition 924 European Yes
open_ed-1025 EOCY ibm-1025,swaplfnl Open Edition 1025 Cyrillic Yes
open_ed-1026 EOTR ibm-1026,swaplfnl Open Edition 1026 Turkish Yes
open_ed-1047 EOL1 ibm-1047,swaplfnl Open Edition 1047 Latin 1 Yes
open_ed-1112 EOBL ibm-1112,swaplfnl Open Edition 1112 Baltic Yes
open_ed-1122 EOET ibm-1122,swaplfnl Open Edition 1122 Estonian Yes
open_ed-1130 EOVT ibm-1130,swaplfnl Open Edition 1130 Vietnamese Yes
open_ed-037 EOUS ibm-037,swaplfnl Open Edition 037 Old NorthAmerica
Yes
open_ed-273 EODE ibm-273,swaplfnl Open Edition 273 Old Austria/Germany
Yes
open_ed-275 EOBR ibm-275,swaplfnl Open Edition 275 Brazil Yes
open_ed-277 EODA ibm-277,swaplfnl Open Edition 277 OldDenmark/Norway
Yes
open_ed-278 EOFI ibm-278,swaplfnl Open Edition 278 Old Finland/Sweden
Yes
open_ed-280 EOIT ibm-280,swaplfnl Open Edition 280 Old Italy Yes
open_ed-284 EOES ibm-284,swaplfnl Open Edition 284 Old Spain Yes
open_ed-285 EOUK ibm-285,swaplfnl Open Edition 285 Old UnitedKingdom
Yes
open_ed-297 EOFR ibm-297,swaplfnl Open Edition 297 Old France Yes
open_ed-500 EOSW ibm-500,swaplfnl Open Edition 500 OldInternational
Yes
Reference for language elementsVersion 3.3
22
Name ShortName
Alternative Name Description 'Yes' =Usableas serverencodingon z/OS
'Yes' =Usableas serverencodingon otherplatforms
open_ed-1140 EO40 ibm-1140,swaplfnl Open Edition 1140 NorthAmerica
Yes
open_ed-1141 EO41 ibm-1141,swaplfnl Open Edition 1141 Austria/Germany
Yes
open_ed-1142 EO42 ibm-1142,swaplfnl Open Edition 1142 Denmark/Norway
Yes
open_ed-1143 EO43 ibm-1143,swaplfnl Open Edition 1143 Finland/Sweden
Yes
open_ed-1144 EO44 ibm-1144,swaplfnl Open Edition 1144 Italy Yes
open_ed-1145 EO45 ibm-1145,swaplfnl Open Edition 1145 Spain Yes
open_ed-1146 EO46 ibm-1146,swaplfnl Open Edition 1146 UnitedKingdom
Yes
open_ed-1147 EO47 ibm-1147,swaplfnl Open Edition 1147 France Yes
open_ed-1148 EO48 ibm-1148,swaplfnl Open Edition 1148 International Yes
open_ed-425 EOA2 ibm-425,swaplfnl Open Edition 425 Arabic Yes
utf-e UTFE UTF-EBCDIC Unicode Yes
utf-8 UTF8 utf-8 UTF--8 Unicode Yes
utf-16be utf-16BE UTF-16 Big Endian Unicode
utf-16le utf-16LE UTF-16 Little Endian Unicode
utf-32be utf-32BE UTF-32 Big Endian Unicode
utf-32le utf-32LE UTF-32 Little Endian Unicode
ibm-930 J930 ibm-930 Katakana (IBM) Yes
ibm-933 KIBM ibm-933 Korean (IBM) Yes
ibm-935 ZIBM ibm-935 Simplified Chinese (IBM) Yes
ibm-937 YIBM ibm-937 Traditional Chinese (IBM) Yes
ibm-939 JIBM ibm-939 Japanese (IBM) Yes
ibm-939e Japanese (IBM-939E) Yes
ibm-942 JPC ibm-942 Japanese (PCIBM) Yes
ibm-949 KPC ibm-949 Korean (PCIBM) Yes
ibm-950 ZPC ibm-950 Traditional Chinese (PCIBM) Yes
Reference for language elementsVersion 3.3
23
Name ShortName
Alternative Name Description 'Yes' =Usableas serverencodingon z/OS
'Yes' =Usableas serverencodingon otherplatforms
ibm-1381 YPC Simplified Chinese (PCIBM)
gb18030 Simplified Chinese (GB18030)
us-ascii ANSI us-ascii 7-Bit US-ASCII Yes
latin1 LAT1 iso-8859-1 ISO-8859-1 Western Yes
latin2 LAT2 iso-8859-2 ISO-8859-2 Central Europe Yes
latin3 LAT3 iso-8859-3 ISO-8859-3 Southern Europe Yes
latin4 LAT4 iso-8859-4 ISO-8859-4 Northern Europe Yes
latin5 LAT5 iso-8859-9 ISO-8859-9 Turkish Yes
latin6 LAT6 iso-8859-10 ISO-8859-10 Baltic Yes
latin9 LAT9 iso-8859-15 ISO-8859-15 European Yes
cyrillic CYRL iso-8859-5 ISO-8859-5 Cyrillic Yes
arabic ARAB iso-8859-6 ISO-8859-6 Arabic Yes
greek GREK iso-8859-7 ISO-8859-7 Greek Yes
hebrew HEBR iso-8859-8 ISO-8859-8 Hebrew Yes
thai THAI iso-8859-11 ISO-8859-11 Thai Yes
pcoem437 P437 ibm-437 IBM-4337 USA Yes
pcoem850 P850 ibm-850 IBM-850 Western Yes
pcoem852 P852 ibm-852 IBM-852 Central Europe Yes
pcoem857 P857 ibm-857 IBM-857 Turkish Yes
pcoem858 P858 ibm-858 IBM-858 European Yes
pcoem862 P862 ibm-862 IBM-862 Hebrew Yes
pcoem864 P864 ibm-864 IBM-864 Arabic Yes
pcoem865 P865 ibm-865 IBM-865 Nordic Yes
pcoem866 P866 ibm-866 IBM-866 Cyrillic Yes
pcoem869 P869 ibm-869 IBM-869 Greek Yes
pcoem874 P874 ibm-874 IBM-874 Thai Yes
pcoem921 P921 ibm-921 IBM-921 Baltic Yes
pcoem922 P922 ibm-922 IBM-922 Estonian Yes
pcoem1129 PVIE ibm-1129 IBM-1129 Vietnamese Yes
Reference for language elementsVersion 3.3
24
Name ShortName
Alternative Name Description 'Yes' =Usableas serverencodingon z/OS
'Yes' =Usableas serverencodingon otherplatforms
msdos720 P720 windows-720 Windows OEM 720 Arabic Yes
msdos737 P737 windows-737 Windows OEM 737 Greek Yes
msdos775 P775 windows-775 Windows OEM 775 Baltic Yes
pcoem860 P860 ibm-860 IBM-860 Portuguese (MS-DOS) Yes
pcoem863 P863 ibm-863 IBM-863 French Canadian Yes
wlatin2 WLT2 windows-1250 Windows-1250 Central Europe Yes
wcyrillic WCYL windows-1251 Windows-1251 Cyrillic Yes
wlatin1 WLT1 windows-1252 Windows-1252 Western Yes
wgreek WBRK windows-1253 Windows-1253 Greek Yes
wturkish WTUR windows-1254 Windows-1254 Turkish Yes
whebrew WHEB windows-1255 Windows-1255 Hebrew Yes
warabic WARA windows-1256 Windows-1256 Arabic Yes
wbaltic WBAL windows-1257 Windows-1257 Baltic Yes
wvietnamese WVIW windows-1258 Windows-1258 Vietnamese Yes
aroman AROM Apple Roman Yes
aarabic AARA Apple Arabic Yes
ahebrew AHEB Apple Hebrew Yes
agreek AGRK cp1280 Apple cp-1280 Greek Yes
athai ATHA Apple Thai Yes
aturkish ATUR cp1281 Apple cp-1281 Turkish Yes
aukrainian AUKR Apple Ukrainian Yes
roman8 Roman (HP)
saslatin1 Western (SAS-Windows)
saslatin2 Central Europe (SAS-Windows)
ms-950 ZWIN windows-950 Traditional Chinese (PCMS) Yes
euc-cn ZEUC euc-cn Simplified Chinese (EUC) Yes
euc-tw YEUC euc-tw Traditional Chinese (EUC) Yes
hp15-tw YHPX Traditional Chinese (HP15)
macos-2 YMAC Traditional Chinese (PCMAC)
Reference for language elementsVersion 3.3
25
Name ShortName
Alternative Name Description 'Yes' =Usableas serverencodingon z/OS
'Yes' =Usableas serverencodingon otherplatforms
big5 BIG5 big5 Traditional Chinese (Big5) Yes
ms-936 YWIN windows-936 Simplified Chinese (PCMS) Yes
dec-cn ZVMS Simplified Chinese (DEC)
dec-jp JVMS Japanese (DEC)
dec-tw YVMS Traditional Chinese (DEC)
euc-jp JEUC euc-jp Japanese (EUC) Yes
macos-1 JMAC Japanese (PCMAC)
macos-3 KMAC Korean (PCMAC)
macos-25 ZMAC Simplified Chinese (PCMAC)
ms-932 J932 windows-932 Japanese (PCMS) Yes
shift-jis SJIS shift_jis Japanese (SJIS) Yes
euc-kr KEUC euc-kr Korean (EUC) Yes
ms-949 KWIN windows-949 Korean (PCMS) Yes
fujitsu-tw YFUJ Traditional Chinese (FACOM)
fujitsu-cn ZFUJ Simplified Chinese (FACOM)
fujitsu-jp JFUJ Japanese (FACOM)
fujitsu-kana Katakana (FACOM)
fujitsu-ko KFUJ Korean (FACOM)
hitachi-cn ZHIT Simplified Chinese (HITAC)
hitachi-jp JHIT Japanese (HITAC)
hitachi-kana Katakana (HITAC)
hitachi-ko KHIT Korean (HITAC)
hitachi-tw YHIT Traditional Chinese (HITAC)
hitsas-tw YHTS Traditional Chinese (XHITAC)
hitsas-cn ZHTS Simplified Chinese (XHITAC)
hitsas-jp JHTS Japanese (XHITAC)
hitsas-kana Katakana (XHITAC)
hitsas-ko KHTS Korean (XHITAC)
nec-jp Japanese (NEC)
Reference for language elementsVersion 3.3
26
Name ShortName
Alternative Name Description 'Yes' =Usableas serverencodingon z/OS
'Yes' =Usableas serverencodingon otherplatforms
nec-kana Katakana (NEC)
pcjis Japanese (PCJIS)
jis-7 Japanese (JIS7)
ucsu Unicode Compression
aiceland AICE cp1286 Apple cp-1286 Icelandic Yes
iso2022jp iso-2022-jp iso-2022-jp
iso2022kr iso-2022-kr iso-2022-kr
iso2022cngb iso-2022-cn iso-2022-cn_gb
sas1047 Western (SAS-EBCDIC)
iso2022cncns iso-2022-cn-cns iso-2022-cn_cns
any ANYE Any encoding
Variable Lists[ _ALL_ |
_CHARACTER_ |_NUMERIC_ |start-variable-name -- end-variable-name |start-variable-name -NUMERIC- end-variable-name |start-variable-name -CHARACTER- end-variable-name |variable-name : |{ variable-name-numeric-suffix - variable-name-numeric-suffix variable-name … }
]
Reference for language elementsVersion 3.3
27
WPS Core
Global statementsStatements that can be used anywhere in a SAS language program
Comment[ * comment-text ; | /* comment-text */ ]
CATNAMECATNAME
[ _ALL_ CLEAR |_ALL_ LIST |name [ CLEAR ] |name LIST |name ( { element … } )
] ;
elementlibrary . member [ ( ACCESS = READONLY ) ]
DSNEXSTDSNEXST filename ;
ENDSASENDSAS ;
Reference for language elementsVersion 3.3
28
ENDWPSENDWPS ;
FILENAME Statements
FILENAMEFILENAME
[ _ALL_ CLEAR |_ALL_ LIST |name CLEAR |name LIST |name "physical-location" [ access-method ] [ options... ]
] EXPDT = "value" LABEL = "value" RECFM = "value" RETPD = "value" ;
On z/OS only, a further ENGINE= option is supported to specify the INFILE/FILE user exit that will beused when accessing the file reference through the INFILE/FILE statements in a datastep.
FILENAME, DDE Access MethodFILENAME name DDE "DDE-triplet" [ { dde-option … } ] ;
dde-option[ HOTLINK |
NOTAB |COMMAND |LRECL = "n" |RECFM =
[ "F" |"N" |"P" |"S370V" |"S370VB" |"S370VBS" |"V" |"D"
] ]
Reference for language elementsVersion 3.3
29
FILENAME, DDEX Access MethodFILENAME name DDEX "DDEX-triplet" [ { ddex-option … } ] ;
ddex-option[ DATE_FORMAT = "EXCEL-FORMAT-STRING" |
DATETIME_FORMAT = "EXCEL-FORMAT-STRING" |FORMAT_CELLS |DLM = "delimiter-character" |LRECL = "n" |RECFM =
[ "F" |"N" |"P" |"S370V" |"S370VB" |"S370VBS" |"V" |"D"
] |TERMSTR = "line-termination-string" |TIME_FORMAT = "EXCEL-FORMAT-STRING"
]
FILENAME, DISK Access MethodFILENAME name DISK
[ physical-location |( { physical-location … } )
] [ |
BLKSIZE = n |LRECL = n |RECFM = format |MOD |OLD
] ;
FILENAME, EMAIL Access MethodFILENAME name EMAIL [ address ] [ { email-option … } ] ;
Reference for language elementsVersion 3.3
30
email-option[ [ CONTENT_TYPE | CT | TYPE ] = "content-type" |
TO = address-list |CC = address-list |BCC = address-list |DELIVERYRECEIPT |ENVELOPE_FROM = address |FROM = address |MIME_WARNING = "mime support warning string" |READRECEIPT |REPLYTO = address |SUBJECT = "subject" |X_MAILER = "xmailer string" |ATTACH =
[ "filename.ext" |( "filename.ext" { attachment-option … } )
] ]
address-list[ ( { address … } ) |
address]
address[ "user@host" | "Real Name <user@host>" ]
attachment-option[ [ CONTENT_TYPE | CT | TYPE ] = "content-type" |
ENCODING = "encoding" |[ EXTENSION | EXT ] = "extension" |NAME = "displayed-name" |OUTENCODING = "encoding"
]
FILENAME, FTP Access MethodFILENAME name FTP remote-file [ { ftp-option … } ] ;
Reference for language elementsVersion 3.3
31
ftp-option[ BINARY |
BLOCKSIZE = blocksize |CD = "directory" |DEBUG |DIR |ENCODING = encoding |FILEEXT |HOST = "hostname" |HOSTREPONSELEN = length |LIST |LOWCASE_MEMNAME |LRECL = length |LS |MGET |NEW |PASS = "password" |PASV |PORT = port |RCMD = "command" |RECFM = recfm |S370V |S370VS |TERMSTR = "eol-char" |USER = "user"
]
FILENAME, HADOOP Access MethodFILENAME name HADOOP external file [ { hadoop-option … } ] ;
hadoop-option[ BUFFERLEN = bufferlen |
CFG = file or fileref |CONCAT |DIR |ENCODING = encoding |FILEEXT |LRECL = length |PASS = password |RECFM = recfm |USER = "user"
]
Reference for language elementsVersion 3.3
32
FILENAME, HTTP Access MethodFILENAME name HTTP url ;
FILENAME, PIPE Access MethodFILENAME name PIPE command [ { pipe-option … } ] ;
pipe-option[ BLOCKSIZE = blocksize |
BLKSIZE = blocksize |LRECL = length |RECFM = recfm |CONSOLE = [ MAX | MIN | NORMAL ]
]
FILENAME, SOCKET Access MethodFILENAME name SOCKET hostname:portno [ { socket-option … } ] ;
socket-option[ BLOCKSIZE = blocksize |
ENCODING = encoding |LRECL = length |RECFM = recfm |RECONN = server-connection-limit |SERVER |TERMSTR = "eol-char" |USER = "user"
]
FILENAME, SYSOUT Access MethodFILENAME name SYSOUT [ = class ] [ option ] ;
option[ ALIGN |
Reference for language elementsVersion 3.3
33
BURST |CHAR1 = table-name |CHAR2 = table-name |CHAR3 = table-name |CHAR4 = table-name |CLOSE |COPIES = n |DEST = node |FCB = fcb-name |FLASH = overlay-name |FLASHC = copies |FOLD |FORMS = form-name |HOLD |ID = userid |MODIFY = module-name |MODIFYT = table-reference-character |OUTLIM = limit |PGM = writer-name |UCS = character-set-code |UCSVER |VERIFY
]
FILENAME, URL Access MethodFILENAME name URL url [ { url-option … } ] ;
url-option[ BLOCKSIZE = blocksize |
DEBUG |ENCODING = encoding |LRECL = length |PASS = "password" |PPASS = "password" |PROXY = "url" |PUSER = "username" |RECFM = recfm |TERMSTR = "eol-char" |USER = "user"
]
Reference for language elementsVersion 3.3
34
FILENAME, z/OS Datasets Access MethodFILENAME name dataset-name [ option ] ;
option[ BLKSIZE = nnnnn |
BUFNO = n |DATACLASS = data-class |DISP =
[ status |( status
[ , [ normal-disp ] [ , [ abnormal-disp ] ]] )
] |DSORG = organisation |DSNTYPE = type |EXPDT = [ yyddd | yyyy/ddd ] |LABEL= ( label-subparameters ) |LIKE = data-set-name |LRECL = nnnnn |MGMTCLAS = "management-class" |NOMOUNT |OPTCD = value |RECFM = value |RECORG = organisation |RETPD = days |REUSE |SPACE = ( [ TRK | CYL | blksize ] ,
[ primary-space |( primary-space
[ , secondary-space [ , directory-blocks ]] )
] ) |STORCLAS = "storage-class" |VOLCOUNT = count |VOLSEQ = seqno |VOLSER =
[ volser |( { volser , … } )
] |WAIT = n
]
Reference for language elementsVersion 3.3
35
FOOTNOTEFOOTNOTEn
[ { { graphing-options … } [ footnote-text | "footnote-text" ] … }] ;
graphing-options[ ANGLE = [ 90 | -90 ] |
COLOR = footnote-color |FONT = footnote-font |HEIGHT = n [ units ] |JUSTIFY = [ CENTER | LEFT | RIGHT ]
]
units[ CELLS | CM | IN | PCT | PT ]
%INCLUDE[ %INCLUDE | %INC ] external-file i
[ /
{ S2 = n |S2 = S |[ SOURCE2 | NOSOURCE2 ]
… } ] ;
i See External Files.
LIBNAMELIBNAME
[ _ALL_ CLEAR |name CLEAR |_ALL_ LIST |name LIST |name [ engine-name ] [ physical-location ] [ { engine-option … } ]
] ;
Reference for language elementsVersion 3.3
36
MISSING{ character … } ;
ODS StatementsThe ODS (Output Delivery System) routes the contents of program output to the sources described inthis section, including HTML and PDF.
ODSThe generic structure of an ODS global statement is shown below. Subsequent sections detail the use ofthe ODS system for specific destinations.
ODS [ destination ] generic_options markup_options destination_specific_options ;
generic options{ |
CLOSE |SHOW |[ SELECT | EXCLUDE ]
[ { output_object … } [ PERSIST ] |ALL |NONE
] … }
output object[ full-path |
. remainder-of-full-path |" label " |" label-path " |" . remainder-of-label-path " |label-and-path-mixture |output_object # n
]
Reference for language elementsVersion 3.3
37
ODS MARKUPBelow is a generic list of markup options supported by ODS. Each destination accepts a subset of theseoptions as specified in the corresponding sections.
ODS MARKUP TAGSET = tagset-name [ ( [ ID = ] identifier ) ] generic_options markup_options ;
markup options{ |
ANCHOR = anchor-string |BASE = url-string |[ BODY | FILE ] = file-location [ location_options ] |CHARSET = charset-id |CODE = code-location [ location_options ] |CONTENTS = contents-location [ location_options ] |CSSSTYLE = location [ ( { media-type … } ) ] |ENCODING = encoding-name |FRAME = frame-location [ location_options ] |GPATH = path |HEADTEXT = header-text-string |METATEXT = meta-text-string |PATH = path |[ RECORD_SEPARATOR | RECSEP | RS ] = record-separator-string |STYLE = style-name |STYLESHEET = stylesheet-location [ location_options ] |TRANTAB = id-string
… }
location options(
{ URL = url-string |DYNAMIC |NO_BOTTOM_MATTER |NO_TOP_MATTER |TITLE = title-string
… } )
The following statements are aliases of ODS MARKUP. They are described in the correspondingsections in further detail.
ODS CHTML is an alias of ODS MARKUP TAGSET= tagsets.chtmlODS CSV is an alias of ODS MARKUP TAGSET= tagsets.csvODS CSVALL is an alias of ODS MARKUP TAGSET= tagsets.csvallODS EXCELXP is an alias of ODS MARKUP TAGSET= tagsets.excelxp
Reference for language elementsVersion 3.3
38
ODS HTML is an alias of ODS MARKUP TAGSET= tagsets.htmlcssODS HTMLCSS is an alias of ODS MARKUP TAGSET= tagsets.htmlcssODS HTML4 is an alias of ODS MARKUP TAGSET= tagsets.html4ODS MSOFFICE2K is an alias of ODS MARKUP TAGSET= tagsets.msoffice2kODS PHTML is an alias of ODS MARKUP TAGSET= tagsets.phtmlODS XML is an alias of ODS MARKUP TAGSET= tagsets.xml
ODS CHTMLODS [ CHTML | MARKUP TAGSET = tagsets.chtml ] generic_options markup_options ;
The following markup options are supported (see section ODS MARKUP):
• ANCHOR• BODY• CHARSET• CONTENTS• ENCODING• FILE• FRAME• GPATH• PAGE• PATH• RECORD_SEPARATOR• TRANTAB
ODS CSVODS [ CSV | MARKUP TAGSET = tagsets.csv ] generic_options markup_options CSV_options ;
Reference for language elementsVersion 3.3
39
CSV options[ OPTIONS = (
{ BYLINES = boolean |DELIMITER = character |PROCTITLES = boolean |TITLES = boolean
… } )]
The following markup options are supported (see section ODS MARKUP):
• BODY• CHARSET• ENCODING• FILE• GPATH• PATH• RECORD_SEPARATOR• TRANTAB
ODS CSVALLODS [ CSVALL | MARKUP TAGSET = tagsets.csvall ] generic_options markup_options ;
The following markup options are supported (see section ODS MARKUP):
• BODY• CHARSET• ENCODING• FILE• GPATH• PATH• RECORD_SEPARATOR• TRANTAB
ODS EXCELXPODS [ EXCELXP | MARKUP TAGSET = tagsets.excelxp ] generic_options mark-up_options
EXCELXP_options ;
Reference for language elementsVersion 3.3
40
EXCELXP options[ OPTIONS = (
{ AUTOFILTER =[ all |
none |boolean |column-range
] |AUTOFILTER_TABLE = table-index |ABSOLUTE_COLUMN_WIDTH = numeric-list |AUTOFIT_HEIGHT = boolean |CONTENTS = boolean |CURRENCY_SYMBOL = character |CURRENCY_FORMAT = currency-format |DECIMAL_SEPARATOR = character |DEFAULT_COLUMN_WIDTH = numeric-list |EMBEDDED_FOOTNOTES = boolean |EMBEDDED_TITLES = boolean |FORMULAS = boolean |FROZEN_HEADERS = [ boolean | number ] |FROZEN_ROWHEADERS = [ boolean | number ] |ORIENTATION = [ PORTRAIT | LANDSCAPE ] |PRINT_FOOTER = boolean |PRINT_FOOTER_MARGIN = number |PRINT_HEADER = boolean |PRINT_HEADER_MARGIN = number |SHEET_INTERVAL =
[ BYGROUP |PAGE |PROC |TABLE |NONE
] |SHEET_LABEL = string |SUPPRESS_BYLINES = boolean |THOUSANDS_SEPARATOR = character |WIDTH_FUDGE = number |WIDTH_POINTS = number |ZOOM = number
… } )]
The following markup options are supported (see section ODS MARKUP):
• BODY• CHARSET
Reference for language elementsVersion 3.3
41
• CONTENTS• ENCODING• FILE• GPATH• PAGE• PATH• RECORD_SEPARATOR• STYLE• STYLESHEET• TRANTAB
ODS HTMLThe destination HTML is an alias for HTMLCSS, see section ODS HTMLCSS.
ODS HTMLCSSODS [ HTMLCSS | MARKUP TAGSET = tagsets.htmlcss ] generic_options markup_options
HTMLCSS_options ;
HTMLCSS options[ OPTIONS = ( BITMAP_MODE =
[ "IMG" |"INLINE" |"EMBED" |"OBJECT"
] )]
The following markup options are supported (see section ODS MARKUP):
• ANCHOR• BODY• CHARSET• CONTENTS• CSSSTYLE• ENCODING• FILE
Reference for language elementsVersion 3.3
42
• FRAME• GPATH• HEADTEXT• METATEXT• PAGE• PATH• RECORD_SEPARATOR• STYLE• STYLESHEET• TRANTAB
ODS HTML4ODS [ HTML4 | MARKUP TAGSET = tagsets.html4 ] generic_options markup_options ;
The following markup options are supported (see section ODS MARKUP):
• BODY• CHARSET• ENCODING• FILE• GPATH• PATH• RECORD_SEPARATOR• TRANTAB
ODS LISTINGODS LISTING generic_options LISTING_options ;
LISTING options[ FILE = file-location ]
ODS MSOFFICE2KODS [ MSOFFICE2K | MARKUP TAGSET = tagsets.msoffice2k ] generic_options markup_options ;
Reference for language elementsVersion 3.3
43
The following markup options are supported (see section ODS MARKUP):
• ANCHOR• BODY• CHARSET• CONTENTS• CSSSTYLE• ENCODING• FILE• FRAME• GPATH• HEADTEXT• METATEXT• PAGE• PATH• RECORD_SEPARATOR• STYLE• STYLESHEET• TRANTAB
ODS OLDHTMLODS OLDHTML generic_options OLDHTML_options ;
OLDHTML options{ |
[ BODY | FILE ] = body-location [ location-options ] |CSS = [ " external-file " | fileref ] |GFOOTNOTE = " Graphics footnote text " |GPATH = " graphics output location " |GTITLE = " Graphics title text " |CONTENTS = contents-location |FRAME = frame-location [ location-options ] |PAGE = page-location [ location-options ] |PATH = path
… }
Reference for language elementsVersion 3.3
44
location-options(
{ URL = " URL string " |DYNAMIC |NO_BOTTOM_MATTER |NO_TOP_MATTER |TITLE = " Title string "
… } )
ODS PDFODS PDF generic_options PDF_options ;
PDF options{ |
FILE = [ " pdf-file " | fileref ] |COLUMNS = n |OUTPUTBY = [ PAGE | TABLE ] |STARTPAGE = [ NO | YES ] |STYLE = style-name
… }
ODS PDF Options
The following system options allow you to determine how PDFs are output via the ODS:
• PAPER SIZE• ORIENTATION• TOPMARGIN• BOTTOMMARGIN• LEFTMARGIN• RIGHTMARGIN
Note:Negative values are not allowed.
Reference for language elementsVersion 3.3
45
PAPER SIZE
This option sets the paper size of the PDFs output via the ODS.
PAPERSIZE =[ A2 |
A3 |A4 |A5 |LETTER |USLETTER
]
Valid in: ODS PDF: in configuration file, Options statement and/orcommand line
Default: The paper size associated with the Locale.
ORIENTATION
This option sets the orientation (PORTRAIT or LANDSCAPE) of the PDFs output via the ODS.
ORIENTATION = [ PORTRAIT | LANDSCAPE ]
Valid in: ODS PDF: in configuration file, Options statement and/orcommand line
Default: PORTRAIT
TOPMARGIN
This option sets the top margin of the of the PDFs output via the ODS.
TOPMARGIN = n.n [ | cm | in | pt ]
Valid in: ODS PDF: in configuration file, Options statement and/orcommand line
Default: Zero inches
BOTTOMMARGIN
This option sets the bottom margin of the of the PDFs output via the ODS.
BOTTOMMARGIN = n.n [ | cm | in | pt ]
Reference for language elementsVersion 3.3
46
Valid in: ODS PDF: in configuration file, Options statement and/orcommand line
Default: Zero inches
LEFTMARGIN
This option sets the left margin of the of the PDFs output via the ODS.
LEFTMARGIN = n.n [ | cm | in | pt ]
Valid in: ODS PDF: in configuration file, Options statement and/orcommand line
Default: Zero inches
RIGHTMARGIN
This option sets the right margin of the of the PDFs output via the ODS.
RIGHTMARGIN = n.n [ | cm | in | pt ]
Valid in: ODS PDF: in configuration file, Options statement and/orcommand line
Default: Zero inches
ODS PHTMLODS [ PHTML | MARKUP TAGSET = tagsets.phtml ] generic_options markup_options ;
The following markup options are supported (see section ODS MARKUP):
• BODY• CHARSET• ENCODING• FILE• GPATH• HEADTEXT• METATEXT• PATH• RECORD_SEPARATOR
Reference for language elementsVersion 3.3
47
• STYLE• TRANTAB
ODS XMLODS [ XML | MARKUP TAGSET = tagsets.xml ] generic_options markup_options ;
The following markup options are supported (see section ODS MARKUP):
• BODY• CHARSET• CONTENTS• ENCODING• FILE• GPATH• PATH• RECORD_SEPARATOR• TRANTAB
ODS _ALL_ CLOSEODS _ALL_ CLOSE ;
ODS PROCLABELODS PROCLABEL " label ";
ODS PROCTITLEODS [ PROCTITLE | NOPROCTITLE ] ;
Reference for language elementsVersion 3.3
48
ODS OUTPUTODS OUTPUT
[ CLEAR |CLOSE |SHOW |{ options … }
] ;
optionsoutput-object
[ (
{ PERSIST = [ proc | run ] |MATCH_ALL [ = macrovarname ]
… } )[ # n ]] [ = WPS-Data-set-name ]
output-object[ full-path |
. remainder-of-full-path |" label " |" label-path " |" . remainder-of-label-path " |label-and-path-mixture
]
ODS TRACEODS TRACE [ ON | OFF ] [ / [ LABEL | LISTING ] ] ;
OPTIONSOPTIONS { option … } ;
PAGEPAGE ;
Reference for language elementsVersion 3.3
49
RUNRUN [ CANCEL ] ;
SKIPSKIP [ n ] ;
SYSTASK Statements
SYSTASK COMMANDSYSTASK COMMAND "operating system command" [ { option … } ] ;
option[ WAIT |
NOWAIT |TASKNAME = name |MNAME = var-namem |STATUS = var-name |SHELL [ = "shell-path" ] |CLEANUP
]
SYSTASK LISTSYSTASK LIST [ _ALL_ | task-name ] [ STATE ] [ STATVAR ] ;
SYSTASK KILLSYSTASK KILL { task-name … } ;
Reference for language elementsVersion 3.3
50
TITLETITLEn
[ { { graphing-options … } [ title-text | "title-text" ] … }] ;
graphing-options[ ANGLE = [ 90 | -90 ] |
COLOR = title-color |FONT = title-font |HEIGHT = n [ units ] |JUSTIFY = [ CENTER | LEFT | RIGHT ]
]
units[ CELLS | CM | IN | PCT | PT ]
WAITFORWAITFOR [ | _ANY_ | _ALL_ ] { [ remote-id | task-name ] … } [ TIMEOUT = seconds ] ;
The WAITFOR _ALL_ statement suspends execution of the current session until processing iscomplete for all of the task-names (or for all of the server remote-ids in the case of WPSCommunicate), or until the TIMEOUT interval, if specified, has expired.
If you use WAITFOR _ANY_, or simply WAITFOR, instead of WAITFOR _ALL_, then execution of thesession will only be suspended until processing is complete on one of the server task-names orremote-ids (or until the TIMEOUT interval, if specified, has expired).
Note:As implied above, the default is _ANY_ rather than _ALL_ if no argument is supplied between WAITFORand the remote-ids or task-names.
X Statements
X (on UNIX platforms)X command-text ;
Reference for language elementsVersion 3.3
51
X (on Windows)X command-text ;
X (on z/OS)X command-text ;
System optionsSystem options are settings that apply to WPS sessions.
System options can be specified by the OPTION or OPTIONS statements, a configuration file, or via thecommand line. Not all system options can be set by all three methods - refer to detail of this sectionfor more information. WPS Workbench also provides dialogues in which system options can be set.This can be accomplished by right clicking on the name of a WPS server in the Output Explorer tab,selecting Properties and choosing either Startup Options or System Options from the Properties forLocal Server dialog.
To understand which options are in effect for the current WPS session, use PROC OPTIONS:
proc options;
The output log will contain a list of applicable options, divided into two groups: Portable options andHost options:
Portable Options:
NOAUTOSIGNON Remote submit will not attempt to automatically signon BASEENGINE=WPD The library engine to use when BASE is specified BOMFILE Write a Byte Order Mark prefix on external Unicode files BUFNO=1 Specifies the number of buffers used by a library engine for a dataset (not honoured by all engines) BUFSIZE=0 Specifies the size of a page for a WPS dataset...
Reference for language elementsVersion 3.3
52
Non OS-specific system optionsSystem options applicable to all platforms.
_LAST_The _LAST_ dataset contains the name of the most recent dataset.
You can, however, assign a dataset name to this system option to alter this behaviour
_LAST_ = data-set i
i See Dataset.
Valid in: OPTIONS statement, configuration file and command lineMax length: 1024
AUTOEXECSpecifies the location of a file to be automatically executed at WPS initialisation.
[ AUTOEXEC = location | NOAUTOEXEC ]
Valid in: Configuration file and command lineMax length: 1024
AUTOSIGNONWhen this system option is active, remote submit will attempt to automatically sign on.
[ AUTOSIGNON | NOAUTOSIGNON ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOAUTOSIGNON
Reference for language elementsVersion 3.3
53
BASEENGINEThis system option specifies the library engine to use when BASE is specified.
BASE is a pseudo engine name - if it is used as a library engine name in a LIBNAME statement, theengine name actually used is taken from the BASEENGINE system option.
BASEENGINE = engine-name
Valid in: Configuration file and command lineDefault: WPDMax length: 8
BOMFILEIf present, this system option instructs WPS to write a byte order mark (BOM) on external Unicode files.
[ BOMFILE | NOBOMFILE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: BOMFILE
BUFNOThis system option specifies the number of buffers used by a library engine for a data set (it is nothonoured by all library engines).
BUFNO = number-of-buffers
Valid in: OPTIONS statement, configuration file and command lineDefault: 1Min value: 0Max value: 2,147,483,647
BUFSIZEThis system option specifies the size of a page for a WPS dataset. If the value provided is too small,WPS will override it and round it up to some sensible multiple.
BUFSIZE = buffer-size
Reference for language elementsVersion 3.3
54
Valid in: OPTIONS statement, configuration file and command lineDefault: 0 - WPS will choose a sensible, system-dependent valueMin value: 0Max value: 2,147,483,647
BYERRIf set, this system option instructs WPS to generate an error when a null dataset is used as input toPROC SORT.
Its behaviour is very specific - it controls what happens specifically when the syntax data=_NULL_ ordata=lib._NULL_ is used with PROC SORT.
[ BYERR | NOBYERR ]
Valid in: OPTIONS statement, configuration file and command lineDefault: BYERR
BYLINEIf set, this system option instructs WPS to generate a BY line title for each BY group in the output.
[ BYLINE | NOBYLINE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: BYLINE
CAPSIf set, this system option instructs WPS to transform source and data lines to upper case.
[ CAPS | NOCAPS ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOCAPS
Reference for language elementsVersion 3.3
55
CARDIMAGEIf set, this system option instructs WPS to treat CARDS lines as 80 character wide records.
It is active by default and can be switched off by specifying NOCARDIMAGE, in which case WPS treatsCARDS lines as variable length records.
[ CARDIMAGE | NOCARDIMAGE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: CARDIMAGE
CENTERIf active, this sytem option instructs WPS to align listing output to the center of the page; f inactive, itinstructs WPS to align listing output to the left of the page.
This system option is functionally identical to the CENTRE system option and is active by default.
[ CENTER | NOCENTER ]
Valid in: OPTIONS statement, configuration file and command lineDefault: CENTER
CENTREIf active, instructs WPS to align listing output to the centre of the page. If inactive, it instructs WPS toalign listing output to the left of the page.
This system option is functionally identical to the CENTER system option and is active by default – toswitch it off, specify NOCENTRE.
[ CENTRE | NOCENTRE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: CENTRE
Reference for language elementsVersion 3.3
56
CHARCODEInstructs WPS to allow or not allow character combinations as a substitute for special characters not onthe keyboard.
If active character combinations are used as a substitute for special characters not on the keyboard; ifinactive the character combinations are not available.
[ CHARCODE | NOCHARCODE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOCHARCODE
To achieve: Use these characters:backquote ?:backslash ?,left parenthesis ?(right parenthesis ?)not ?=left square bracket ?<right square bracket ?>underscore ?-bar ?/
COMAMIDThis system option specifies the communication method to use for establishing remotecommunications.
COMAMID = communication-method
Valid in: OPTIONS statement, configuration file and command lineDefault: TCPMax length: 8
COMPRESSThis system option specifies whether to compress observations in output WPS data sets.
COMPRESS = [ YES | Y | ON | NO | N | CHAR | BINARY ]
Reference for language elementsVersion 3.3
57
Valid in: OPTIONS statement, configuration file and command lineDefault: NO
CONNECTPERSISTWhen set, this system option specifies that a remote connection will be persisted after an RSUBMITblock. This system option is an alias of CPERSIST.
[ CONNECTPERSIST | NOCONNECTPERSIST ]
Valid in: OPTIONS statement, configuration file and command lineDefault: CONNECTPERSIST
CONNECTREMOTEThis system option identifies a specific remote server to connect to. It is blank (empty string) by default.
CONNECTREMOTE = server-name
Valid in: OPTIONS statement, configuration file and command lineDefault: blankMax length: 1024
CPORTVERThis system option controls which type of CPORT file is generated by default by PROC CPORT.
CPORTVER = [ SAS82 | SAS91 | SAS92 | SAS93 ]
Valid in: OPTIONS statement, configuration file and command lineDefault: SAS93
CPUCOUNTThis system option specifies the number of CPUs available to the application. The allowable range isbetween 1 and 1024 inclusive.
CPUCOUNT = [ n | ACTUAL ]
Reference for language elementsVersion 3.3
58
Valid in: OPTIONS statement, configuration file and command lineDefault: The number of active logical cpusMin value: 1Max value: 1024
DATASTMTCHKThis system option is designed to control the use of certain keywords as names, to stop accidentaloverwriting of datasets.
By default, the words MERGE, RETAIN, SET and UPDATE cannot be used as dataset names, and allof the other SAS language keywords can be flagged as invalid dataset names by using OPTIONSDATASTMTCHK=ALLKEYWORDS
DATASTMTCHK = [ COREKEYWORDS | NONE | ALLKEYWORDS ]
Valid in: OPTIONS statement, configuration file and command lineDefault: COREKEYWORDS
DATEIf active, this system option prints the date and time at the top of each page of output.
[ DATE | NODATE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: DATE
Reference for language elementsVersion 3.3
59
DATESTYLEThis system option controls how numeric dates are interpreted in the ANYDTxxx informats.
DATESTYLE =[ DMY |
DYM |MDY |MYD |YDM |YMD |LOCALE
]
Valid in: OPTIONS statement, configuration file and command lineDefault: LOCALE
DBSLICEPARMThis option allows the user to set the number of parallel threads for reading tables.
During a multi-threaded read, WPS extracts the table data by splitting the original query into smallerqueries, each returning a subset of data
dbsliceparm =[ NONE |
THREADED_APPS |ALL |( [ THREADED_APPS | ALL ] [ | , max-threads | max-threads ] )
]
Valid in: OPTIONS statement, configuration file and command lineDefault: 1Min value: 1Max value: 32767
NONEUse a single thread, i.e., multi-threaded reading is turned off.
THREADED_APPS or ALLSet the number of threads either to the number of CPUs on the server, or to a user-suppliednumber, whichever is smaller.
Reference for language elementsVersion 3.3
60
DEBUGTurns on individual debugging controls.
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 1024
DETAILSWhen set, this system option instructs WPS to show additional details of datasets when listing datalibraries.
[ DETAILS | NODETAILS ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NODETAILS
DEVICEThis system option specifies the device to be used for graphical output.
DEVICE = device-name
Valid in: OPTIONS statement, configuration file and command lineMax length: 8
DFLANGThe DFLANG system option specifies the language for EURDF date/time formats and informats.
DFLANG = language
Valid in: OPTIONS statement, configuration file and command lineDefault: ENGLISH
languageOptions for language are:
AFRIKAANS
Reference for language elementsVersion 3.3
61
CATALANCROATIANCZECHDANISHDUTCHENGLISHFINNISHFRENCHGERMANHUNGARIANITALIANLOCALEMACEDONIANNORWEGIANPOLISHPORTUGUESERUSSIANSPANISHSLOVENIANSWEDISHSWISS_FRENCHSWISS_GERMAN
DIRECTIOWhen active, this system option instructs WPS to use direct I/O where possible.
By default, this option is inactive, and is not available in z/OS environments.
[ DIRECTIO | NODIRECTIO ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NODIRECTIO
Reference for language elementsVersion 3.3
62
DKRICONDActions for DROP/KEEP/RENAME error conditions on input datasets.
DKRICOND =[ ERROR |
[ WARN | WARNING ] |[ NOWARN | NOWARNING ]
]
Valid in: OPTIONS statement, configuration file and command lineDefault: ERROR
DKROCONDThis system option specifies actions for DROP/KEEP/RENAME error conditions on output datasets.
DKROCOND =[ ERROR |
[ WARN | WARNING ] |[ NOWARN | NOWARNING ]
]
Valid in: OPTIONS statement, configuration file and command lineDefault: WARN
DMRThis sytem option invokes a WPS COMMUNICATE server session. It is inactive by default and can beeffected only via the command line.
[ DMR | NODMR ]
Valid in: Command line onlyDefault: NODMR
Reference for language elementsVersion 3.3
63
DMSWhen active, this system option indicates that the windowed environment is not supported.
[ DMS | NODMS ]
Valid in: Configuration file and command lineDefault: NODMS
DSNFERRWhen active, this system opiton indicates that WPS should generate an error when a data set not founderror occurs.
[ DSNFERR | NODSNFERR ]
Valid in: OPTIONS statement, configuration file and command lineDefault: DSNFERR
DTRESETWhen active, this system option updates the date and time in the titles of the log and listing file for eachnew page written.
[ DTRESET | NODTRESET ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NODTRESET
ECHOAUTOThis system option instructs WPS to echo source lines from the AUTOEXEC file to the log.
[ ECHOAUTO | NOECHOAUTO ]
Valid in: Configuration file and command lineDefault: NOECHOAUTO
Reference for language elementsVersion 3.3
64
EMAILAUTHPROTOCOLThis system option specifies whether authentication is used for SMTP email connections - and can beset to either NONE or LOGIN.
EMAILAUTHPROTOCOL = [ NONE | LOGIN ]
Valid in: Configuration file and command lineDefault: NONE
EMAILHOSTThis system option specifies the SMTP server host for the email access method.
EMAILHOST = address
Valid in: Configuration file and command lineDefault: localhostMax length: 35
EMAILIDThis system option specifies the user id for connecting to SMTP.
EMAILID = SMTP login id
Valid in: Configuration file and command lineMax length: 32000
EMAILPORTThis system option specifies the port number of the SMTP server for the email access method.
EMAILPORT = port-number
Valid in: Configuration file and command lineDefault: 25Min value: 0Max value: 2147483647
Reference for language elementsVersion 3.3
65
EMAILPWThis system option specifies the password for connecting to SMTP.
EMAILPW = SMTP login password
Valid in: Configuration file and command lineMax length: 32000
EMAILSTARTTLSThis system option establishes whether STARTTLS is used for SMTP email connections, and is amechanism to upgrade a plain text connection to an encrypted connection.
EMAILSTARTTLS = [ AUTO | IGNORE | REQUIRE ]
Valid in: Configuration file and command lineDefault: AUTO
AUTOIf set to AUTO an attempt is made to encrypt it.
IGNOREIf set to IGNORE, mail is sent unencrypted.
REQUIREIf set to REQUIRE, an attempt is made to encrypt it; . If this attempt fails, an error is generated.
EMAILSYSThis system option sets the email system type – either SMTP or MAPI (Windows only).
EMAILSYS = interface-name
Valid in: Configuration file and command lineDefault: MAPI
Reference for language elementsVersion 3.3
66
ENCODINGThis system option specifies the default character encoding.
ENCODING = encoding
Valid in: Configuration file and command lineMax length: 32
ENGINEThis system option specifies the default library engine for dataset files – the default value is WPD.
ENGINE = engine
Valid in: Configuration file and command lineDefault: WPDMax length: 8
ERRORABENDWhen active, this system option specifies that execution will terminate when an error occurs.
[ ERRORABEND | NOERRORABEND ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOERRORABEND
ERRORCHECKSets the behaviour on encountering a non-existent %INCLUDE file.
ERRORCHECK = [ NORMAL | STRICT ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NORMALMax length: 10
Reference for language elementsVersion 3.3
67
ERRORSThis system option specifies the maximum number of observations for which complete error messagesshould be printed.
ERRORS =[ [ n | nK | nM | nG | nX ] |
MAX |MIN
]
Valid in: OPTIONS statement, configuration file and command lineDefault: 20Min value: 0Max value: 2,147,483,647
FIRSTOBSThis system option sets the number of the first observation to process in a dataset.
FIRSTOBS =[ [ n | nK | nM | nG | nX ] |
MAX |MIN
]
Valid in: OPTIONS statement, configuration file and command lineDefault: 1Min value: 1Max value: Maximum integer value supported by the system
FMTERRWhen active, this system opiton instructs WPS to treat missing formats as an error.
[ FMTERR | NOFMTERR ]
Valid in: OPTIONS statement, configuration file and command lineDefault: FMTERR
Reference for language elementsVersion 3.3
68
FMTSEARCHThis system option specifies the search path to use when locating user formats.
FMTSEARCH = path
Valid in: OPTIONS statement, configuration file and command lineDefault: ()Max length: 2048
FONTPATHThis system option specifies the search path to use when locating TrueType fonts.
FONTPATH = path
Valid in: OPTIONS statement, configuration file and command lineMax length: 2048
FORMCHARThis system option specifies the default list of output formatting characters.
Use this to specify an alternate set of characters representing drawing primitives that in combinationcan delineate the lines and boxes of output tables on systems with varying levels of font support.
FORMCHAR = "character-list"
Valid in: OPTIONS statement, configuration file and command lineDefault: |----|+|---+=|-/\\<>*Max length: 20
FORMDLIMThis system option specifies a character to delimit page breaks in listing output.
FORMDLIM = "single-character"
Valid in: OPTIONS statement, configuration file and command lineDefault: ""
Reference for language elementsVersion 3.3
69
Max length: 1
FULLSTIMERThis system option instructs WPS to write performance statistics to the log for each step.
[ FULLSTIMER | NOFULLSTIMER ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOFULLSTIMER
IBUFNOThis system option specifies the number of index files buffers used by a library engine for a dataset (thisis not honoured by all engines).
IBUFNO = buffer-number
Valid in: OPTIONS statement, configuration file and command lineDefault: 0Min value: 0Max value: 10000
IBUFSIZEThis system option specifies the size of an index page for a WPS dataset.
IBUFSIZE = buffer-size
Valid in: OPTIONS statement, configuration file and command lineDefault: 0Min value: 0Max value: 32767
Reference for language elementsVersion 3.3
70
IMPLMACWhen active, this system option instructs WPS to allow statement-style macro calls.
[ IMPLMAC | NOIMPLMAC ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOIMPLMAC
INITSTMTWhen set, this system option specifies that initial statements are to execute before any submittedprogram.
INITSTMT = statements
Valid in: Configuration file and command lineMax length: 2048
INVALIDDATAWhen set, this system option specifies the value to assign when invalid numeric data is encountered oninput.
INVALIDDATA = character
Valid in: OPTIONS statement, configuration file and command lineDefault: .Max length: 1
JREOPTIONSThis system option specifies options for the Java runtime environment.
It is not possible to set this in an OPTIONS statement, but it can be included in a configuration file:-JREOPTIONS ('-Djava.class.path=!wpshome\jars\wpcnet.jar;!wpshome\jars\wpcjocl.jar;!wpshome\jars\wpsssh.jar')
JREOPTIONS = ( { [ option ] , … } )
Reference for language elementsVersion 3.3
71
option[ -Dwps.jre.libjvm = JVM-library-path |
-Djava.class.path = { [ Java-class-path ] ; … } |-X any-supported-JVM-option
]
Valid in: Configuration file and command lineDefault: ""Max length: 32000
LABELIf active this system option enables WPS to retrieve and use a label associated with a variable.
[ LABEL | NOLABEL ]
Valid in: OPTIONS statement, configuration file and command lineDefault: LABEL
LABELRetrieve and use a label associated with a variable.
NOLABELIgnore any label associated with a variable and treat it as if it were not set.
LINESIZEThis system option specifies the line length for log entries.
LINESIZE = [ n | MAX | MIN ]
Valid in: OPTIONS statement, configuration file and command lineDefault: 99 non-z/OS, 132 z/OSMin value: 64Max value: 256
Reference for language elementsVersion 3.3
72
LOCALEThis system option specifies the current locale for the WPS session.
LOCALE = locale
Valid in: OPTIONS statement, configuration file and command lineMax length: 32
LOGThis system option defines the target location for the WPS log. On z/OS, this defaults to SASLOG.
LOG = file
Valid in: Configuration file and command lineDefault: SASLOG on z/OS, otherwise no defaultMax length: 256
LOGTITLEWhen set, this system option instructs WPS to show a title line at top of the log, and at the start of eachpage.
[ LOGTITLE | NOLOGTITLE ]
Valid in: Configuration file and command lineDefault: LOGTITLE
LOGPAGEWhen set, this system option instructs WPS to paginate the log file.
[ LOGPAGE | NOLOGPAGE ]
Valid in: Configuration file and command lineDefault: LOGPAGE
Reference for language elementsVersion 3.3
73
LOGPARMThis system option specifies log file configuration parameters.
LOGPARM =[ OPEN = [ APPEND | REPLACE ] |
WRITE = [ BUFFERED | IMMEDIATE ] ]
Valid in: Configuration file and command lineMax length: 256
MACROWhen active, this system option allows use of the macro facility.
[ MACRO | NOMACRO ]
Valid in: Configuration file and command lineDefault: MACRO
MACROGENWhen active, this system option instructs WPS to trace the execution of old-style macros.
[ MACROGEN | NOMACROGEN ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMACROGEN
MAUTOLOCDISPLAYWhen active, this system option instructs WPS to display the location from which the autocall macrosource code is compiled.
[ MAUTOLOCDISPLAY | NOMAUTOLOCDISPLAY ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMAUTOLOCDISPLAY
Reference for language elementsVersion 3.3
74
MAUTOSOURCEWhen active, this system option instructs WPS to allow the macro autocall feature.
[ MAUTOSOURCE | NOMAUTOSOURCE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: MAUTOSOURCE
MCOMPILEWhen active, this system option instructs WPS to allow new macros to be compiled.
[ MCOMPILE | NOMCOMPILE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: MCOMPILE
MCOMPILENOTEWhen active, this system option instructs WPS to issue a note to the log when a macro has beensuccessfully compiled.
MCOMPILENOTE = [ NONE | NOAUTOCALL | ALL ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NONE
MEMSIZEThis system option specifies a limit on the total amount of memory used by the system. By default, it isset to 0 which allows use of all available memory.
MEMSIZE =[ [ n | nK | nM | nG | nX ] |
MAX |MIN
]
Valid in: Configuration file and command line
Reference for language elementsVersion 3.3
75
Default: 0Min value: 0Max value: Maximum integer value supported by the system
MERGENOBYWhen active, this sytem option instructs WPS to issue a warning, an error, or no warning whena MERGE statement is provided with no BY statement. Allowed values are WARN, ERROR andNOWARN.
MERGENOBY = [ WARN | ERROR | NOWARN ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOWARN
MERRORWhen active, this sytem option instructs WPS to generate an error when an undefined macro referenceoccurs.
[ MERROR | NOMERROR ]
Valid in: OPTIONS statement, configuration file and command lineDefault: MERROR
MINDELIMITERThis system identifies the character to use as the delimiter of the macro IN operator.
MINDELIMITER = delimiter-character
Valid in: OPTIONS statement, configuration file and command lineMax length: 1
Reference for language elementsVersion 3.3
76
MISSINGhis sytem opiton identifies the character that represents missing numeric values.
MISSING = character
Valid in: OPTIONS statement, configuration file and command lineDefault: .Max length: 1
MLOGICWhen active, this system option instructs WPS to trace the execution of macros.
[ MLOGIC | NOMLOGIC ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMLOGIC
MLOGICNESTWhen active, this system option instructs WPS to display macro nesting information in MLOGIC output.
[ MLOGICNEST | NOMLOGICNEST ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMLOGICNEST
MPRINTWhen active, this system option instructs WPS to display WPS statements generated by macroexecution.
[ MPRINT | NOMPRINT ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMPRINT
Reference for language elementsVersion 3.3
77
MPRINTNESTWhen active, this system option instructs WPS to display macro nesting information in MPRINT output.
[ MPRINTNEST | NOMPRINTNEST ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMPRINTNEST
MRECALLWhen active, this system option instructs WPS to search the autocall libraries for an undefined macroname each time it is invoked.
[ MRECALL | NOMRECALL ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMRECALL
MSGCASEWhen active, this system option instructs WPS to translate system messages to upper case
[ MSGCASE | NOMSGCASE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMSGCASE
MSGLEVELThis system option informs WPS of the level of messages displayed - acceptable values are N (default)or I.
MSGLEVEL = [ N | I ]
Valid in: OPTIONS statement, configuration file and command lineDefault: N
Reference for language elementsVersion 3.3
78
MSTOREDWhen set, this sytem option instructs WPS to use stored compiled macros.
[ MSTORED | NOMSTORED ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMSTORED
MSYMTABMAXThis system option specifies maximum size of the macro variable symbol tables.
MSYMTABMAX = maximum-size
Valid in: OPTIONS statement, configuration file and command lineDefault: 1,048,576 on z/OS, otherwise 4,194,304Min value: 0Max value: 2,147,483,647
MTRACEWhen active, this system option instructs WPS to trace the execution of macros and is functionallyidentical to MLOGIC.
[ MTRACE | NOMTRACE ]
MVARSIZEThis system option specifies the maximum length for in-memory macro variables.
MVARSIZE = n
Valid in: OPTIONS statement, configuration file and command lineDefault: 8192 on z/OS, otherwise 4096Min value: 0Max value: 65534
Reference for language elementsVersion 3.3
79
NEWSThis system option specifies the name of a file containing messages that are written to the top of the log
[ NEWS = filename | NONEWS ]
Valid in: Configuration file and command lineDefault: ""Max length: 255
NLSCOMPATMODEWhen set, this system option instructs WPS to use TRANTAB option entry 6 to convert syntaxcharacters into the compiler encoding. Otherwise it will use TRANTAB option entry 8 to classify syntaxcharacters for parsing.
[ NLSCOMPATMODE | NONLSCOMPATMODE ]
Valid in: Configuration file and command lineDefault: NLSCOMPATMODE
NOTESWhen active, this system option instructs WPS to display NOTES in the log.
[ NOTES | NONOTES ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOTES
NUMBERWhen active, this system option instructs WPS to print the page number at the top of each ODSLISTING output page.
[ NUMBER | NONUMBER ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NUMBER
Reference for language elementsVersion 3.3
80
OBSThis system option specifies the number of the last observation to process in a dataset. This may not bethe total number of observations to process in a dataset, because of the potential effect of FIRSTOBS.
OBS =[ [ n | nK | nM | nG | nX ] |
MAX |MIN
]
Valid in: OPTIONS statement, configuration file and command lineDefault: Maximum integer value supported by the systemMin value: 0Max value: Maximum integer value supported by the system
ODSDESTThis system option specifies the default ODS destination to initialise.
ODSDEST = [ LISTING | AUTO | NONE ]
Valid in: Configuration file and command lineDefault: LISTING
AUTOThe default destination is determined by WPS settings.
LISTINGUse the LISTING destination is default.
NONENo default ODS output is set
OPLISTWhen active, this system option prints a list to the log of any command line options passed to the WPSprocess.
[ OPLIST | NOOPLIST ]
Valid in: Configuration file and command lineDefault: NOOPLIST
Reference for language elementsVersion 3.3
81
OVPWhen active, this system option instructs WPS to overprint errors and warnings for emphasis.
[ OVP | NOOVP ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOOVP
PAGENOThis system option specifies the page number to use for the next page of printed output.
PAGENO =[ [ n | nK | nM | nG | nX ] |
MAX |MIN
]
Valid in: OPTIONS statement, configuration file and command lineDefault: 1Min value: 1Max value: 2,147,483,647
PAGESIZEThis system option specifies the number of lines that make up a page of output.
PAGESIZE =[ [ n | nK ] |
MAX |MIN
]
Valid in: OPTIONS statement, configuration file and command lineDefault: 60 on z/OS, otherwise 55Min value: 15Max value: 32767
Reference for language elementsVersion 3.3
82
PARMThis system option specifies a parameter string to pass to external programs.
PARM = string
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 2048
PARMCARDSThis system option specifies the name of a fileref to use as the PARMCARDS file.
PARMCARDS = fileref
Valid in: OPTIONS statement, configuration file and command lineMax length: 32
PATHThis system option specifies the location of the WPS binaries.
PATH = path
Valid in: Configuration file and command lineMax length: 32000
PRINTThis system option specifies the location to which the listing output will be written.
PRINT = file
Valid in: Configuration file and command lineDefault: SASLIST on z/OS, otherwise blankMax length: 1024
Reference for language elementsVersion 3.3
83
QUOTELENMAXWhen active, this system option instructs WPS to warn when quoted string literals exceed 262characters.
[ QUOTELENMAX | NOQUOTELENMAX ]
Valid in: OPTIONS statement, configuration file and command lineDefault: QUOTELENMAX
REPLACEWhen active, this sytem option instructs WPS to allow replacement of permanent data sets.
[ REPLACE | NOREPLACE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: REPLACE
RKEEPWhen active, this sytem option instructs WPS to keep the R environment after termination of PROC R.
[ RKEEP | NORKEEP ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NORKEEP
SThis system option specifies the length of source statements and data lines. The default value of 0applies no limit.
S =[ [ n | nK | nM | nG | nX ] |
MAX |MIN
]
Valid in: OPTIONS statement, configuration file and command line
Reference for language elementsVersion 3.3
84
Default: 0Min value: 0Max value: 2,147,483,647
S2This system option specifies the length of secondary source statements, such as those in included files.It defaults to 0 which applies no limits. If set to S, it uses the value of the S system option to specify thelength.
S2 = [ n | S ]
Valid in: OPTIONS statement, configuration file and command lineDefault: 0
SASAUTOSThis sytem option specifies the search list for autocall macros.
SASAUTOS = { library-specification , … }
Valid in: OPTIONS statement, configuration file and command lineMax length: 2048
SASCMDThis system option specifies the command to be used by WPS COMMUNICATE to start another localWPS session. It is blank (empty string) by default.
SASCMD = command
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 32767
Reference for language elementsVersion 3.3
85
SASHELPThis system option sets the location of the SASHELP library.
SASHELP = library
Valid in: Configuration file and command lineDefault: SASHELP on z/OSMax length: 8192
SASINITIALFOLDERThis system option sets the current working directory for the WPS process - not available as an optionunder z/OS.
SASINITIALFOLDER = path
Valid in: Configuration file and command lineMax length: 260
SASMSTOREThis system option specifies the name of the library containing stored compiled macros.
SASMSTORE = libref
Valid in: OPTIONS statement, configuration file and command lineMax length: 32
SASSCRIPTThis system option specifies the location of the WPS COMMUNICATE signon scripts.
SASSCRIPT = ( { location … } )
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 1024
Reference for language elementsVersion 3.3
86
SASTRACEThis system option specifies the level of debug tracing in the database engines - for example: optionsSASTRACE=',,,d';
SASTRACE = [ ",,d," | ",,,d" ]
Valid in: OPTIONS statement, configuration file and command lineMax length: 32
SASTRACELOCThis sytem option specifies the location where database engine debug tracing is written.
SASTRACELOC = SASLOG
Valid in: OPTIONS statement, configuration file and command lineMax length: 1024
SASUSERThis system option specifies the location of the SASUSER library.
SASUSER = library
Valid in: Configuration file and command lineMax length: 8192
SEQThis system option specifies the number of digits in the numeric part of the sequence field thatoccasionally features in lines of source code.
SEQ = [ n | MAX | MIN ]
Valid in: OPTIONS statement, configuration file and command lineDefault: 8Min value: 1Max value: 8
Reference for language elementsVersion 3.3
87
SERRORWhen set, this system option instructs WPS to generate a warning when an undefined macro variablereference occurs.
[ SERROR | NOSERROR ]
Valid in: OPTIONS statement, configuration file and command lineDefault: SERROR
SETThis system option allows the values of environment variables to be set using OPTIONS SET= orequivalent syntax.
SET = values
Valid in: OPTIONS statement, configuration file and command lineMax length: 32000
SORTBLKMODEWhen active, this system option informs WPS that the sort program supports a block mode interface.
[ SORTBLKMODE | NOSORTBLKMODE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSORTBLKMODE
SORTDUPThis system option specifies whether the SORT procedure's application of NODUP option is applied tophysical or logical records.
SORTDUP = [ PHYSICAL | LOGICAL ]
Valid in: OPTIONS statement, configuration file and command lineDefault: PHYSICAL
Reference for language elementsVersion 3.3
88
LOGICALRemove duplicates with respect to the variables that remain after any DROP and/or KEEP datasetoptions are processed.
PHYSICALRemove duplicates based on all the variables present.
SORTEQUALSThis system option instructs WPS to maintain the order of observations with the same BY value in PROCSORT.
[ SORTEQUALS | NOSORTEQUALS ]
Valid in: OPTIONS statement, configuration file and command lineDefault: SORTEQUALS
SORTMMAPWhen set, this system option informs WPS that the internal sort program may use memory mappedfiles.
[ SORTMMAP | NOSORTMMAP ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSORTMMAP on z/OS, otherwise SORTMMAP
This option is inactive by default on z/OS and active by defaultotherwise.
SORTPGMThis system option specifies the sort program to be used by PROC SORT.
SORTPGM =[ sort-name |
BEST |HOST |SAS |WPS
]
Reference for language elementsVersion 3.3
89
Valid in: OPTIONS statement, configuration file and command lineDefault: BEST on z/OS, otherwise WPSMax length: 8
SORTSEQThis system option specifies the default collation sequence for PROC SORT, for example: optionssortseq=ASCII;.
SORTSEQ = collation-sequence
Valid in: OPTIONS statement, configuration file and command lineMax length: 32
SORTSIZEThis system option specifies a hint to WPS about the amount of memory to use when performing a sort.
SORTSIZE =[ [ n | nK | nM | nG | nX ] |
MAX |MIN
]
Valid in: OPTIONS statement, configuration file and command lineDefault: MAX
SORTSTATSThis system option instructs WPS to print out statistics from SORT steps.
[ SORTSTATS | NOSORTSTATS ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSORTSTATS
Reference for language elementsVersion 3.3
90
SORTVALIDATEThis system option instructs WPS to validate the sort order on datasets with user-specified sortspecifications.
[ SORTVALIDATE | NOSORTVALIDATE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSORTVALIDATE
SORTWORKThis system option specifies the location(s) to put SORT procedure work files.
SORTWORK = path
Valid in: OPTIONS statement, configuration file and command lineMax length: 1024
SOURCEThis system option instructs WPS to show source statements in the log.
[ SOURCE | NOSOURCE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: SOURCE
SOURCE2This system option instructs WPS to show source statements from included files in the log.
[ SOURCE2 | NOSOURCE2 ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSOURCE2
Reference for language elementsVersion 3.3
91
SQLCONSTDATETIMEThis system option informs PROC SQL whether it can evaluate DATE( ), TIME( ) and DATETIME( )once up front, or each time they are encountered in a query plan. If this option is active (default), thefunctions are evaluated only once in a PROC SQL query.
[ SQLCONSTDATETIME | NOSQLCONSTDATETIME ]
Valid in: OPTIONS statement, configuration file and command lineDefault: SQLCONSTDATETIME
SQLGENERATIONThis system option instructs WPS whether to generate SQL for in-database processing.
SQLGENERATION = [ NONE | DBMS ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NONE
SQLREMERGEThis system option allows PROC SQL to perform remerging of aggregated data with the original dataset.
[ SQLREMERGE | NOSQLREMERGE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: SQLREMERGE
SSH_HOSTVALIDATIONThis system option specifies the SSH host key validation method. On Windows, it can be set to NONEor PUTTY (default), otherwise it can be set to NONE or OPENSSH (default).
SSH_HOSTVALIDATION = NONE
Valid in: OPTIONS statement, configuration file and command lineDefault: PUTTY on Windows, otherwise OPENSSHMax length: 16
Reference for language elementsVersion 3.3
92
SSH_IDENTITYFILEThis system option specifies the location of the SSH identity file for public key authentication. It is blank(empty string) by default.
SSH_IDENTITYFILE = filename
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 32767
STDIOWhen active, this system option instructs WPS to use STDIN for input, STDERR for the log andSTDOUT for output.
When inactive (default) WPS uses SYSIN for the input, LOG for log and PRINT for output.
[ STDIO | NOSTDIO ]
Valid in: Configuration file and command lineDefault: NOSTDIO
STIMEFMTThis system option specifies the format to be used for displaying step timings.
STIMEFMT =[ HOURS |
H |Z |MINUTES |M |SECONDS |S |NORMAL |N
]
Valid in: OPTIONS statement, configuration file and command lineDefault: N
Reference for language elementsVersion 3.3
93
HOURSDisplays step timings as hh:mm:ss.ss.
H is a synonym of HOURS
MINUTESDisplays step timings as mm:ss.ss
M is a synonym of MINUTES
NORMALDisplays step timings as hh:mm:ss.ss unless the time is under one hour, in which case it usesmm:ss.ss, unless the time is under one minute, in which case it uses ss.ss
N is a synonym of NORMAL
SECONDSDisplays step timings as ss.ss
S is a synonym of SECONDS
ZDisplays step timings as hh:mm:ss.ss
STIMERThis system option instructs WPS to record performance statistics after each PROC or DATA step.
[ STIMER | NOSTIMER ]
Valid in: OPTIONS statement, configuration file and command lineDefault: STIMER
SUMBUFNOThis system option specifies the number of buffers to be used for a batch in summary procedures.
SUMBUFNO = number-of-buffers
Valid in: OPTIONS statement, configuration file and command lineDefault: 0Min value: 0Max value: 2,147,483,647
Reference for language elementsVersion 3.3
94
SUMSIZEThis system option specifies the default maximum storage to be used by PROC SUMMARY and PROCMEANS.
SUMSIZE =[ [ n | nK | nM | nG | nX ] |
MAX |MIN
]
Valid in: OPTIONS statement, configuration file and command lineDefault: MAX
SYMBOLGENThis system option instructs WPS to write the results of resolving macro variable references to the log.
[ SYMBOLGEN | NOSYMBOLGEN ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSYMBOLGEN
SYNCIOThis system option instructs WPS to use operation system synchronous/writethrough I/O wherepossible.
[ SYNCIO | NOSYNCIO ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSYNCIO - non-z/OS only
SYSINThis system option specifies the location from which source code will be read.
SYSIN = file
Valid in: Configuration file and command line
Reference for language elementsVersion 3.3
95
Default: SYSIN - z/OSMax length: 1024
SYSPARMThis system option specifies a character string that can be passed to a WPS program for use in a DATAstep or as a macro variable.
SYSPARM = character-value
Valid in: OPTIONS statement, configuration file and command lineMax length: 32767
Note:To access the information in a DATA step, use the SYSPARM function, which returns a characterstring. To access the information as a macro variable, use the automatic macro variable &SYSPARM.
TAPEENGINEThis system option specifies the library engine to use when TAPE is specified.
TAPE is a pseudo engine name - if it is used as a library engine name in a LIBNAME statement, theengine name actually used is taken from the TAPEENGINE system option.
TAPEENGINE = library-engine
Valid in: Configuration file and command lineDefault: WPSTAPEMax length: 8
TBUFSIZEThis system option specifies the buffer size for remote communication.
TBUFSIZE = [ bytes | kilobytes K | megabytes M ]
Valid in: OPTIONS statement, configuration file and command lineDefault: 32768Min value: 0
Reference for language elementsVersion 3.3
96
TCPPORTFIRSTThis system option specifies the lowest TCP/IP port number available for WPS COMMUNICATE use.
TCPPORTFIRST = port-number
Valid in: Configuration file and command lineDefault: 0Min value: 0Max value: 32767
TCPPORTLASTThis system option specifies the highest TCP/IP port number available for WPS COMMUNICATE use.
TCPPORTLAST = port-number
Valid in: Configuration file and command lineDefault: 32767Min value: 0Max value: 32767
TERMSTMTThis systme option specifies final statements to execute after any submitted program.
TERMSTMT = statements
Valid in: OPTIONS statement, configuration file and command lineMax length: 2048
THREADSWhen active, this system option enables multi-threaded processing where possible.
[ THREADS | NOTHREADS ]
Valid in: OPTIONS statement, configuration file and command line
Reference for language elementsVersion 3.3
97
Default: NOTHREADS on z/OS, otherwise THREADS
URLENCODINGThis system option specifies how the strings that are the arguments to the URLENCODE andURLDECODE functions are to be interpreted. The available options are SESSION (the default,compatible with previous releases of WPS) or UTF8.
URLENCODING = encoding
Valid in: OPTIONS statement, configuration file and command lineDefault: SESSION
USERThis system option specifies the default location for all one-level dataset names. If the locationreferenced is a directory, then it must exist (i.e. it is not automatically created on access).
USER = location
Valid in: OPTIONS statement, configuration file and command lineMax length: 1024
VALIDVARNAMEThis system option controls the rules that govern what constitues a valid variable name.
VALIDVARNAME = [ V6 | UPCASE | V7 | ANY ]
Valid in: OPTIONS statement, configuration file and command lineDefault: V7
VARLENCHKThis system option controls the behaviour in the DATA step when variables from different input datasetshave different lengths.
VARLENCHK = [ ERROR | NOWARN | WARN ]
Reference for language elementsVersion 3.3
98
Valid in: OPTIONS statement, configuration file and command lineDefault: NOWARN
VBUFSIZEThis system option specifies the size of the buffer used when executing a view in parallel. If specified,the OBSBUF dataset option will override VBUFSIZE.
VBUFSIZE = view-buffer-size
Valid in: OPTIONS statement, configuration file and command lineDefault: 65536Min value: 0Max value: Maximum integer value supported by the system
VERBOSEThis system option instructs WPS to print the value of configuration options to the log.
[ VERBOSE | NOVERBOSE ]
Valid in: Configuration file and command lineDefault: NOVERBOSE
VNFERRInstructs WPS to generate an error when a missing variable condition is encountered with a _NULL_dataset.
[ VNFERR | NOVNFERR ]
Valid in: OPTIONS statement, configuration file and command lineDefault: VNFERR
Reference for language elementsVersion 3.3
99
WORKThis system option specifies the location of the WORK library. On z/OS it defaults to WORK.
WORK = location
Valid in: Configuration file and command lineDefault: WORK on z/OSMax length: 1024
WORKINITThis system option instructs WPS to erase all files in the WORK directory on WPS initialisation.
[ WORKINIT | NOWORKINIT ]
Valid in: Configuration file and command lineDefault: WORKINIT
WORKPERMSThis system option specifies the permissions to give the WORK library.
WORKPERMS = permissions
Valid in: Configuration file and command lineDefault: 700 - non-WindowsMax length: 3
WORKTERMWhen active, this system option instructs WPS to erase all files in the WORK diectory on WPStermination.
[ WORKTERM | NOWORKTERM ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOWORKTERM - z/OS, otherwise WORKTERM
Reference for language elementsVersion 3.3
100
WPDHUGEWhen active, this system option allows new WPD datasets to have more than 2G records.
[ WPDHUGE | NOWPDHUGE ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOWPDHUGE
WPSCOMPROTOCOLThis system option specifies the protocol used for communicating with a remote connection.
WPSCOMPROTOCOL = protocol
Valid in: OPTIONS statement, configuration file and command lineDefault: WPSMax length: 16
WPSDSCOMPThis system option specifies that DATA steps will be compiled to native machine code.
[ WPSDSCOMP | NOWPSDSCOMP ]
Valid in: OPTIONS statement, configuration file and command lineDefault: WPSDSCOMP
Reference for language elementsVersion 3.3
101
WPSTRACEThis system option specifies the level of trace information. It can be set to ERROR (default), WARNING,INFO or DEBUG.
WPSTRACE =[ ERROR |
WARNING |INFO |DEBUG |" { trace.object.name (
[ ERROR |WARNING |INFO |DEBUG
] ), … } "]
Valid in: OPTIONS statement, configuration file and command lineDefault: ERRORMax length: 1024
WPSWHERECOMPThis system option specifies that WHERE clauses will be compiled to native machine code.
[ WPSWHERECOMP | NOWPSWHERECOMP ]
Valid in: OPTIONS statement, configuration file and command lineDefault: WPSWHERECOMP
XCMDWhen active, this system option specifies that the X command is available for use.
[ XCMD | NOXCMD ]
Valid in: Configuration file and command lineDefault: XCMD
Reference for language elementsVersion 3.3
102
XMINWhen specified, this system option instructs WPS that commands launched via X will be created in thedefault state.
[ XMIN | NOXMIN ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOXMIN - Windows only
XSYNCWhen set, this system option instructs WPS to wait for applications launched through the X statements,SYSTEM function or CALL SYSTEM routine, to exit before continuing program execution.
[ XSYNC | NOXSYNC ]
Valid in: OPTIONS statement, configuration file and command lineDefault: XSYNC - Windows only
XWAITWhen active, this system option specifies that console applications launched through the X statements,SYSTEM function or CALL SYSTEM routine, will wait for the user to issue an exit command.
[ XWAIT | NOXWAIT ]
Valid in: OPTIONS statement, configuration file and command lineDefault: XWAIT - Windows only
YEARCUTOFFThis sytem option specifies the cutoff year used when intepreting or generating two-digit years infuctions and formats. It is set to 1920 by default.
YEARCUTOFF = nnnn
Valid in: OPTIONS statement, configuration file and command lineDefault: 1920
Reference for language elementsVersion 3.3
103
Min value: 1582Max value: 19900
IBM mainframe specific system optionsSystem options specific to IBM mainframe systems.
BLKALLOCInstructs WPS to always specify a BLKSIZE when performing a DISP=NEW dynamic allocation for adata library.
[ BLKALLOC | NOBLKALLOC ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOBLKALLOC
BLKSIZESpecifies the default block size for WPS data libararies.
BLKSIZE = blksize
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 27998Min value: 1024Max value: 32760
BLKSIZE(DISK)Specifies the default block size for WPS data libararies on DISK devices.
BLKSIZE(DISK) = blksize
This is a z/OS-only system option.
Reference for language elementsVersion 3.3
104
Valid in: OPTIONS statement, configuration file and command lineDefault: 0
BLKSIZE(OTHER)Specifies the default block size for WPS data libararies on OTHER devices.
BLKSIZE(OTHER) = blksize
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 6144
BLKSIZE(3375)Specifies the default block size for WPS data libararies on 3375 devices.
BLKSIZE(3375) = blksize
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 8192
BLKSIZE(3380)Specifies the default block size for WPS data libararies on 3380 devices – the default is 23476 is themost space-efficient block size for this device type.
BLKSIZE(3380) = blksize
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 23476
Reference for language elementsVersion 3.3
105
BLKSIZE(3390)Specifies the default block size for WPS data libararies on 3390 devices – the default is 27998 is themost space-efficient block size for this device type.
BLKSIZE(3390) = blksize
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 27998
BLKSIZE(9345)Specifies the default block size for WPS data libararies on 9345 devices – the default is 6144 which isthe most space-efficient block size for this device type.
BLKSIZE(9345) = blksize
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 6144
DB2INSpecifies the default DB2 tablespace in which to create tables.
DB2IN = db2in
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineMax length: 1024
DB2READBUFFSpecifies the number of rows to read from DB2 at a time.
DB2READBUFF = db2readbuff
This is a z/OS-only system option.
Reference for language elementsVersion 3.3
106
Valid in: OPTIONS statement, configuration file and command lineDefault: 1Min value: 1Max value: 32767
DB2SSIDSpecifies the default DB2 subsystem ID.
DB2SSID = db2ssid
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineMax length: 1024
DLDSNTYPESpecifies the default value to use for the DSNTYPE=option on a LIBNAME.
DLDSNTYPE = [ BASIC | LARGE | NONE ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NONE
DLEXCPCOUNTInstructs WPS to report EXCP counts for WPS data libraries.
[ DLEXCPCOUNT | NODLEXCPCOUNT ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: DLEXCPCOUNT
Reference for language elementsVersion 3.3
107
DYNALLOCInforms WPS that a host utility is assumed to support the dynamic allocation of work files.
[ DYNALLOC | NODYNALLOC ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: DYNALLOC
FILEBLKSIZE(DISK)Specifies the default block size for external files on DISK devices.
FILEBLKSIZE(DISK) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineMax length: 8
FILEBLKSIZE(OTHER)Specifies the default block size for external files on OTHER devices.
FILEBLKSIZE(OTHER) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 6400Min value: 5Max value: 6400
FILEBLKSIZE(SYSOUT)Specifies the default block size for external files on SYSOUT devices.
FILEBLKSIZE(SYSOUT) = value
Reference for language elementsVersion 3.3
108
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 264Min value: 5Max value: 264
FILEBLKSIZE(TAPE)Specifies the default block size for external files on TAPE devices
FILEBLKSIZE(TAPE) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineMax length: 8
FILEBLKSIZE(TERM)Specifies the default block size for external files on TERM devices.
FILEBLKSIZE(TERM) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 264Min value: 5Max value: 264
FILEBLKSIZE(3375)Specifies the default block size for external files on 3375 devices.
FILEBLKSIZE(3375) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command line
Reference for language elementsVersion 3.3
109
Default: 17600Min value: 5Max value: 32760
FILEBLKSIZE(3380)Specifies the default block size for external files on 3380 devices.
FILEBLKSIZE(3380) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 23476Min value: 5Max value: 32760
FILEBLKSIZE(3390)Specifies the default block size for external files on 3390 devices.
FILEBLKSIZE(3390) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 27998Min value: 5Max value: 32760
FILEBLKSIZE(3400)Specifies the default block size for external files on 3400 devices.
FILEBLKSIZE(3400) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 32760
Reference for language elementsVersion 3.3
110
Min value: 5Max value: 32760
FILEBLKSIZE(3480)Specifies the default block size for external files on 3480 devices.
FILEBLKSIZE(3480) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 32760Min value: 5Max value: 65535
FILEBLKSIZE(3490E)Specifies the default block size for external files on 3490E devices.
FILEBLKSIZE(3490E) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 32760Min value: 5Max value: 65535
FILEBLKSIZE(3590)Specifies the default block size for external files on 3590 devices.
FILEBLKSIZE(3590) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 32760Min value: 5
Reference for language elementsVersion 3.3
111
Max value: 262144
FILEBLKSIZE(9345)Specifies the default block size for external files on 9345 devices.
FILEBLKSIZE(9345) = value
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 22928Min value: 5Max value: 32760
FILECCInstructs WPS to inspect external datasets for the PRINT attribute.
[ FILECC | NOFILECC ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOFILECC
FILEDEVSpecifies the default device name for new physical files.
FILECC = device-name
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: SYSDAMax length: 8
Reference for language elementsVersion 3.3
112
FILEMSGSInstructs WPS to display messages resulting from dynamic DDNAME allocations in the log .
[ FILEMSGS | NOFILEMSGS ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: FILEMSGS
FILESPPRISpecifies the default primary space allocation for new physical files.
FILESPRI = space
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 1Min value: 1Max value: 32760
FILESPSECSpecifies the default secondary space allocation for new physical files.
FILESPSEC = space
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 1Min value: 0Max value: 32760
Reference for language elementsVersion 3.3
113
FILESTATInstructs WPS to maintain ISPF member statistics in partitioned datasets.
[ FILESTAT | NOFILESTAT ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOFILESTAT
FILESYSOUTSpecifies the default SYSOUT class for a printer file.
FILESYSOUT = output-class
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault:Max length: 1
FILESYSTEMSpecifies the default filesystem to be used when a filename is ambiguous. It can be set to either MVS orHFS.
FILESYSTEM = [ MVS | HFS ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: MVS
Reference for language elementsVersion 3.3
114
FILEUNITSpecifies the default unit of allocation for new physical files.
FILEUNIT =[ [ BLK | BLKS ] |
[ CYL | CYLS ] |[ TRK | TRKS ] |block-size
]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: CYLMax length: 8
FILSZinstructs WPS to use FILSZ in the host sort control string.
[ FILSZ | NOFILSZ ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: FILSZ
FULLSTATSInstructs WPS to write expanded step statistics to the log.
[ FULLSTATS | NOFULLSTATS ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: FULLSTATS
Reference for language elementsVersion 3.3
115
IMSDLDBRControls whether IMS should set the DBRC parameter when it invokes an IMS DLI region.
IMSDLDBR = [ Y | N | * ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: Y
Available choices are:
Y – for yesN – for no* – for subsystem default
ISPCAPSInstructs WPS to convert printable characters to upper case in parameters to ISPLINK and ISPEXEC.
[ ISPCAPS | NOISPCAPS ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPCAPS
ISPCHARFInstructs WPS to convert character variables using their associated formats and informats when theyare used as ISPF variables.
[ ISPCHARF | NOISPCHARF ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPCHARF
Reference for language elementsVersion 3.3
116
ISPCSRSpecifies a variable that will be set by the ISPF interface to the name of a variable whose value isfound to be invalid.
ISPCSR = ispf-varname
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault:Max length: 8
ISPEXECVSpecifies an ISPF variable that when accessed, invokes an ISPF service.
ISPEXECV = ispf-varname
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault:Max length: 8
ISPMISSSpecifies the value to be assigned to WPS character variables defined to ISPF when the associatedISPF variable has length zero.
ISPMISS = "char"
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault:Max length: 1
Reference for language elementsVersion 3.3
117
ISPMSGSpecifies the name of an ISPF variable that will be set to a message ID when a variable is found to beinvalid.
ISPMSG = ispf-varname
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault:Max length: 8
ISPNOTESInstructs WPS to write ISPF error messages to the WPS log.
[ ISPNOTES | NOISPNOTES ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPNOTES
ISPNUMFInstructs WPS to convert numeric variables using their associated formats and informats when they areused as ISPF variables.
[ ISPNUMF | NOISPNUMF ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: ISPNUMF
ISPNZTRCInstructs WPS to write non-zero ISPF service return codes to the WPS log.
[ ISPNZTRC | NOISPNZTRC ]
Reference for language elementsVersion 3.3
118
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPNZTRC
ISPPTInstructs WPS to write ISPF parameter pointers and lengths to the WPS log.
[ ISPPT | NOISPPT ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPPT
ISPTRACEInstructs WPS to write ISPF parameter lists and service return codes to the WPS log.
[ ISPTRACE | NOISPTRACE ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPTRACE
ISPVDEFASpecifies that all current WPS variables will be identified to ISPF via the VDEFINE user exit.
[ ISPVDEFA | NOISPVDEFA ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPVDEFA
Reference for language elementsVersion 3.3
119
ISPVDLTSpecifies that VDELETE is issued automatically to delete a variable from ISPF before it is defined withthe VDEFINE service.
[ ISPVDLT | NOISPVDLT ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPVDLT
ISPVDTRCSpecifies that all calls to VDEFINE are traced to the WPS log.
[ ISPVDTRC | NOISPVDTRC ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPVDTRC
ISPVIMSGSpecifies the ISPF message ID to be set by the VDEFINE user exit when an informat for a variablereturns an error return code.
ISPVIMSG = message-id
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault:Max length: 8
ISPVRMSGSpecifies the ISPF message ID to be set by the VDEFINE user exit when a variable has a null value.
ISPVRMSG = message-id
Reference for language elementsVersion 3.3
120
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 8
ISPVTMSGSpecifies the ISPF message ID to be set by the VDEFINE user exit when the ISPVTRAP option is ineffect.
ISPVTMSG = message-id
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 8
ISPVTNAMRestricts the information displayed by the ISPVTRAP option to a specified variable only.
ISPVTNAM = variable
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 8
ISPVTPNLSpecifies the ISPF panel that is to be displayed by the VDEFINE user exit when the ISPVTRAP optionis in effect.
ISPVTPNL = panel-id
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command line
Reference for language elementsVersion 3.3
121
Default: ""Max length: 8
ISPVTRAPSpecifies that the VDEFINE user exit will write information to the WPS log for debugging purposes eachtime it is entered.
[ ISPVTRAP | NOISPVTRAP ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOISPVTRAP
ISPVTVARSSpecifies the prefix for the ISPF variables to be set by the VDEFINE user exit when the ISPVTRAPoption is in effect.
ISPVTVARS = prefix
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 7
LISTINGFILERECFMSpecifies the default RECFM for listing files.
LISTINGFILERECFM = recfm
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: VBAMax length: 8
Reference for language elementsVersion 3.3
122
MEMRPTInstructs WPS to write memory statistics to the log for each step.
[ MEMRPT | NOMEMRPT ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOMEMRPT
REPORTSTEPMEMORYUSAGEInstructs WPS to report memory usage for the preceding data step or procedure step when the timeusage is being reported.
[ REPORTSTEPMEMORYUSAGE | NOREPORTSTEPMEMORYUSAGE ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOREPORTSTEPMEMORYUSAGE
S99NOMIGInstructs WPS to restore migrated datasets.
[ S99NOMIG | NOS99NOMIG ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOS99NOMIG
SEQENGINESpecifies the default library engine for sequential dataset files.
SEQENGINE = engine
This is a z/OS-only system option.
Reference for language elementsVersion 3.3
123
Valid in: OPTIONS statement, configuration file and command lineDefault: WPDSEQMax length: 8
SORTCUTPSpecifies the amount of storage above which the host sort utility is appropriate.
SORTCUTP =[ [ n | nK | nM | nG | nX ] |
MAX
]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 4194304Min value: 0Max value: 2147483647
SORTDEVpecifies the device that WPS should allocate SORT work files in when calling HOST sort.
SORTDEV = string
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 8
SORTDEVWARNInstructs WPS to warn if the SORTDEV option contains the name of a device group rather than a specificdevice such as 3390.
[ SORTDEVWARN | NOSORTDEVWARN ]
This is a z/OS-only system option.
Reference for language elementsVersion 3.3
124
Valid in: OPTIONS statement, configuration file and command lineDefault: true
SORTEQOPSpecifies that the host sort routine implements the EQUAL option.
[ SORTEQOP | NOSORTEQOP ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: SORTEQOP
SORTLISTSpecifies that the LIST option is to be sent to the host sort utility.
[ SORTLIST | NOSORTLIST ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSORTLIST
SORTLOCALESpecifies that the host sort routine implements the LOCALE option.
[ SORTLOCALE | NOSORTLOCALE ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: SORTLOCALE
Reference for language elementsVersion 3.3
125
SORTMAXKEYSpecifies the maximum key length for the host sort routine.
SORTMAXKEY = maximum-key-length
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 4084Min value: 1Max value: 32767
SORTMAXOFFSpecifies the maximum key offset permitted for the host sort routine.
SORTMAXOFF = maximum-key-offset
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 4092Min value: 1Max value: 32767
SORTMSGSpecifies that the option MSG=AP is to be passed to the host sort utility.
[ SORTMSG | NOSORTMSG ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOSORTMSG
Reference for language elementsVersion 3.3
126
SORTNAMESpecifies the name of the host sort utility.
SORTNAME = host-sort-name
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: SORTMax length: 8
SORTOPTSSpecifies that an OPTIONS statement should be generated for the host sort utility.
[ SORTOPTS | NOSORTOPTS ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: SORTOPTS
SORTPARMSpecifies additional options to be passed to the host sort utility.
SORTPARM = string
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineMax length: 1024
SORTSUMFSpecifies that the host sort utility supports SUM FIELDS=NONE.
[ SORTSUMF | NOSORTSUMF ]
This is a z/OS-only system option.
Reference for language elementsVersion 3.3
127
Valid in: OPTIONS statement, configuration file and command lineDefault: SORTSUMF
SORTWKNOSpecifies how many work files are to be allocated for sort.
SORTWKNO = n
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 3Min value: 0Max value: 99
SYSPREFSpecifies a prefix for partially-qualified physical file names. If possible, it defaults to the host system'sdefault high level qualifier
SYSPREF = prefix
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 42
Reference for language elementsVersion 3.3
128
TAPECLOSESpecifies the default behaviour for sequential access boundaries for tape libraries when a librarydataset is closed.
TAPECLOSE =[ DISP |
FREE |LEAVE |REREAD |REWIND
]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: REREAD
VSAMLEENGINESpecifies whether to use the old or new VSAM engines in WPS.
[ VSAMLEENGINE | NOVSAMLEENGINE ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOVSAMLEENGINE
OPTIONS VSAMLEENGINE refers to the old engine that used the IBM LE (Language Environment) forVSAM access.
OPTIONS NOVSAMLEENGINE uses the new engine which is based on z/OS VSAM assembler macrosinstead.
VSAMLOADSpecifies that empty VSAM data sets can be loaded.
[ VSAMLOAD | NOVSAMLOAD ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command line
Reference for language elementsVersion 3.3
129
Default: NOVSAMLOAD
VSAMREADSpecifies that VSAM datasets can read using INFILE statements.
[ VSAMREAD | NOVSAMREAD ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: VSAMREAD
VSAMRLSSpecifies that record-level sharing for VSAM datasets is enabled.
[ VSAMRLS | NOVSAMRLS ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOVSAMRLS
VSAMRLSREADSpecifies that the level of integrity for VSAM read operations can be set.
[ VSAMRLSREAD | NOVSAMRLSREAD ]
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOVSAMRLSREAD
VSAMUPDATESpecifies that VSAM datasets opened using INFILE statements can be updated.
[ VSAMUPDATE | NOVSAMUPDATE ]
Reference for language elementsVersion 3.3
130
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOVSAMUPDATE
WPSDSCOMPARCHSpecifies the maximum architecture level for which to generate code when compiling a DATA step.
WPSDSCOMPARCH = architecture-level
This is a z/OS-only system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: 0Min value: 0Max value: 7
WPSDSCOMPDEBUGInstructs WPS to generate debug information about a compiled DATA step.
[ WPSDSCOMPDEBUG | NOWPSDSCOMPDEBUG ]
This is a z/OS or Linux for System Z. system option.
Valid in: OPTIONS statement, configuration file and command lineDefault: NOWPSCOMPDEBUG
FormatsFormats define how output from a SAS language program is displayed.
Formats help WPS understand how to write data values for display. For example, the SAS languagerepresents dates internally as the number of days since 01-January-1960. To display a date as "17-Aug-2015" (or a variation thereof) is much more helpful to a user than to present it as "20317". Formatshandle this conversion, and many other kinds of conversion as well.
There are two types of format
Reference for language elementsVersion 3.3
131
Character formats
Transform standard character data into an alternative character form for display or output.
Character formats have the pattern: $<format-name>w. w is the total width of the output fieldand the terminating period is mandatory. The w is optional and if omitted, a default value will beused.
Numeric formats
Transforms standard numeric data into an alternative numeric form for display or output.
Numeric formats have the pattern: <format-name>w.d. w is the total width of the output fieldand d is usually the number of decimal places required within the total width of the field.
Note:The period following the output name is mandatory.
The default numeric format – w.d – does not have a rendered name. Both w and d are optional, ifomitted, default values are used.
With all formats, specifying w guarantees that w characters are always produced – output will betruncated or padded as necessary. As well as giving you access to hundreds of built-in formats, WPSallows you to create your own custom formats with PROC FORMAT.
Example format use casesThe following example uses the $w. character format to process a string:
data _null_; d="World Programming"; put d $5. ;run;
Producing the following output:
World
In this example, the w.d numeric format is used to format a decimal:
data _null_; d=12345.678; put d 8.2;run;
Which produces the following output:
12345.68
Core formatsDetails some of the most widely-used formats, all of which are fundamental to the SAS language.
Reference for language elementsVersion 3.3
132
w.dReads in numeric data of length w with d decimal places.
The format restricts the number of decimal places to be smaller than the format width. If the number istoo big to fit in the available space, an attempt is made to express it in scientific notation.
min max defaultVariable width 1 32767 1Decimal digits 0 31 0
ExampleDATA _null_; n = 13.45; PUT n = 4.1; r = 123456; PUT r = 4.1;RUN;
Which produces the following output in the log:
n=13.5r=12E4
$w.Passes its input string through untransformed, retaining trailing blanks.
Truncation occurs if the available output space is too small. It is exactly the same as the $CHARw. and$Fw. formats.
min max defaultVariable width 1 32767 *1
ExampleThis example reads a string and truncates to the first character; truncates the string to the first sixcharacters; finally, as the string is 20 characters long, pads the string to the required 32 characters .
DATA _null_; s = "World Programming #"; PUT s $1.; PUT s $6. "*"; PUT s $32. "*";RUN;
Reference for language elementsVersion 3.3
133
Which produces the following output in the log:
WWorld *World Programming # *
$CHARw.Writes its input string, padding to the specified width if its input string is shorter.
The format truncates the output when the number of spaces specified is insufficient to contain the fullinput string. This format is the same as the $w. and $Fw. formats.
minimum maximum defaultVariable width 1 32767 8
ExampleThis example reads a string and truncates to the first character; truncates the string to the first sixcharacters; finally, as the string is 20 characters long, pads the string to the required 32 characters .
DATA _null_; s = "World Programming #"; PUT s $CHAR1.; PUT s $CHAR6. "*"; PUT s $CHAR32. "*";RUN;
Which produces the following output in the log:
WWorld *World Programming # *
$Fw.Passes its input string through untransformed, padding as required to match any specified width.
Truncation occurs if the defined output width is too small. This format is identical to the $w. and$CHARw. formats.
min max defaultVariable width 1 32767 *1
Reference for language elementsVersion 3.3
134
ExampleThis example reads a string and truncates to the first character; truncates the string to the first sixcharacters; finally, as the string is 20 characters long, pads the string to the required 32 characters .
DATA _null_; s = "World Programming #"; PUT s $F1.; PUT s $F6. "*"; PUT s $F32. "*";RUN;
Which produces the following output in the log:
WWorld *World Programming # *
$VARYINGw.This format can contain a varying number of characters up to the maximim width specified in the formatdefinition.
This character format can be used in procedures where it behaves exactly like $CHARw. and $Fw.Within DATA steps, the $VARYINGw. format can be followed with the name of a variable that containsthe actual, runtime-determined width to use. It is limited in length to the format-specified width.
min max defaultVariable width 1 32767 *1
ExampleDATA _null_; name="World Programming"; DO n = 1,2,30,100; PUT name $VARYING50. n "*"; END;RUN;
Which produces the following output in the log:
W*Wo*World Programming *World Programming *
Reference for language elementsVersion 3.3
135
BESTw.The default numeric format, this attempts to create the optimal numeric representation of its input.
Although a numeric format, it does not require a d modifier, because determining the number ofdecimal places is part of the work it undertakes itself. This format restricts the requested number ofdecimal places to be smaller than the format width. If the space available is insufficient to represent thenumber, an attempt is made to use scientific notation. If the number simply cannot be represented inthe available space, asterisks are returned.
min max defaultVariable width 1 32767 12Decimal digits 0 31 0
ExampleDATA _null_; n=1234.5678; PUT n= BEST1.; PUT n= BEST2.; PUT n= BEST3.; PUT n= BEST4.; PUT n= BEST6.; PUT n= BEST10.;run;
Which produces the following output in the log:
n=*n=**n=1E3n=1235n=1234.6n=1234.5678
Basic character formatsFundamental character formats for different platforms.
Reference for language elementsVersion 3.3
136
$ASCIIw.On an ASCII platform, this format behaves like the $CHARw. format. On EBCDIC platforms, it convertsEBCDIC data to ASCII first.
min max defaultVariable width 1 32767 *1
$BASE64Xw.This character format converts character data to a base64 encoded form – it may be padded withblanks to the specified number of characters.
This encoding scheme is commonly used when there is a need to encode data in a way that can betransferred over media designed to deal with textual data rather than binary data.
min max defaultVariable width 1 32767 *4/3
ExampleDATA _null_; s="a"; PUT s $base64x. "*"; PUT s $base64x50. "*";RUN;
Which produces the following output in the log:
YQ==*YQ== *
$BINARYw.This format converts input character data to a textual representation of its binary value – a string of 1sand 0s.
min max defaultVariable width 1 32767 *8
Reference for language elementsVersion 3.3
137
ExampleDATA _null_; s="a"; t="World Programming"; PUT s $binary. "*"; PUT t $binary. "*";RUN;
Which produces the following output in the log:
01100001*0101011101101111011100100110110001100100001000000101000001110010011011110110011101110010011000010110110101101101011010010110111001100111*
$BYVALw.This format is for use by CALL MODULE. It is a character format that allows you to pass a singlecharacter to a module as an integer.
min max defaultVariable width 1 32767 2
$CSTRw.This format strips trailing blanks then null-terminates its input character data, and is useful wheninterfacing with the C-family of programming languages.
If the specified length of the output is less than the length of the input data, truncation occurs,giving precedence to the terminating null. A terminating null is always generated, even if this meansoverwriting part of the input. If the specified length of the output is longer than the length of the inputdata plus null, the remaining spaces are undefined.
min max defaultVariable width 1 32767 1
ExampleDATA _null_; s="World Programming"; r=put(s, $cstr.); PUT r $hex36. ;RUN;
Which produces the following output in the log:
576F726C642050726F6772616D6D696E00
Reference for language elementsVersion 3.3
138
$EBCDICw.On an EBCDIC platform, this behaves like the $CHARw. format. On an ASCII platform, input data isconverted to EBCDIC first.
min max defaultVariable width 1 32767 *1
$HEXw.Converts character data into a hexadecimal form, padding with blanks where relevant.
The output is textual, and it prints the hexadecimal representation of each input character using thecharacters 0–9A–F, generating two output characters for each input character.
min max defaultVariable width 1 32767 *2
ExampleDATA _null_;s="World Programming";PUT s $HEX.;RUN;
Which produces the following output in the log:
576F726C642050726F6772616D6D696E67
$MSGCASEw.Converts character data to the same case as is determined by the MSGCASE system option.
min max defaultVariable width 1 32767 1
Reference for language elementsVersion 3.3
139
ExampleOPTION MSGCASE;DATA _null_; s="World Programming"; PUT s $MSGCASE17.;RUN;
OPTION NOMSGCASE;DATA _null_; s="World Programming"; PUT s $MSGCASE17.;RUN;
Which produces the following output in the log:
WORLD PROGRAMMING...World Programming
$OCTALw.Converts character data into an octal form, padding with blanks where relevant.
The output is textual, and it prints the octal representation of each input character using the characters0–7, generating three output characters for each input character.
min max defaultVariable width 1 32767 *3
ExampleDATA _null_;s="World Programming";PUT s $OCTAL.;RUN;
Which produces the following output in the log:
127157162154144040120162157147162141155155151156147
Reference for language elementsVersion 3.3
140
$QUOTEw.Surrounds character data with double quotation marks, padding with blanks after the final output quotewhere required.
Output is ony generated if there is sufficient space – that is, either both sets of quotation marks areadded, or the output will consist of all blanks. Embedded quotes are not doubled up, which means thatthis format cannot be used to reliably create string literals for the SAS language.
min max defaultVariable width 2 32767 +2
ExampleDATA _null_; s="World Programming"; PUT s $QUOTE40. "*";RUN;
Which produces the following output in the log:
"World Programming" *
$REVERJw.Converts character data into a visually reversed form without trimming blanks.
min max defaultVariable width 1 32767 *1
ExampleDATA _null_; s = "World Programming "; PUT s $REVERJ20. "*";RUN;
Which produces the following output in the log:
gnimmargorP dlroW*
Reference for language elementsVersion 3.3
141
$REVERSw.Converts character data into a visually reversed form, stripping trailing blanks first.
min max defaultVariable width 1 32767 *1
ExampleDATA _null_; s = "World Programming "; PUT s $REVERS17.;RUN;
Which produces the following output in the log:
gnimmargorP dlroW
$UPCASEw.Converts lowercase character data into their uppercase equivalent.
min max defaultVariable width 1 32767 *1
ExampleDATA _null_; s = "World Programming"; PUT s $UPCASE.;RUN;
Which produces the following output in the log:
WORLD PROGRAMMING
Bidirectional formatsCharacter formats that deal with data written from left to right and from right to left.
Reference for language elementsVersion 3.3
142
$BIDIw.Takes a string in logical order and applies the Unicode bidi algorithm described in http://www.unicode.org/reports/tr9/.
min max defaultVariable width 1 32767 200
ExampleDATA _null_; LENGTH str $ 16; LENGTH logical $ 16; logical=UNICODE( '\u0063\u0061\u0072\u0020\u006d\u0061\u0065\u006e\u0073\u0020\u05db\u05d0\u05e8', 'esc'); PUT "Logical unicode utf8"; PUT logical $HEX32.; str=PUT(logical, $BIDI16.); PUT "bidi"; PUT str $HEX32.;run;
Which produces the following output in the log:
Logical unicode utf8636172206D61656E73201A1A1A202020bidi2020201A1A1A206D61656E7320636172
$LOGVSw.Takes a string in logical order and returns a string in visual order.
min max defaultVariable width 1 32767 200
Reference for language elementsVersion 3.3
143
ExampleDATA logvs; LENGTH str $ 16; LENGTH logical $ 16; logical=UNICODE( '\u0063\u0061\u0072\u0020\u006d\u0061\u0065\u006e\u0073\u0020\u05db\u05d0\u05e8', 'esc'); PUT "Logical unicode utf8"; PUT logical $HEX32.; str=PUT(logical, $LOGVS16.); PUT "logvs"; PUT str $HEX32.;RUN;
The logvs dataset contains the encoded output, and the following is output in the log.
Logical unicode utf8 636172206D61656E7320D79BD790D7A8 logvs 636172206D61656E7320D7A8D790D79B
$LOGVSRw.Reads a string in a right-to-left logical order and returns it in a visual order.
min max defaultVariable width 1 32767 200
ExampleDATA logvsr; LENGTH str $ 16; LENGTH logicalr $ 16; logicalr=UNICODE( '\u05db\u05d0\u05e8\u0020\u0063\u0061\u0072\u0020\u006d\u0065\u0061\u006e\u0073', 'esc'); PUT "Logical RTL unicode utf8"; PUT logicalr $HEX32.; str=PUT(logicalr, $LOGVSR16.); PUT "logvsr"; PUT str $HEX32.;RUN;
The logvsr dataset contains the encoded output, and the following is output in the log.
Logical RTL unicode utf8D79BD790D7A820636172206D61656E73logvsr636172206D61656E7320D7A8D790D79B
Reference for language elementsVersion 3.3
144
$VSLOGw.Takes a string in visual order and returns it in logical order.
min max defaultVariable width 1 32767 200
ExampleDATA _null_; LENGTH str $ 16; LENGTH visual $ 16; visual=UNICODE( '\u0063\u0061\u0072\u0020\u006d\u0061\u0065\u006e\u0073\u0020\u05e8\u05d0\u05db', 'esc'); PUT "Visual unicode utf8"; PUT visual $HEX32.; str=put(visual, $VSLOGR16.); PUT "vslogr"; PUT str $HEX32.;RUN;
Which produces the following output in the log:
Visual unicode utf8636172206D61656E7320D7A8D790D79Bvslog636172206D61656E7320D79BD790D7A8
$VSLOGRw.Takes a string in visual order and returns it in logical right-to-left order.
min max defaultVariable width 1 32767 200
Reference for language elementsVersion 3.3
145
Exampledata _null_; length str $ 16; length visual $ 16; visual=unicode( /* car means RAC */ /* car means resh alef kaf */ '\u0063\u0061\u0072\u0020\u006d\u0061\u0065\u006e\u0073\u0020\u05e8\u05d0\u05db', 'esc'); put "Visual unicode utf8"; put visual $hex32.; str=put( visual, $vslogr16. ); put "vslogr"; put str $hex32.;run;
Which produces the following output in the log:
Visual unicode utf8636172206D61656E7320D7A8D790D79BvslogrD79BD790D7A820636172206D61656E73
Unicode formatsCharacter formats for different variants of the Unicode encoding.
$UCS2Bw.Converts character data to big-endian, 16-bit UCS2 Unicode encoding.
The input string is converted from session encoding into Unicode, then for each Unicode character,two bytes are written out in big-endian order, yielding the big-endian UCS2 encoding of that character.UCS2 always produces two bytes of output for each character.
min max defaultVariable width 2 32767 8
ExampleDATA _null_; s="World Programming"; r=PUT(s, $UCS2B34.); PUT r $HEX.;RUN;
Reference for language elementsVersion 3.3
146
Which produces the following output in the log:
0057006F0072006C0064002000500072006F006700720061006D006D0069006E0067
$UCS2BEw.Converts character strings in big-endian, 16-bit UCS2 Unicode encoding to the same strings in thesession encoding. It performs the reverse of $UCS2B.
min max defaultVariable width 2 32767 8
ExampleDATA _null_; s="World Programming"; t=put(s, $UCS2B34.); PUT t; u=PUT(t, $UCS2BE17.); PUT u;RUN;
Which produces the following output in the log:
W o r l d P r o g r a m m i n gWorld Programming
$UCS2Lw.Converts character data to little-endian, 16-bit UCS2 Unicode encoding.
The input string is converted from session encoding into Unicode, then for each Unicode character, twobytes are written out in little-endian order, yielding the little-endian UCS2 encoding of that character.UCS2 always produces two bytes of output for each character.
min max defaultVariable width 2 32767 8
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UCS2l34.); PUT t $HEX.;RUN;
Reference for language elementsVersion 3.3
147
Which produces the following output in the log:
57006F0072006C0064002000500072006F006700720061006D006D0069006E006700
$UCS2LEw.This format converts character strings in little-endian, 16-bit UCS2 Unicode encoding to the samestrings in the session encoding. It performs the reverse of $UCS2L.
min max defaultVariable width 2 32767 8
ExampleDATA _null_; a = "World Programming"; b = PUT(a, $UCS2l34.); PUT b; t = PUT(b, $UCS2lE17.); PUT t;RUN;
Which produces the following output in the log:
W o r l d P r o g r a m m i n gWorld Programming
$UCS2Xw.This format converts character data to a 16-bit UCS2 Unicode machine-endian encoding.
This format operates exactly the same as $UCS2B or $UCS2L, as appropriate to the endianness of theexecuting machine.
min max defaultVariable width 2 32767 8
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UCX2X34.); PUT t $hex.;RUN;
Reference for language elementsVersion 3.3
148
Which produces the following output in the log (if executed on an x86 machine):
57006F0072006C0064002000500072006F006700720061006D006D0069006E006700
$UCS2XEw.This format converts character data from a 16-bit UCS2 Unicode machine-endian encoding to asession-encoded form.
It operates exactly the same as $UCS2BE or $UCS2LE as is appropriate to the endianness of theexecuting machine.
min max defaultVariable width 2 32767 8
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UCS2X34.); PUT t; u = PUT(t, $UCS2XE17.); PUT u;RUN;
Which produces the following output in the log (if executed on an x86 machine):
W o r l d P r o g r a m m i n gWorld Programming
$UCS4Bw.This format converts character data to big-endian, 32-bit UCS4 Unicode encoding.
The input string is converted from session encoding into Unicode, then for each Unicode character,four bytes are written out in big-endian order, yielding the big-endian UCS4 encoding of that character.UCS4 always produces four bytes of output for each character.
min max defaultVariable width 4 32767 8
Reference for language elementsVersion 3.3
149
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UCS4B68.); PUT t $HEX.;RUN;
Which produces the following output in the log:
000000570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067
$UCS4BEw.This format converts character strings in big-endian, 32-bit UCS4 Unicode encoding to the same stringsin the session encoding. It performs the reverse of $UCS4B.
min max defaultVariable width 4 32767 8
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UCS4B68.); PUT t $HEX.; u = PUT(t, $UCS4BE34.); PUT u;RUN;
Which produces the following output in the log:
000000570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067 W o r l d P r o g r a m m i n g
$UCS4Lw.This format converts character data to little-endian, 32-bit UCS4 Unicode encoding.
The input string is converted from session encoding into Unicode, then for each Unicode character, fourbytes are written out in little-endian order, yielding the little-endian UCS4 encoding of that character.UCS4 always produces four bytes of output for each character.
min max defaultVariable width 4 32767 8
Reference for language elementsVersion 3.3
150
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UCS4l68.); PUT t $HEX.;RUN;
Which produces the following output in the log:
570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067000000
$UCS4LEw.This format converts character strings in big-endian, 32-bit UCS4 Unicode encoding to the same stringsin the session encoding. It performs the reverse of $UCS4L.
min max defaultVariable width 4 32767 8
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UCS4l68.); PUT t $HEX.; u = PUT(t, $UCS4LE34.); PUT u;RUN;
Which produces the following output in the log:
570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067000000W o r l d P r o g r a m m i n g
$UCS4Xw.This format converts character data to a 32-bit UCS4 Unicode machine-endian encoding. It operatesexactly the same as $UCS4B or $UCS4L, as appropriate to the endianness of the executing machine.
min max defaultVariable width 4 32767 8
Reference for language elementsVersion 3.3
151
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UCS4X68.); PUT t $HEX.;RUN;
Which produces the following output in the log (if executed on an x86 machine):
570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067000000
$UCS4XEw.This format converts character data from a a 32-bit UCS4 Unicode machine-endian encoding to asession-encoded form. It operates exactly the same as $UCS4BE or $UCS4LE as is appropriate to theendianness of the executing machine.
ExampleOPTIONS ENCODING='UTF-8';DATA _null_; s = "World Programming"; t = PUT(s, $UCS4X68.); PUT t $HEX.; u = PUT(t, $UCS4XE34.); PUT u;RUN;
Which produces the following output in the log (if executed on an x86 machine):
570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067000000W o r l d P r o g r a m m i n g
$UESCw.This format converts all but the 0–9, A–Z, a–z and space characters (in session encoding) to Unicodeuniversal character names in the \uXXXX notation.
min max defaultVariable width 1 32767 8
Reference for language elementsVersion 3.3
152
ExampleDATA _null_; s = "#World Programming&"; t = PUT(s, $UESC30.); PUT t ;RUN;
Which produces the following output in the log:
\u0023World Programming\u0026
$UESCEw.This format decodes universal character names in the \uXXXX format, leaving other characters alone.
min max defaultVariable width 1 32767 8
ExampleDATA _null_; s = "\u0023World Programming\u0026"; t = PUT(s, $UESCE30.); PUT t ;RUN;
Which produces the following output in the log:
#World Programming&
$UNCRw.This format converts all but 0–9, A–Z, a–z and space to the Unicode numeric character referenceformat (the &#ddddd notation). This notation is described in http://www.w3.org/TR/html4/charset.html#h-5.3.1.
min max defaultVariable width 1 32767 8
ExampleDATA _null_; s = "#World Programming&"; t = PUT(s, $UNCR40.); PUT t ;RUN;
Reference for language elementsVersion 3.3
153
Which produces the following output in the log:
#World Programming&
$UNCREw.This format decodes numeric character references in the &#ddddd; notation, leaving other charactersalone.
min max defaultVariable width 1 32767 8
ExampleDATA _null_; s = "#World Programming&"; t = PUT(s, $UNCRE40.); PUT t ;RUN;
Which produces the following output in the log:
#World Programming&
$UPARENw.This format converts each character in a string to the format <uXXXX> where XXXX is the Unicodecode point for the character in hexadecimal.
min max defaultVariable width 1 32767 8
ExampleDATA _null_; s = "World Programming"; t = PUT(s, $UPAREN200.); PUT t ;RUN;
Which produces the following output in the log:
<u0057><u006F><u0072><u006C><u0064><u0020><u0050><u0072><u006F><u0067><u0072><u0061><u006D><u006D><u0069><u006E><u0067>
Reference for language elementsVersion 3.3
154
$UPARENEw.This format decodes a string of UPAREN-encoded sequences.
min max defaultVariable width 1 32767 8
ExampleDATA _null_; s = "<u0057><u006F><u0072><u006C><u0064><u0020><u0050><u0072><u006F> <u0067><u0072><u0061><u006D><u006D><u0069><u006E><u0067>"; t = PUT(s, $UPARANE20.); PUT t ;RUN;
Which produces the following output in the log:
World Programming
$UTF8Xw.This format converts a string from session encoding to UTF-8.
min max defaultVariable width 1 32767 8
$UTF8XEw.This format converts character data from UTF-8 to session encoding. The input to this format is alwaysin UTF-8, regardless of the session encoding. It is then converted to session encoding and output.
min max defaultVariable width 1 32767 8
Simple numeric formatsFundamental formats for numeric data.
Reference for language elementsVersion 3.3
155
BESTXw.This numeric format is the same as the Fw. format, but with a different default width.
min max defaultVariable width 1 32 12
ExampleDATA _null; d=0.7; e=1.5; PUT d bestx. "*"; PUT e bestx. "*"; PUT d bestx8.1 "*"; PUT d bestx8.2 "*";RUN;
Which produces the following output in the log:
1* 2* 0.7* 0.70*
BINARYw.This format converts numeric data to a binary representation – a textual representation of a binarynumber consisting of a string of 1s and 0s.
The format width determines whether the number is considered an integer or a double. For widths of59 or more, the output consists of the bits of the double floating point number – 'digits' is ignored. Forwidths of less than 59, the number is considered to be an integer and the 'digits' field is a scaling powerof 10.
min max defaultVariable width 1 64 8
ExampleDATA _null_; s=1; t=8; PUT s binary. "*"; PUT s binary20. "*"; PUT t binary. "*"; PUT t binary20. "*";RUN;
Reference for language elementsVersion 3.3
156
Which produces the following output in the log:
00000001*00000000000000000001*00001000*00000000000000001000*
COMMAw.dThis format decorates numeric data by inserting commas every three digits, counting from the right.
When using this format, the decimal point is represented by a period. Commas are only inserted if thespecified output length is sufficient to accommodate them.
min max defaultVariable width 1 32 6
ExampleDATA _null_; s = 1234567.89; PUT s COMMA.3 "*"; PUT s COMMA12.3 "*"; PUT s COMMA20.3 "*";RUN;
Which produces the following output in the log:
1.23E6* 1234567.890* 1,234,567.890*
COMMAXw.dThis format behaves like COMMAw.d except that it inserts periods, not commas. The decimal point isrepresented by a comma.
min max defaultVariable width 1 32 6
Reference for language elementsVersion 3.3
157
ExampleDATA _null_; s=1234567.89; PUT s COMMAX.3; PUT s COMMAX12.3; PUT s COMMAX20.3;RUN;
Which produces the following output in the log:
1,23E6 1234567,890 1.234.567,890
Dw.dThis format converts numeric values into a form where, when output, the decimal points are likely to lineup.
min max defaultVariable width 1 32 12
ExampleDATA _null_; s=1234567.89; t=22.323; PUT s D20.3; PUT t D20.3;RUN;
Which produces the following output in the log:
1234567.8900000000 22.3230000000
DOLLARw.dThis format prepends a dollar sign to a numeric value.
In addition to the dollar sign, commas are inserted between sets of three digits to improve readability(just like COMMAw.d). These actions are only taken if there is sufficient room for the output. This formatis not locale-sensitive, a dollar character is always output.
min max defaultVariable width 2 32 6
Reference for language elementsVersion 3.3
158
ExampleDATA _null_; s=1096543.123; PUT s DOLLAR20.3;RUN;
Which produces the following output in the log:
$1,096,543.123
DOLLARXw.dThis format prepends a dollar sign to a numeric value.
In addition to the dollar sign, periods between sets of three digits to improve readability (just likeCOMMAXw.d). These actions are only taken if there is sufficient room for the output.
min max defaultVariable width 2 32 6
ExampleDATA _null_; s=1096543.123; PUT s DOLLARX20.3;RUN;
Which produces the following output in the log:
$1.096.543,123
Ew.This format converts its numeric input to scientific notation.
min max defaultVariable width 7 32 12
ExampleDATA _null_; s=1096543.123; PUT s E20.;RUN;
Reference for language elementsVersion 3.3
159
Which produces the following output in the log:
1.0965431230000E+06
EUROw.dThis format prepends an 'E' character to a numeric value to represent the Euro (€) character.
In addition to the 'E' character, the thousand separators are formatted as a comma, and the decimalseparator as a period.
min max defaultVariable width 2 32 6
ExampleDATA _null_; s=1096543.123; PUT s EURO20.3;RUN;
Which produces the following output in the log:
E1,096,543.123
EUROXw.dThis format prepends an 'E' character to a numeric value to represent the Euro (€) character.
In addition to the 'E' character, the thousand separators are formatted as a period, and the decimalseparator as a comma.
min max defaultVariable width 2 32 6
ExampleDATA _null_; s=1096543.123; PUT s EUROX20.3;RUN;
Which produces the following output in the log:
E1.096.543,123
Reference for language elementsVersion 3.3
160
Fw.dF is an alternative name for the standard numeric format.
In practice, it is unusual to specify the format fully – for example, 7.4 is generally used, rather than F7.4.The number of decimal places is restricted to be smaller than the format width.
min max defaultVariable width 1 32 1
ExampleDATA _null_; s = 123.456; PUT s F7.3; PUT s 7.3;RUN;
Which produces the following output in the log:
123.456123.456
FLOATw.dThis format converts numeric data to a 4-byte single precision floating point value, outputting the resultas a binary value. The decimal part is a power of 10 by which the value part is multiplied.
min max defaultVariable width 4 4 4
ExampleDATA _null_; s = 1; r = PUT(s, FLOAT.); PUT r $HEX.;RUN;
Which produces the following hex representation of the format in the log:
0000803F
Reference for language elementsVersion 3.3
161
FRACTw.This format finds the nearest fraction to the input numeric value – it uses the method of continuedfractions.
min max defaultVariable width 4 32 10
ExampleDATA _null_; s = 1.333; PUT s FRACT. "*";RUN;
Which produces the following output in the log:
1+333/1000*
HEXw.This format converts a numeric value to a hexadecimal representation, outputting the result in a textualform consisting of the characters 0–9, A–F.
If the width is 16, the floating point representation is output. For lesser widths, the output is converted toan integer and the hex representation of that output.
min max defaultVariable width 1 16 8
ExampleDATA _null_; s = 15; PUT s HEX.;RUN;
Which produces the following output in the log:
0000000F
Reference for language elementsVersion 3.3
162
IBw.dThis format converts a number into a native-endian integer in binary format.
On Intel platforms, it converts the number 42 into 2A 00 00 00, while on big-endian platforms, the outputwould be 00 00 00 2A. The number of digits represents a scaling power of 10.
A double floating point value is converted into a signed 64-bit integer. Input values outside the range ofa signed, 64-bit integer take the largest positive or negative value as appropriate. As many of the bytesof the integer are output as requested by the length, truncating on the most significant end if necessary.
Missing input values are output as 0.
min max defaultVariable width 1 8 4
ExampleDATA _null_; n = 42; s = PUT(n,IB.); PUT s $HEX.;RUN;
Which produces the following hex representation of the format output in the log (on Intel platforms):
2A000000
IBRw.dThis format converts a number into a little-endian integer in binary format.
when converting, the number of digits represents a scaling power of 10; for example the number 42 isconverted to 2A 00 00 00.
min max defaultVariable width 1 8 4
ExampleDATA _null_; n = 42; s = PUT(n,IBR.); PUT s $HEX.;RUN;
Which produces the following output in the log:
2A000000
Reference for language elementsVersion 3.3
163
IEEEw.dThis format converts numeric input to an IEEE floating point representation.
If present, the number of digits is a scaling power of 10.
If w is 1–4, the result is a single-precision IEEE floating point number. On IEEE platforms, for widthsof 1–4, the number is first converted to single precision if possible, and then the bytes of the float areoutput, truncating at the least significant end of the fraction if necessary.
If w is 5–8, the result is a double-precision IEEE floating point number. On IEEE platforms, for widths of5–8, this format outputs a (potentially truncated) double precision floating point number in binary format,copying bytes from memory to the output. If necessary, truncation occurs at the least significant end ofthe fraction of the number, so some precision is lost.
On z/OS, a similar process occurs, except that the input number is first converted from IBM hex floatingpoint to IEEE.
min max defaultVariable width 1 8 8
ExampleDATA _null_; LENGTH s1 $ 8 s2 $ 16; DO n = 1, 1234567.95, ., .A,1E60; PUT n @; DO w = 3, 4, 7; DO d = 0, 4; s1 = PUTN(n,'IEEE',w,d); s2 = PUTC(s1,'$HEX',w*2); PUT @20 ': IEEE' w +(-1) '.' d s2; END; END; END;RUN;
Which produces the following output in the log:
1 : ieee3.0 3F8000 : ieee3.4 461C40 : ieee4.0 3F800000 : ieee4.4 461C4000 : ieee7.0 3FF00000000000 : ieee7.4 40C388000000001234567.95 : ieee3.0 4996B4 : ieee3.4 5037F7 : ieee4.0 4996B43F : ieee4.4 5037F707 : ieee7.0 4132D687F33333 : ieee7.4 4206FEE0F46000. : ieee3.0 FFE880 : ieee3.4 FFE880 : ieee4.0 FFE88000 : ieee4.4 FFE88000
Reference for language elementsVersion 3.3
164
: ieee7.0 FFFFD100000000 : ieee7.4 FFFFD100000000A : ieee3.0 FFE880 : ieee3.4 FFE880 : ieee4.0 FFE88000 : ieee4.4 FFE88000 : ieee7.0 FFFFBE00000000 : ieee7.4 FFFFBE000000001E60 : ieee3.0 FFE880 : ieee3.4 FFE880 : ieee4.0 FFE88000 : ieee4.4 FFE88000 : ieee7.0 4C63E9E4E4C2F3 : ieee7.4 4D384F03E93FF9
NEGPARENw.dThis format places commas after every three digits to improve readibility.
If the value is negative, the minus sign is replaced by surrounding parentheses as is the style in thefinance industry. For correct operation, sufficient space must be specified in the width of the output toinclude the parentheses.
min max defaultVariable width 1 32 6
ExampleThe following example formats the two supplied negative numbers, but does not attempt to format thenumber where the default length is insufficient.
DATA _null_; d = -10; e = -1000; PUT d NEGPARAN. "*"; PUT e NEGPARAN. "*"; PUT d NEGPARAN10.2 "*"; PUT e NEGPARAN10.2 "*";RUN;
Which produces the following output in the log:
(10)*-1,000* (10.00)*(1,000.00)*
Reference for language elementsVersion 3.3
165
NUMXw.dThis format converts a decimal point in a numeric variable into a comma.
This format is the same as the regular blank numeric format, except that it uses a comma instead of adecimal point.
min max defaultVariable width 1 32 12
ExampleDATA _null_; s = 123456.789; t = PUT(s, NUMX12.4); PUT t;RUN;
Which produces the following output in the log:
123456,7890
OCTALw.dThis format converts a numeric input to its octal representation.
If present, the number of digits (d) is a scaling power of 10; the input is multiplied by the scaling factor,and the format applied to the output. The formatted output will be truncated if the width is too narrow tocontain the converted value, any truncation occurs on the left.
min max defaultVariable width 1 24 3
ExampleThe following outputs the default octal value for the input value of 8. This value is then scaled by to 800 decimal (1440 octal), and by to generate a result that is too large to fit the format width.
DATA _null_; d = 8; PUT d OCTAL. "*"; PUT d OCTAL4.2 "*"; PUT d OCTAL4.3 "*";RUN;
Reference for language elementsVersion 3.3
166
Which produces the following output in the log:
010*1440*7500*
ODDSRw.dThis format transforms its numeric argument into an odds ratio.
min max defaultVariable width 2 32 8
ExampleDATA _null; d = 1.34; e = -1.34; PUT d ODDSR. "*"; PUT e ODDSR. "*"; PUT d ODDSR5.2 "*"; PUT e ODDSR5.2 "*";RUN;
Which produces the following output in the log:
1.340* <0.001* 1.34* <0.01*
PDw.dThis format converts numeric input arguments to a packed decimal form where two digits are encodedinto one byte with one digit per four-byte nibble.
The representation is platform-dependent – its mainframe representation differs from its representationon other architectures. If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 1 16 1
Reference for language elementsVersion 3.3
167
ExampleDATA _null_; s = 12.0; r = PUT(s, PD4.2); PUT r $HEX.;RUN;
Which procues the following output in the log (on Intel platforms):
00001200
PERCENTw.dThis format converts its numeric input into a percentage – for example, an input of 0.5 would producean output of 50%.
If present, the number of digits (d) is a scaling power of 10. Negative numbers are surrounded withparentheses and the format leaves space in the output to allow for this.
min max defaultVariable width 4 32 6
ExampleDATA _null; d = 0.7; e = 1.5; f = -2.1; PUT d PERCENT. "*"; PUT e PERCENT. "*"; PUT d PERCENT8.1 "*"; PUT d PERCENT8.2 "*"; PUT f PERCENT. "*";RUN;
Which produces the following output in the log:
70% * 150% * 70.0% * 70.00% *(210%)*
Reference for language elementsVersion 3.3
168
PERCENTNw.dThis format converts its numeric input into a percentage – for example, an input of 0.25 would producean output of 25%.
If present, the number of digits (d) is a scaling power of 10. Negative numbers have a minus sign infront of them and the format leaves space in the output to allow for this. Additionally, PERCENTN alsoleaves a space at the end, similar to PERCENT.
min max defaultVariable width 4 32 6
PIBw.dThis format converts its numeric input into a positive integer binary representation – the output is binary,not textual.
For negative inputs, the output is set to a maximum binary value. The number of digits (d), if present, isa scaling power of 10.
min max defaultVariable width 1 8 1
ExampleDATA _null_; LENGTH s1 $ 8 s2 $ 16; DO n = -10, 1, 1234567.95, ., .A,1E60; PUT n @; DO w = 3, 4, 7; DO d = 0, 4; s1 = PUTN(n,'PIB',w,d); s2 = PUTC(s1,'$HEX',w*2); PUT @20 ': PIB' w +(-1) '.' d s2; END; END; END;RUN;
Which produces the following output in the log:
-10 : pib3.0 FFFFFF : pib3.4 FFFFFF : pib4.0 FFFFFFFF : pib4.4 FFFFFFFF : pib7.0 FFFFFFFFFFFFFF : pib7.4 FFFFFFFFFFFFFF1 : pib3.0 010000 : pib3.4 102700 : pib4.0 01000000
Reference for language elementsVersion 3.3
169
: pib4.4 10270000 : pib7.0 01000000000000 : pib7.4 102700000000001234567.95 : pib3.0 88D612 : pib3.4 FFFFFF : pib4.0 88D61200 : pib4.4 FFFFFFFF : pib7.0 88D61200000000 : pib7.4 8C1EDCDF020000. : pib3.0 000000 : pib3.4 000000 : pib4.0 00000000 : pib4.4 00000000 : pib7.0 00000000000000 : pib7.4 00000000000000A : pib3.0 000000 : pib3.4 000000 : pib4.0 00000000 : pib4.4 00000000 : pib7.0 00000000000000 : pib7.4 000000000000001E60 : pib3.0 FFFFFF : pib3.4 FFFFFF : pib4.0 FFFFFFFF : pib4.4 FFFFFFFF : pib7.0 FFFFFFFFFFFFFF : pib7.4 FFFFFFFFFFFFFF
PIBRw.dThis format converts its numeric input into a positive integer binary representation, guaranteeing that itsoutput will be in a little-endian format.
For negative inputs, the output is set to a maximum binary value. If present, the number of digits (d) is ascaling power of 10.
min max defaultVariable width 1 8 1
Reference for language elementsVersion 3.3
170
ExampleDATA _null_; LENGTH s1 $ 8 s2 $ 16; DO n = -10, 1, 1234567.95, ., .A,1E60; PUT n @; DO w = 3, 4, 7; DO d = 0, 4; s1 = PUTN(n,'PIBR',w,d); s2 = PUTC(s1,'$HEX',w*2); PUT @20 ': PIBR' w +(-1) '.' d s2; END; END; END;RUN;
Which produces the following output in the log:
-10 : pibr3.0 FFFFFF : pibr3.4 FFFFFF : pibr4.0 FFFFFFFF : pibr4.4 FFFFFFFF : pibr7.0 FFFFFFFFFFFFFF : pibr7.4 FFFFFFFFFFFFFF1 : pibr3.0 010000 : pibr3.4 102700 : pibr4.0 01000000 : pibr4.4 10270000 : pibr7.0 01000000000000 : pibr7.4 102700000000001234567.95 : pibr3.0 88D612 : pibr3.4 FFFFFF : pibr4.0 88D61200 : pibr4.4 FFFFFFFF : pibr7.0 88D61200000000 : pibr7.4 8C1EDCDF020000. : pibr3.0 000000 : pibr3.4 000000 : pibr4.0 00000000 : pibr4.4 00000000 : pibr7.0 00000000000000 : pibr7.4 00000000000000A : pibr3.0 000000 : pibr3.4 000000 : pibr4.0 00000000 : pibr4.4 00000000 : pibr7.0 00000000000000 : pibr7.4 000000000000001E60 : pibr3.0 FFFFFF : pibr3.4 FFFFFF : pibr4.0 FFFFFFFF : pibr4.4 FFFFFFFF : pibr7.0 FFFFFFFFFFFFFF : pibr7.4 FFFFFFFFFFFFFF
Reference for language elementsVersion 3.3
171
PKw.dThis format converts its numeric argument into a machine-independent packed decimal form.
When converting, two digits are encoded into one byte with one digit per 4-byte nibble. If present, thenumber of digits (d) is a scaling power of 10.
min max defaultVariable width 1 16 1
ExampleDATA _null_; LENGTH s1 $ 8 s2 $ 16; DO n = -10, 1, 1234567.95, ., .A,1E60; PUT n @; DO w = 3, 4, 7; DO d = 0, 4; s1 = PUTN(n,'PK',w,d); s2 = PUTC(s1,'$HEX',w*2); PUT @20 ': IEEE' w +(-1) '.' d s2; END; END; END;RUN;
Which produces the following output in the log:
-10 : ieee3.0 000010 : ieee3.4 100000 : ieee4.0 00000010 : ieee4.4 00100000 : ieee7.0 00000000000010 : ieee7.4 000000001000001 : ieee3.0 000001 : ieee3.4 010000 : ieee4.0 00000001 : ieee4.4 00010000 : ieee7.0 00000000000001 : ieee7.4 000000000100001234567.95 : ieee3.0 999999 : ieee3.4 999999 : ieee4.0 01234568 : ieee4.4 99999999 : ieee7.0 00000001234568 : ieee7.4 00012345679500. : ieee3.0 000000 : ieee3.4 000000 : ieee4.0 00000000 : ieee4.4 00000000 : ieee7.0 00000000000000 : ieee7.4 00000000000000A : ieee3.0 000000 : ieee3.4 000000 : ieee4.0 00000000 : ieee4.4 00000000
Reference for language elementsVersion 3.3
172
: ieee7.0 00000000000000 : ieee7.4 000000000000001E60 : ieee3.0 999999 : ieee3.4 999999 : ieee4.0 99999999 : ieee4.4 99999999 : ieee7.0 99999999999999 : ieee7.4 99999999999999
PVALUEw.dThis format converts probabilities (especially small ones) into a form in which the specified number ofdigits determines the smallest number it can output.
Output values less than this minimum (including negative numbers) are rendered with the < symbol. Ifthe number of decimal points is 2, then the smallest number it can render is 0.01. If 3, then it is 0.001,and so on.
min max defaultVariable width 3 32 6
ExampleDATA _null_; d = 0.002; d1 = 0.0002; d2= 0.00003; PUT d PVALUE7.2; PUT d1 PVALUE7.3; PUT d2 PVALUE7.4;RUN;
Which produces the following output in the log:
<.01 <.001 <.0001
RBw.dThis format simply outputs the requested number of bytes of the double floating point in memory,truncating so as to lose precision from the fraction if necessary.
If present, digits represent a scaling power of 10. There is no conversion to single precision for narrowwidths. RB stands for 'real binary'.
Reference for language elementsVersion 3.3
173
min max defaultVariable width 2 8 4
Exampledata _null_;length s1 $ 8 s2 $ 16;do n = -10, 1, 1234567.95, ., .A,1E60; put n @; do w = 3, 4, 7; do d = 0, 4; s1 = putn(n,'rb',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': rb' w +(-1) '.' d s2; end; end; end;run;
Which produces the following output in the log:
-10 : rb3.0 0024C0 : rb3.4 6AF8C0 : rb4.0 000024C0 : rb4.4 006AF8C0 : rb7.0 000000000024C0 : rb7.4 000000006AF8C01 : rb3.0 00F03F : rb3.4 88C340 : rb4.0 0000F03F : rb4.4 0088C340 : rb7.0 0000000000F03F : rb7.4 0000000088C3401234567.95 : rb3.0 D63241 : rb3.4 FE0642 : rb4.0 87D63241 : rb4.4 E0FE0642 : rb7.0 3333F387D63241 : rb7.4 0060F4E0FE0642. : rb3.0 D1FFFF : rb3.4 D1FFFF : rb4.0 00D1FFFF : rb4.4 00D1FFFF : rb7.0 00000000D1FFFF : rb7.4 00000000D1FFFFA : rb3.0 BEFFFF : rb3.4 BEFFFF : rb4.0 00BEFFFF : rb4.4 00BEFFFF : rb7.0 00000000BEFFFF : rb7.4 00000000BEFFFF1E60 : rb3.0 E9634C : rb3.4 4F384D : rb4.0 E4E9634C : rb4.4 034F384D : rb7.0 F3C2E4E4E9634C : rb7.4 F93FE9034F384D
Reference for language elementsVersion 3.3
174
ROMANw.This format converts its numeric input to a Roman numeral form, after first converting into an integer.
min max defaultVariable width 2 32 6
Exampledata _null_;d=50;d1 = 121;put d roman. "*";put d1 roman. "*";run;
Which produces the following output in the log:
L *CXXI *
S370FFw.dFirst, this format performs a conversion identical to that of the F format, the standard numeric format.
If on a non-z/OS machine, it converts that into open edition 1047 EBCDIC. It has no further effect on z/OS machines, which are native EBCDIC. The output of this format is always in EBCDIC.
min max defaultVariable width 1 32 12
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;d=0;n=10;put n @;s1 = putn(n,'s370ff',w,d);s2 = putc(s1,'$hex',w*2);put @20 ': s370ff' w +(-1) '.' d s2;run;
Which produces the following output in the log:
10 : s370ff5.0 404040F1F0
Reference for language elementsVersion 3.3
175
S370FIBw.dThis format converts a number into a big-endian integer in binary format.
If present, the number of digits (d) is a scaling power of 10. A double floating point value is convertedinto a signed 64-bit integer. Input values outside the range of a signed, 64-bit integer take the largestpositive or negative value as appropriate. As many of the bytes of the integer are output as requestedby the length, truncating on the most significant end if necessary.
Missing input values are output as 0.
On an IBM mainframe, this format is identical to the IBw.d format.
min max defaultVariable width 1 8 4
Exampledata _null_;r=42;s=put(r,s370fib4.);put s $hex8.;run;
Which produces the following output in the log:
0000002A
S370FIBUw.dThis format transforms numeric data, taking its absolute value and converting it into big-endian positiveinteger binary IBM mainframe format.
If present, the number of digits (d) is a scaling power of 10. A double floating point value is convertedinto a signed 64-bit integer. Input values outside the range of a signed, 64-bit integer take the largestpositive or negative value as appropriate. As many of the bytes of the integer are output as requestedby the length, truncating on the most significant end if necessary.
Missing input values are output as 0, and negative input values are first converted to their absolutevalue.
min max defaultVariable width 1 8 4
Reference for language elementsVersion 3.3
176
Exampledata _null_;x=-42;y=put(x,s370fibu4.);put y $hex8.;run;
Which produces the following output in the log:
0000002A
S370FPDw.dThis format converts numeric data into z/OS packed decimal format where two digits are encoded intoone byte with one digit per 4-byte nibble.
If present, the number of digits (d) is a scaling power of 10. This representation of this format ismachine-independent, as it always returns the IBM mainframe format in which the sign is signified bythe terminating nibble.
min max defaultVariable width 1 16 1
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370fpd',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370fpd' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370fpd5.0 000000010D-10 : s370fpd5.1 000000100D10 : s370fpd5.0 000000010C10 : s370fpd5.1 000000100C
Reference for language elementsVersion 3.3
177
S370FPDUw.dThis format transforms its numeric input, taking its absolute value and converting it into z/OS unsignedpacked decimal format.
If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 1 16 1
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370fpdu',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370fpdu' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370fpdu5.0 000000010F-10 : s370fpdu5.1 000000100F10 : s370fpdu5.0 000000010F10 : s370fpdu5.1 000000100F
S370FPIBw.dThis format converts numeric data into z/OS big-endian positive integer binary format.
If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 1 8 4
Reference for language elementsVersion 3.3
178
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370fpib',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370fpib' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370fpib5.0 FFFFFFFFFF-10 : s370fpib5.1 FFFFFFFFFF10 : s370fpib5.0 000000000A10 : s370fpib5.1 0000000064
S370FRBw.dThis format converts a native representation of floating point numeric data into a z/OS big-endian binaryrepresentation.
If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 2 8 4
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370frb',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370frb' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370frb5.0 C1A0000000-10 : s370frb5.1 C26400000010 : s370frb5.0 41A000000010 : s370frb5.1 4264000000
Reference for language elementsVersion 3.3
179
S370FZDw.dThis format converts numeric data into z/OS zoned decimal format with one digit (or character) per byte.
If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 1 32 8
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370fzd',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370fzd' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370fzd5.0 F0F0F0F1D0-10 : s370fzd5.1 F0F0F1F0D010 : s370fzd5.0 F0F0F0F1C010 : s370fzd5.1 F0F0F1F0C0
S370FZDLw.dThis format converts numeric data into z/OS zoned decimal format with a sign nibble at the beginning.
If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 1 32 8
Reference for language elementsVersion 3.3
180
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370fzdl',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370fzdl' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370fzdl5.0 D0F0F0F1F0-10 : s370fzdl5.1 D0F0F1F0F010 : s370fzdl5.0 C0F0F0F1F010 : s370fzdl5.1 C0F0F1F0F0
S370FZDSw.dThis format converts numeric data into z/OS zoned decimal format with a sign byte at the beginning.
If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 2 32 8
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370fzds',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370fzds' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370fzds5.0 60F0F0F1F0-10 : s370fzds5.1 60F0F1F0F010 : s370fzds5.0 4EF0F0F1F010 : s370fzds5.1 4EF0F1F0F0
Reference for language elementsVersion 3.3
181
S370FZDTw.dThis format converts numeric data into z/OS zoned decimal format with a sign byte at the end.
If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 2 32 8
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370fzdt',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370fzdt' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370fzdt5.0 F0F0F1F060-10 : s370fzdt5.1 F0F1F0F06010 : s370fzdt5.0 F0F0F1F04E10 : s370fzdt5.1 F0F1F0F04E
S370FZDUw.dThis format converts numeric data into z/OS zoned decimal format with no sign byte.
If present, the number of digits (d) is a scaling power of 10.
min max defaultVariable width 1 32 8
Reference for language elementsVersion 3.3
182
Exampledata _null_;length s1 $ 8 s2 $ 16;w=5;do n=-10,10; do d=0,1; put n @; s1 = putn(n,'s370fzdu',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': s370fzdu' w +(-1) '.' d s2; end;end;run;
Which produces the following output in the log:
-10 : s370fzdu5.0 F0F0F0F1F0-10 : s370fzdu5.1 F0F0F1F0F010 : s370fzdu5.0 F0F0F0F1F010 : s370fzdu5.1 F0F0F1F0F0
SSNw.This format converts its numeric input to US social security number format.
min max defaultVariable width 11 11 11
Exampledata _null_;d=10;d1=123456789;put d ssn. "*";put d1 ssn. "*";run;
Which produces the following output in the log:
000-00-0010*123-45-6789*
Reference for language elementsVersion 3.3
183
WORDFw.The format converts its numeric input into English words, assuming the output width is specified assufficiently large. Fractions are shown as a number of one-hundredths.
min max defaultVariable width 5 32767 10
Exampledata _null_;d=10.2;d1=12345.3;put d wordf. "*";put d1 wordf. "*";put d wordf40. "*";put d1 wordf80. "*";run;
Which produces the following output in the log:
ten and 2**twelve th**ten and 20/100 *twelve thousand three hundred forty-five and 30/100 *
WORDSw.This format converts its numeric input to English words, assuming the output width is specified assufficiently large.
min max defaultVariable width 5 32767 10
Exampledata _null_;d=10;d1=12345;put d words. "*";put d1 words. "*";put d words40. "*";put d1 words80. "*";run;
Reference for language elementsVersion 3.3
184
Which produces the following output in the log:
ten *twelve th**ten *twelve thousand three hundred forty-five *
Zw.dThis format pads its numeric input with leading zeroes rather than blanks, if enough output space isavailable.
min max defaultVariable width 1 32 1
Exampledata _null_;d=10;d1=12345;put d z5. "*";put d1 z5. "*";put d z20. "*";put d1 z20. "*";run;
Which produces the following output in the log:
00010*12345*00000000000000000010*00000000000000012345*
ZDw.dThis format converts a numeric input into a zoned decimal format with one digit (or character) per byte.The result is ultimately platform-dependent.
min max defaultVariable width 1 32 1
Reference for language elementsVersion 3.3
185
Exampledata _null_;length s1 $ 8 s2 $ 16;do n = -10, 1, 1234567.95, ., .A,1E60; put n @; do w = 3, 4, 7; do d = 0, 4; s1 = putn(n,'zd',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': zd' w +(-1) '.' d s2; end; end; end;run;
Which produces the following output in the log
-10 : zd3.0 30317D : zd3.4 393952 : zd4.0 3030317D : zd4.4 39393952 : zd7.0 3030303030317D : zd7.4 3031303030307D1 : zd3.0 303041 : zd3.4 393949 : zd4.0 30303041 : zd4.4 39393949 : zd7.0 30303030303041 : zd7.4 3030313030307B1234567.95 : zd3.0 393949 : zd3.4 393949 : zd4.0 39393949 : zd4.4 39393949 : zd7.0 31323334353648 : zd7.4 39393939393949. : zd3.0 30307D : zd3.4 30307D : zd4.0 3030307D : zd4.4 3030307D : zd7.0 3030303030307D : zd7.4 3030303030307DA : zd3.0 30307D : zd3.4 30307D : zd4.0 3030307D : zd4.4 3030307D : zd7.0 3030303030307D : zd7.4 3030303030307D1E60 : zd3.0 393949 : zd3.4 393949 : zd4.0 39393949 : zd4.4 39393949 : zd7.0 39393939393949 : zd7.4 39393939393949
Reference for language elementsVersion 3.3
186
Numeric date formatsFormats that convert a numeric date into a formatted character representation.
DATEw.This format converts a numeric date into a DDMMM, DDMMMYY, DDMMMYYYY or DD-MMM-YYYYform, depending upon the specified output width.
min max defaultVariable width 5 11 7
ExampleThis example shows the points where the format width selected changes the presentation of a dateformat. Using other format output widths pads the start of the date presentation with white space.
data _null_; d=19995; explanation = "Output length: "; put explanation "default " d date.; put explanation "5 " d date5.; put explanation "7 " d date7.; put explanation "9 " d date9.; put explanation "11 " d date11.;run;
Which produces the following output in the log:
Output length: default 29SEP14Output length: 5 29SEPOutput length: 7 29SEP14Output length: 9 29SEP2014Output length: 11 29-SEP-2014
DATEAMPMw.dThis format converts a numeric datetime into a visual form that depends upon the specified outputlength.
When the format is set to more than 19 characters, the output is padded at the front of the string withwhitespace. If sufficient room is available, an AM or PM suffix is added to the result.
min max defaultVariable width 7 40 19
Reference for language elementsVersion 3.3
187
Exampledata _null_; d=1727610480; explanation = "Output length: "; put explanation "default " d dateampm.; put explanation "7 " d dateampm7.; put explanation "9 " d dateampm9.; put explanation "10 " d dateampm10.; put explanation "13 " d dateampm13.; put explanation "16 " d dateampm16.; put explanation "19 " d dateampm19.; put explanation "40 " d dateampm40.;run;
Which produces the folowing output in the log:
Output length: default 29SEP14:11:48:00 AMOutput length: 7 29SEP14Output length: 9 29SEP2014Output length: 10 29SEP14:11Output length: 13 29SEP14:11 AMOutput length: 16 29SEP14:11:48 AMOutput length: 19 29SEP14:11:48:00 AMOutput length: 40 29SEP2014:11:48:00 AM
DATETIMEw.dThis format converts a numeric datetime into a visual form that depends upon the specified outputlength. Time is expressed in the 24-hour clock format.
min max defaultVariable width 7 40 16
Exampledata _null_; d=1727610480; explanation = "Output length: "; put explanation "default " d datetime.; put explanation "7 " d datetime7.; put explanation "9 " d datetime9.; put explanation "10 " d datetime10.; put explanation "13 " d datetime13.; put explanation "16 " d datetime16.; put explanation "40 " d datetime40.;run;
Reference for language elementsVersion 3.3
188
Which produces the following output in the log:
Output length: default 29SEP14:11:48:00Output length: 7 29SEP14Output length: 9 29SEP2014Output length: 10 29SEP14:11Output length: 13 29SEP14:11:48Output length: 16 29SEP14:11:48:00Output length: 40 29SEP2014:11:48:00
DAYw.This format converts a numeric date into a number representing the day of the month on which itoccurred.
min max defaultVariable width 2 32 2
Exampledata _null_; d=19995; /* 29 Sept 2014 */ put d day.;run;
Which produces the following output in the log:
29
DDMMYYw.This format converts a numeric date into a DD/MM/YY representation, with variations dependent uponthe required output length.
min max defaultVariable width 2 10 8
Reference for language elementsVersion 3.3
189
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "default " d ddmmyy.; put explanation "2 " d ddmmyy2.; put explanation "4 " d ddmmyy4.; put explanation "5 " d ddmmyy5.; put explanation "6 " d ddmmyy6.; put explanation "8 " d ddmmyy8.; put explanation "10 " d ddmmyy10.;run;
Which produces the following output in the log:
Output length: default 29/09/14Output length: 2 29Output length: 4 2909Output length: 5 29/09Output length: 6 290914Output length: 8 29/09/14Output length: 10 29/09/2014
DDMMYYBw.This format converts a numeric date into a DD MM YY or DD MM YYYY representation, with variationsdepending on the available output space.
min max defaultVariable width 2 10 8
ExampleThis example shows the points where the format width selected changes the presentation of a dateformat. Using other format output widths pads the start of the date presentation with white space.
data _null_; d=19995; explanation = "Output length: "; put explanation "default " d ddmmyyb.; put explanation "2 " d ddmmyyb2.; put explanation "4 " d ddmmyyb4.; put explanation "5 " d ddmmyyb5.; put explanation "6 " d ddmmyyb6.; put explanation "8 " d ddmmyyb8.; put explanation "10 " d ddmmyyb10.;run;
Reference for language elementsVersion 3.3
190
Which produces the following output in the log:
Output length: default 29 09 14Output length: 2 29Output length: 4 2909Output length: 5 29 09Output length: 6 290914Output length: 8 29 09 14Output length: 10 29 09 2014
DDMMYYDw.This format converts a numeric date into a DD-MM-YY or DD-MM-YYYY representation, with variationsaccording to the available space.
min max defaultVariable width 2 10 8
ExampleThis example shows the points where the format width selected changes the presentation of a dateformat. Using other format output widths pads the start of the date presentation with whitespace.
data _null_; d=19995; explanation = "Output length: "; put explanation "default " d ddmmyyd.; put explanation "2 " d ddmmyyd2.; put explanation "4 " d ddmmyyd4.; put explanation "5 " d ddmmyyd5.; put explanation "6 " d ddmmyyd6.; put explanation "8 " d ddmmyyd8.; put explanation "10 " d ddmmyyd10.;run;
Which produces the following output in the log:
Output length: default 29-09-14Output length: 2 29Output length: 4 2909Output length: 5 29-09Output length: 6 290914Output length: 8 29-09-14.Output length: 10 29-09-2014
Reference for language elementsVersion 3.3
191
DDMMYYCw.This format converts a numeric date into a DD:MM:YY or DD:MM:YYYY representation, with variationsdepending on the required output length.
min max defaultVariable width 2 10 8
ExampleThis example shows the points where the format width selected changes the presentation of a dateformat. Using other format output widths pads the start of the date presentation with whitespace.
data _null_; d=19995; explanation = "Output length: "; put explanation "default " d ddmmyyc.; put explanation "2 " d ddmmyyc2.; put explanation "4 " d ddmmyyc4.; put explanation "5 " d ddmmyyc5.; put explanation "6 " d ddmmyyc6.; put explanation "8 " d ddmmyyc8.; put explanation "10 " d ddmmyyc10.;run;
Which produces the following output in the log:
Output length: default 29:09:14Output length: 2 29Output length: 4 2909Output length: 5 29:09Output length: 6 290914Output length: 8 29:09:14Output length: 10 29:09:2014
DDMMYYNw.This format converts a numeric date into a DDMMYY or DDMMYYYY representation, with variationsdepending on the specified output length.
min max defaultVariable width 2 8 8
Reference for language elementsVersion 3.3
192
ExampleThis example shows the points where the format width selected changes the presentation of a dateformat. Using other format output widths pads the start of the date presentation with whitespace.
data _null_;d=19995;explanation = "Output length: ";put explanation "default " d ddmmyyn.;put explanation "2 " d ddmmyyn2.;put explanation "4 " d ddmmyyn4.;put explanation "6 " d ddmmyyn6.;put explanation "8 " d ddmmyyn8.;run;
Which produces the following output in the log:
Output length: default 29092014Output length: 2 29Output length: 4 2909Output length: 6 290914Output length: 8 29092014
DDMMYYPw.This format converts a numeric date into a DD.MM.YY representation, with variations depending on theavailable output space.
min max defaultVariable width 2 10 8
ExampleThis example shows the points where the format width selected changes the presentation of a dateformat. Using other format output widths pads the start of the date presentation with whitespace.
data _null_; d=19995; explanation = "Output length: "; put explanation "default " d ddmmyyp. "*"; put explanation "2 " d ddmmyyp2. "*"; put explanation "4 " d ddmmyyp4. "*"; put explanation "5 " d ddmmyyp5. "*"; put explanation "6 " d ddmmyyp6. "*"; put explanation "8 " d ddmmyyp8. "*";run;
Reference for language elementsVersion 3.3
193
Which produces the following output in the log:
Output length: default 29092014Output length: 2 29Output length: 4 2909Output length: 6 290914Output length: 8 29092014
DDMMYYSw.This format converts a numeric date into a DD/MM/YY or DD/MM/YYYY representation, with variationsdepending on the specified output length.
min max defaultVariable width 2 10 8
ExampleThis example shows the points where the format width selected changes the presentation of a dateformat. Using other format output widths pads the start of the date presentation with white space.
data _null_; d=19995; explanation = "Output length: "; put explanation "default " d ddmmyys.; put explanation "2 " d ddmmyys2.; put explanation "4 " d ddmmyys4.; put explanation "5 " d ddmmyys5.; put explanation "6 " d ddmmyys6.; put explanation "8 " d ddmmyys8.; put explanation "10 " d ddmmyys10.;run;
Which produces the following output in the log:
Output length: default 29/09/14Output length: 2 29Output length: 4 2909Output length: 5 29/09Output length: 6 290914Output length: 8 29/09/14Output length: 10 29/09/2014
Reference for language elementsVersion 3.3
194
DOWNAMEw.This format converts a numeric date into a spelled-out day of the week. It always produces the result inEnglish – 'Monday', 'Tuesday' and so on. When the complete result is longer than the available space, itis simply truncated.
min max defaultVariable width 1 32 9
Exampledata _null_; d=19995; put d downame. ; put d downame2. ;run;
Which produces the following output in the log:
MondayMo
DTDATEw.This format converts a numeric datetime into a DDMMMYY or DDMMMYYYY representation of the datecomponent of its input value.
min max defaultVariable width 5 9 7
Exampledata _null_; dt=1727610480; put dt dtdate9.;run;
Which produces the following output in the log:
29SEP2014
Reference for language elementsVersion 3.3
195
DTMONYYw.This format converts a numeric datetime into a MMMYY or MMMYYYY representation of the date part.
min max defaultVariable width 5 7 5
Exampledata _null_; d=1727610480; put d dtmonyy7. ; put d dtmonyy. ;run;
Which produces the following output in the log:
SEP2014SEP14
DTWKDATXw.This format converts a numeric datetime into day-of-week, day-number month-name YYYY or day-of-week, day-number MMM YYYY.
min max defaultVariable width 3 37 29
Exampledata _null_; d=1727610480; put d dtwkdatx25.; put d dtwkdatx.;run;
Which produces the following output in the log:
Monday, 29 Sep 2014Monday, 29 September 2014
Reference for language elementsVersion 3.3
196
DTYEARw.This format converts the date part of a numeric datetime into a YYYY representation. If the outputspace is less than 4, the last two digits of the year are displayed.
min max defaultVariable width 2 4 4
Exampledata _null_; d=1727610480; put d dtyear2.; put d dtyear3.; put d dtyear4.;run;
Which produces the following output in the log
14 142014
DTYYQCw.This format converts the date part of a numeric datetime into a YY:Q or YYYY:Q representation whereQ is the quarter in which the date component of the input value falls.
min max defaultVariable width 4 6 4
Exampledata _null_;d=1727610480;put d dtyyqc6.;put d dtyyqc4.;run;
Which produces the following output in the log:
2014:314:3
Reference for language elementsVersion 3.3
197
HHMMw.dThis format converts a numeric time into an HH:MM representation.
min max defaultVariable width 2 20 5
Exampledata _null_; d=0; d1=3601; d2=3600*15; put d hhmm. "*"; put d1 hhmm20. "*"; put d2 hhmm. "*";run;
Which produces the following output in the log:
0:00* 1:00*15:00*
HOURw.dThis format converts a numeric time into a number representing the hour of the day.
min max defaultVariable width 2 20 2
Exampledata _null_;d=0;d1=3601;d2=3600*15;put d hour. "*";put d1 hour20. "*";put d2 hour. "*";run;
Which produces the following output in the log:
0* 1*15*
Reference for language elementsVersion 3.3
198
JULDAYw.This format converts a numeric date into a number representing the Julian day of the year.
min max defaultVariable width 3 32 3
Exampledata _null_;d=19995;put d julday. ;run;
Which produces the following output in the log:
272
JULIANw.This format converts a numeric date into a YYDDD or YYYYDDD Julian day format.
min max defaultVariable width 5 7 5
Exampledata _null_;d=19995;put d julian7.;put d julian5.;run;
Which produces the following output in the log:
201427214272
JULDATEw.Converts a numeric date into YYDDD or YYYYDDD Julian day format.
This format is an alias of JULIAN.
Reference for language elementsVersion 3.3
199
min max defaultVariable width 5 7 5
Exampledata _null_;d=19995;put d julian7.;run;
Which produces the following output in the log:
2014272
MDYAMPMw.dThis format converts a numeric datetime value into a MM/DD/YYYY form, or MM/DD/YY if the availableoutput space is too short.
min max defaultVariable width 8 40 19
Exampledata _null_; n=1727610480; explanation = "Output length: "; put explanation "8 " n mdyampm8.; put explanation "10 " n mdyampm10.; put explanation "19 " n mdyampm19.; put explanation "30 " n mdyampm30.; put explanation "40 " n mdyampm40.;run;
Which produces the following output in the log:
Output length: 8 09/29/14Output length: 10 09/29/2014Output length: 19 09/29/2014 11:48 AMOutput length: 30 09/29/2014 11:48 AMOutput length: 40 09/29/2014 11:48 AM
Reference for language elementsVersion 3.3
200
MINGUOw.This format converts a numeric date into a Taiwanese date format (which counts years from a start in1911), with visual variations depending on the specified output width.
min max defaultVariable width 6 10 8
Exampledata _null_;d=19995;put d minguo.;put d minguo7.;put d minguo10.;run;
Which produces the following output in the log:
1030929 10309290103/09/29
MMDDYYw.This format converts a numeric date into a MM/DD/YY or MM/DD/YYYY format with variationsaccording to the specified output width.
min max defaultVariable width 2 10 8
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "2 " d mmddyy2.; put explanation "4 " d mmddyy4.; put explanation "5 " d mmddyy5.; put explanation "6 " d mmddyy6.; put explanation "8 " d mmddyy8.; put explanation "10 " d mmddyy10.;run;
Reference for language elementsVersion 3.3
201
Which produces the following output in the log:
Output length: 2 09Output length: 4 0929Output length: 5 09/29Output length: 6 092914Output length: 8 09/29/14Output length: 10 09/29/2014
MMDDYYBw.This format converts a numeric date into a MM DD YY or MM DD YYYY format with variationsdepending on the specified output width.
min max defaultVariable width 2 10 8
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "2 " d mmddyyb2.; put explanation "4 " d mmddyyb4.; put explanation "5 " d mmddyyb5.; put explanation "6 " d mmddyyb6.; put explanation "8 " d mmddyyb8.; put explanation "10 " d mmddyyb10.;run;
Which produces the following output in the log:
Output length: 2 09Output length: 4 0929Output length: 5 09 29Output length: 6 092914Output length: 8 09 29 14Output length: 10 09 29 2014
MMDDYYCw.This format converts a numeric date into a MM:DD:YY or MM:DD:YYYY form with variations dependingon the specified output width.
min max defaultVariable width 2 10 8
Reference for language elementsVersion 3.3
202
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "2 " d mmddyyc2.; put explanation "4 " d mmddyyc4.; put explanation "5 " d mmddyyc5.; put explanation "6 " d mmddyyc6.; put explanation "8 " d mmddyyc8.; put explanation "10 " d mmddyyc10.;run;
Which produces the following output in the log:
Output length: 2 09Output length: 4 0929Output length: 5 09:29Output length: 6 092914Output length: 8 09:29:14Output length: 10 09:29:2014
MMDDYYDw.This format converts a numeric date into a MM-DD-YY or MM-DD-YYYY form with variations dependingon the specified output width.
min max defaultVariable width 2 10 8
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "2 " d mmddyyd2.; put explanation "4 " d mmddyyd4.; put explanation "5 " d mmddyyd5.; put explanation "6 " d mmddyyd6.; put explanation "8 " d mmddyyd8.; put explanation "10 " d mmddyyd10.;run;
Which produces the following output in the log:
Output length: 2 09Output length: 4 0929Output length: 5 09-29Output length: 6 092914Output length: 8 09-29-14Output length: 10 09-29-2014
Reference for language elementsVersion 3.3
203
MMDDYYNw.This format converts a numeric date into a MMDDYY or MMDDYYYY form with variations depending onthe specified output width.
min max defaultVariable width 2 8 8
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "2 " d mmddyyn2.; put explanation "4 " d mmddyyn4.; put explanation "5 " d mmddyyn5.; put explanation "6 " d mmddyyn6.; put explanation "8 " d mmddyyn8.;run;
Which produces the following output in the log:
Output length: 2 09Output length: 4 0929Output length: 5 0929Output length: 6 092914Output length: 8 09292014
MMDDYYPw.This format converts a numeric date into a MM.DD.YY or MM.DD.YYYY form with variations dependingon the specified output width.
min max defaultVariable width 2 10 8
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "2 " d mmddyyp2.; put explanation "4 " d mmddyyp4.; put explanation "5 " d mmddyyp5.; put explanation "6 " d mmddyyp6.; put explanation "8 " d mmddyyp8.; put explanation "10 " d mmddyyp10.;run;
Reference for language elementsVersion 3.3
204
Which produces the following output in the log:
Output length: 2 09Output length: 4 0929Output length: 5 09.29Output length: 6 092914Output length: 8 09.29.14Output length: 10 09.29.2014
MMDDYYSw.This format converts a numeric date into a MM/DD/YY or MM/DD/YYYY form with variations dependingon the specified output width.
min max defaultVariable width 2 10 8
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "2 " d mmddyys2.; put explanation "4 " d mmddyys4.; put explanation "5 " d mmddyys5.; put explanation "6 " d mmddyys6.; put explanation "8 " d mmddyys8.; put explanation "10 " d mmddyys10.;run;
Which produces the following output in the log:
Output length: 2 09Output length: 4 0929Output length: 5 09/29Output length: 6 092914Output length: 8 09/29/14Output length: 10 09/29/2014
MMSSw.dThis format converts a numeric time into a MM:SS form.
min max defaultVariable width 2 20 5
Reference for language elementsVersion 3.3
205
Exampledata _null_; t=0; t1= 3601; put t mmss.; put t mmss19.; put t mmss19.5; put t1 mmss.;run;
Which produces the following output in the log
0:00 0:00 0:00.0000060:01
MMYYw.This format converts a numeric date into a nnMyyyy form where nn is the month number.
min max defaultVariable width 5 32 7
Exampledata _null_; d=19995; put d mmyy8.; put d mmyy7.; put d mmyy5.;run;
Which produces the following output in the log:
09M201409M201409M14
MMYYCw.This format converts a numeric date into a MM:YY or MM:YYYY form.
min max defaultVariable width 5 32 7
Reference for language elementsVersion 3.3
206
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "5 " d mmyyc5.; put explanation "7 " d mmyyc7.; put explanation "8 " d mmyyc8.;run;
Which produces the following output in the log:
Output length: 5 09:14Output length: 7 09:2014Output length: 8 09:2014
MMYYDw.This format converts a numeric date into a MM-YY or MM-YYYY form.
min max defaultVariable width 5 32 7
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "5 " d mmyyd5.; put explanation "7 " d mmyyd7.; put explanation "8 " d mmyyd8.;run;
Which produces the following output in the log:
Output length: 5 09-14Output length: 7 09-2014Output length: 8 09-2014
MMYYNw.This format converts a numeric date into a MMYY or MMYYYY form.
min max defaultVariable width 4 32 6
Reference for language elementsVersion 3.3
207
Exampledata _null_;d=19995;put d mmyyn8.;put d mmyyn7.;put d mmyyn6.;put d mmyyn5.;put d mmyyn4.;run;
Which produces the following output in the log:
092014 092014092014 09140914
MMYYPw.This format converts a numeric date into a MM.YY or MM.YYYY form.
min max defaultVariable width 5 32 7
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "5 " d mmyyp5.; put explanation "7 " d mmyyp7.;run;
Which produces the following output in the log:
Output length: 5 09.14Output length: 7 09.2014
MMYYSw.This format converts a numeric date into a MM/YY or MM/YYYY form.
min max defaultVariable width 5 32 7
Reference for language elementsVersion 3.3
208
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "5 " d mmyys5.; put explanation "7 " d mmyys7.;run;
Which produces the following output in the log:
Output length: 5 09/14Output length: 7 09/2014
MONNAMEw.This format converts a numeric date into a spelled-out month - sufficient output space must be availableif truncation is to be avoided. The output is not locale-sensitive – it always generates 'January','February' and so on.
min max defaultVariable width 1 32 9
Exampledata _null_; d=19995; put "Default: " d monname.; put "Output length 9: " d monname9.; run;
Which produces the following output in the log:
Default: SeptemberOutput length 9: September
MONTHw.This format extracts the month number from a numeric date.
min max defaultVariable width 1 32 2
Reference for language elementsVersion 3.3
209
Exampledata _null_;d=19995;put d month.;run;
Which produces the following output in the log:
9
MONYYw.This format converts a numeric date into a MMMYY or MMMYYYY format.
min max defaultVariable width 5 7 5
Exampledata _null_; d=19995; explanation = "Output length: "; put explanation "5 " d monyy5.; put explanation "7 " d monyy7.;run;
Which produces the following output in the log:
Output length: 5 SEP14Output length: 7 SEP2014
NENGOw.This format converts a numeric date into a Japanese date format including an initial era signifier.Variations in presentation depend on the specified output width.
min max defaultVariable width 2 10 8
Reference for language elementsVersion 3.3
210
Exampledata _null_; d=19995; put "Default: " d nengo.; put "Output length 5: " d nengo5.; put "Output length 10: " d nengo10.;run;
Which produces the following output in the log:
Default: H.260929Output length 5: H26 Output length 10: H.26/09/29
PDJULGw.This format converts a numeric date into a packed decimal representation of a Julian date.
min max defaultVariable width 3 16 4
Exampledata _null_;length s1 $ 8 s2 $ 16;do n = 19995; put n @; do w = 3,7,15; do d = 0; s1 = putn(n,'pdjulg',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': pdjulg' w +(-1) '.' d s2; end; end; end;run;
Which produces the following output in the log:
19995 : pdjulg3.0 99992F : pdjulg7.0 0000002014272F : pdjulg15.0 000000002014272F
Reference for language elementsVersion 3.3
211
PDJULIw.This format converts a numeric date into a packed decimal representation of a Julian date. When spacepermits, it also prepends a numeric representation of the century to the output, rebased to 1900.
min max defaultVariable width 3 16 4
Exampledata _null_;length s1 $ 8 s2 $ 16;do n = 19995, 50000; put n @; do w = 3,7,15; do d = 0; s1 = putn(n,'pdjuli',w,d); s2 = putc(s1,'$hex',w*2); put @20 ': pdjuli' w +(-1) '.' d s2; end; end; end;run;
Which produces the following output in the log:
19995 : pdjuli3.0 99992F : pdjuli7.0 0000000114272F : pdjuli15.0 000000000114272F50000 : pdjuli3.0 99997F : pdjuli7.0 0000000196327F : pdjuli15.0 000000000196327F
QTRw.This format converts a numeric date value into an integer representing the quarter in which the dateoccurs.
min max defaultVariable width 1 32 1
Exampledata _null_; n=19995; put n qtr.;run;
Reference for language elementsVersion 3.3
212
Which produces the following output in the log:
3
QTRRw.This format converts a numeric date value into a Roman numeral representing the quarter in which thedate occurs.
min max defaultVariable width 3 32 3
Exampledata _null_; n=19995; put n qtrr.;run;
Which produces the following output in the log:
III
TIMEw.dThis format converts a numeric time value into a representation of a time interval in HH:MM:SS format,with small variations according to the available space.
min max defaultVariable width 2 20 8
Exampledata _null_; d=19995; put "Default: " d time.; put "Output length 2: " d time2.; put "Output length 5: " d time5.;run;
Which produces the following output in the log:
Default: 5:33:15Output length 2: 5Output length 5: 5:33
Reference for language elementsVersion 3.3
213
TIMEAMPMw.dThis format converts a numeric time value into a representation of the time of day in HH:MM:SS AM orHH:MM:SS PM formats. Small variations adjust for the available space.
min max defaultVariable width 2 20 8
Exampledata _null_; n=3000; put "Default: " n timeampm.; put "Output length 5: " n timeampm5.; put "Output length 8: " n timeampm8.;run;
Which produces the following output in the log:
Default: 12:50:00 AMOutput length 5: 12 AMOutput length 8: 12:50 AM
TODw.dThis format converts a numeric time value into a representation of the time of day in HH:MM:SS formatusing the 24-hour clock.
min max defaultVariable width 2 20 8
Exampledata _null_;n=3000;put "Default: " n tod.;put "Output length 2: " n tod2.;put "Output length 4: " n tod4.;put "Output length 5: " n tod5.;put "Output length 7: " n tod7.;put "Output length 8: " n tod8.;run;
Reference for language elementsVersion 3.3
214
Which produces the following output in the log:
Default: 00:50:00Output length 2: 00Output length 4: 0:50Output length 5: 00:50Output length 7: 0:50:00Output length 8: 00:50:00
WEEKUw.Converts a numeric date value into a yyyy-Wxx-nn form, where xx is the number of the week in the yearstarting at 00, and nn is the number of the day within the week, starting with 01 on Sunday.
min max defaultVariable width 3 200 11
Exampledata _null_;n=19995;put n weeku.;run;
Which produces the following output in the log:
2014-W39-02
WEEKVw.Converts a numeric date value into an ISO week date yyyy-Wxx-nn format, where xx is the number ofthe week in the year starting at 01, and nn is the number of the day within the week, starting with 01 onMonday.
min max defaultVariable width 3 200 11
Exampledata _null_;n = 19995;put n weekv.;run
Reference for language elementsVersion 3.3
215
Which produces the following output in the log:
2014-W40-01
WEEKWw.Converts a numeric date value into a yyyy-Wxx-nn format, where xx is the number of the week in theyear starting at 00, and nn is the number of the day within the week, starting with 01 on Monday.
min max defaultVariable width 3 200 11
Exampledata _null_;n=19995;put n weekw.;run;
Which produces the following output in the log:
2014-W39-01
WEEKDATEw.Converts a numeric date into a spelled-out representation such as: Friday, January 1, 1960.
Variations will occur in relation to the available output space. It differs only slightly from the WEEKDATEformat, which displays typical output as: Friday, 1 January, 1960.
min max defaultVariable width 3 37 29
Exampledata _null_;n=19995;put n weekdate3.;put n weekdate13.;put n weekdate14.;put n weekdate21.;put n weekdate22.;put n weekdate29.;run;
Reference for language elementsVersion 3.3
216
Which produces the following output in the log:
Mon Monday Monday Mon, Sep 29, 2014 Mon, Sep 29, 2014 Monday, September 29, 2014
WEEKDATXw.Converts a numeric date into a spelled-out representation such as: Friday, 1 January, 1960.
The format differs only slightly from the WEEKDATE format, which displays typical output as: Friday,January 1, 1960.
min max defaultVariable width 3 37 29
Exampledata _null_; n=19995; put "Default output length: " n weekdatx.; put "Output length 15: " n weekdatx15.; put "Output length 17: " n weekdatx17.; put "Output length 23: " n weekdatx23.;run;
Which produces the following output in the log:
Default output length: Monday, 29 September 2014Output length 15: Mon, 29 Sep 14Output length 17: Mon, 29 Sep 2014Output length 23: Monday, 29 Sep 2014
WEEKDAYw.Converts a numeric date into a number representing the day of the week starting on Sunday.
min max defaultVariable width 1 32 1
Reference for language elementsVersion 3.3
217
Exampledata _null_;n=19995;put n weekday.;run;
Which produces the following output in the log:
2
WORDDATEw.Converts a numeric date into a spelled-out representation such as: January 1, 1960, with presentationalvariations according to the available output space.
The format differs only slightly from the WORDDATX format, in which the output takes the form: 29September 2014.
min max defaultVariable width 3 32 18
Exampledata _null_;n=19995;put n worddate3.;put n worddate13.;put n worddate14.;put n worddate21.;put n worddate22.;put n worddate29.;run;
Which produces the following output in the log:
Sep Sep 29, 2014 Sep 29, 2014 September 29, 2014 September 29, 2014 September 29, 2014
Reference for language elementsVersion 3.3
218
WORDDATXw.Converts a numeric date into a spelled-out representation such as: 1 January 1960, with presentationalvariations according to the available output space.
The format differs only slightly from the WORDDATE format, in which the output takes the form:September 29, 2014. This format is not locale-sensitive and the output will always be in English.
min max defaultVariable width 3 32 18
Exampledata _null_;n=19995;put n worddatx3.;put n worddatx13.;put n worddatx14.;put n worddatx21.;put n worddatx22.;put n worddatx29.;run;
Which produces the following output in the log:
Sep 29 Sep 2014 29 Sep 2014 29 September 2014 29 September 2014 29 September 2014
YEARw.Transforms a numeric date into a representation of the year.
min max defaultVariable width 2 32 4
Exampledata _null_;n=19995;put n year.;run;
Which produces the following output in the log:
2014
Reference for language elementsVersion 3.3
219
YYMMw.Transforms a numeric date into a yyyyMxx form, where xx is the month number.
min max defaultVariable width 5 32 7
Exampledata _null_;n=19995;put n yymm5.;put n yymm.;run;
Which produces the following output in the log:
14M092014M09
YYMMCw.Transforms a numeric date into a colon-separated YYYY:MM form, where MM is the month number.
min max defaultVariable width 5 32 7
Exampledata _null_;n=19995;put n yymmc5.;put n yymmc6.;put n yymmc7.;put n yymmc8.;put n yymmc9.;put n yymmc10.;put n yymmc11.;put n yymmc12.;run;
Reference for language elementsVersion 3.3
220
Which produces the following output in the log:
14:09 14:092014:09 2014:09 2014:09 2014:09 2014:09 2014:09
YYMMDw.Converts a numeric date into a dash-separated YYYY-MM form, where MM is the month number.
min max defaultVariable width 5 32 7
Exampledata _null_;n=19995;put n yymmd5.;put n yymmd6.;put n yymmd7.;put n yymmd8.;put n yymmd9.;put n yymmd10.;put n yymmd11.;put n yymmd12.;run;
Which produces the following output in the log:
14-09 14-092014-09 2014-09 2014-09 2014-09 2014-09 2014-09
YYMMNw.This format transforms a numeric date into a YYYYMM form.
min max defaultVariable width 4 32 6
Reference for language elementsVersion 3.3
221
Exampledata _null_;n=19995;put n yymmn4.;put n yymmn5.;put n yymmn6.;put n yymmn7.;put n yymmn8.;put n yymmn9.;put n yymmn10.;run;
Which produces the following output in the log:
1409 1409201409 201409 201409 201409 201409
YYMMPw.This format transforms a numeric date into a period-separated YYYY.MM form where MM is the monthnumber within the year.
min max defaultVariable width 5 32 7
Exampledata _null_; n=19995; put n yymmp5.; put n yymmp7.;run;
Which produces the following output in the log:
14.092014.09
Reference for language elementsVersion 3.3
222
YYMMSw.This format transforms a numeric date into a slash-separated YYYY/MM form where MM is the monthnumber within the year.
min max defaultVariable width 5 32 7
Exampledata _null_; n=19995; put n yymms5.; put n yymms7.;run;
Which produces the following output in the log:
14/092014/09
YYMMDDw.This format transforms a numeric date into a YY-MM-DD or YYYY-MM-DD form, depending on theavailable space.
min max defaultVariable width 2 10 8
Exampledata _null_; n=19995; put n yymmdd2.; put n yymmdd4.; put n yymmdd5.; put n yymmdd6.; put n yymmdd8.; put n yymmdd10.;run;
Which produces the following output in the log:
14140914-0914092914-09-292014-09-29
Reference for language elementsVersion 3.3
223
YYMMDDBw.Transforms a numeric date into a space-separated YY MM DD or YYYY MM DD form, depending onthe available space
min max defaultVariable width 2 10 8
Exampledata _null_;n=19995;put n yymmddb2.;put n yymmddb4.;put n yymmddb5.;put n yymmddb6.;put n yymmddb8.;put n yymmddb10.;run;
Which produces the following output in the log:
14140914 0914092914 09 292014 09 29
YYMMDDCw.Transforms a numeric date into a colon-separated YY:MM:DD or YYYY:MM:DD form, depending on theavailable space.
min max defaultVariable width 2 10 8
Exampledata _null_; n=19995; put n yymmddc2.; put n yymmddc4.; put n yymmddc5.; put n yymmddc6.; put n yymmddc8.; put n yymmddc10.;run;
Reference for language elementsVersion 3.3
224
Which produces the following output in the log:
14140914:0914092914:09:292014:09:29
YYMMDDDw.Transforms a numeric date into a dash-separated YY-MM-DD or YYYY-MM-DD form, depending on theavailable space.
min max defaultVariable width 2 10 8
Exampledata _null_;n=19995;put n yymmddd2.;put n yymmddd4.;put n yymmddd5.;put n yymmddd6.;put n yymmddd8.;put n yymmddd10.;run;
Which produces the following output in the log:
14140914-0914092914-09-292014-09-29
YYMMDDNw.Transforms a numeric date into a YYMMDD or YYYYMMDD form, depending on the available space.
min max defaultVariable width 2 8 8
Reference for language elementsVersion 3.3
225
Exampledata _null_; n=19995; put n yymmddn2.; put n yymmddn4.; put n yymmddn6.; put n yymmddn8.;run;
Which produces the following output in the log:
14140914092920140929
YYMMDDPw.Transforms a numeric date into a period-separated YY.MM.DD or YYYY.MM.DD form, depending onthe available space.
min max defaultVariable width 2 10 8
Exampledata _null_; n=19995; put n yymmddp2.; put n yymmddp4.; put n yymmddp5.; put n yymmddp6.; put n yymmddp8.; put n yymmddp10.;run;
Which produces the following output in the log:
14140914.0914092914.09.292014.09.29
Reference for language elementsVersion 3.3
226
YYMMDDSw.Transforms a numeric date into a slash-separated YY/MM/DD or YYYY/MM/DD form, depending on theavailable space.
min max defaultVariable width 2 10 8
Exampledata _null_; n=19995; put n yymmdds2.; put n yymmdds4.; put n yymmdds5.; put n yymmdds6.; put n yymmdds8.; put n yymmdds10.;run;
Which produces the following output in the log:
14140914/0914092914/09/292014/09/29
YYMONw.Transforms a numeric date into a YYYYMMM form.
min max defaultVariable width 5 32 7
Exampledata _null_; n=19995; put n yymon5.; put n yymon7.;run;
Which produces the following output in the log:
14SEP2014SEP
Reference for language elementsVersion 3.3
227
YYQw.Transforms a numeric date into a YYYYQxx form, where xx is the quarter in which the original datefalls.
min max defaultVariable width 4 32 6
Exampledata _null_; n=19995; put n yyq4.; put n yyq6.;run;
Which produces the following output in the log:
14Q32014Q3
YYQCw.Transforms a numeric date into a YYYY:Q form, where Q is the number of the quarter in which theoriginal date falls.
min max defaultVariable width 4 32 6
Exampledata _null_; n=19995; put n yyqc4.; put n yyqc6.; run;
Which produces the following output in the log:
14:32014:3
Reference for language elementsVersion 3.3
228
YYQDw.Tansforms a numeric date into a YYYY-Q form, where Q is the number of the quarter in which theoriginal date falls.
min max defaultVariable width 4 32 6
Exampledata _null_; n=19995; put n yyqd4.; put n yyqd6.;run;
Which produces the following output in the log:
14-32014-3
YYQNw.Converts a numeric date into a YYYYQ form, where Q is the number of the quarter in which the originaldate falls.
min max defaultVariable width 3 32 5
Exampledata _null_; n=19995; put n yyqn.;run;
Which produces the following output in the log:
20143
Reference for language elementsVersion 3.3
229
YYQPw.Transforms a numeric date into a YYYY.Q form, where Q is the number of the quarter in which the datefalls.
min max defaultVariable width 4 32 6
Exampledata _null_; n=19995; put n yyqp.;run;
Which produces the following output in the log:
2014.3
YYQRw.Converts a numeric date into a YYYYQr form, where r is the Roman numeral representation of thequarter in which the original date falls.
min max defaultVariable width 6 32 8
Exampledata _null_;n=19995;put n yyqr.;run;
Which produces the following output in the log:
2014QIII
Reference for language elementsVersion 3.3
230
YYQSw.Transforms a numeric date into a YYYY/Q form, where Q is the number of the quarter in which theoriginal date falls.
min max defaultVariable width 4 32 6
Exampledata _null_; n=19995; put n yyqs.;run;
Which produces the following output in the log:
2014/3
YYQRCw.Transforms a numeric date into a YYYY:r form, where r is the Roman numeral representation of thenumber of the quarter in which the date falls.
min max defaultVariable width 6 32 8
Exampledata _null_; n=19995; put n yyqrc.;run;
Which produces the following output in the log:
2014:III
Reference for language elementsVersion 3.3
231
YYQRDw.Converts a numeric date into a YYYY-r form, where r is the Roman numeral representation of thenumber of the quarter in which the date falls.
min max defaultVariable width 6 32 8
Exampledata _null_; n=19995; put n yyqrd.;run;
Which produces the following output in the log:
2014-III
YYQRNw.Transforms a numeric date into a YYYYr form, where r is the Roman numeral representation of thenumber of the quarter in which the date falls.
min max defaultVariable width 5 32 7
Exampledata _null_; n=19995; put n yyqrn.;run;
Which produces the following output in the log:
2014III
Reference for language elementsVersion 3.3
232
YYQRPw.Transforms a numeric date into a YYYY.r form, where r is the Roman numeral representation of thenumber of the quarter in which the date falls.
min max defaultVariable width 6 32 8
Exampledata _null_; n=19995; put n yyqrp.;run;
Which produces the following output in the log:
2014.III
YYQRSw.Transforms a numeric date into a YYYY/r form, where r is the Roman numeral representation of thenumber of the quarter in which the date falls.
min max defaultVariable width 6 32 8
Exampledata _null_; n=19995; put n yyqrs.;run;
Which produces the following output in the log:
2014/III
YYWEEKUw.Transforms a numeric date into a YYYYWxx or YYYY-Wxx form, where xx is the week number.
min max defaultVariable width 3 8 7
Reference for language elementsVersion 3.3
233
Exampledata _null_; n=19995; put n yyweeku.; put n yyweeku8.;run;
Which produces the following output in the log:
2014W392014-W39
YYWEEKVw.Converts a numeric date value into an ISO week date YYYYWxx or YYYY-Wxx form, where xx is thenumber of the week in the year starting at 01.
min max defaultVariable width 3 8 7
Exampledata _null_; n=19995; put n yyweekv.; put n yyweekv8.;run;
Which produces the following output in the log:
2014W402014-W40
YYWEEKWw.Converts a numeric date value into a YYYYWxx or YYYY-Wxx form, where xx is the number of theweek in the year starting at 00.
min max defaultVariable width 3 8 7
Reference for language elementsVersion 3.3
234
Exampledata _null_; n=19995; put n yyweekw.; put n yyweekw8.;run;
Which produces the following output in the log:
2014W392014-W39
ISO8601 date formatsFormats that represent date-time data according to the ISO 8601 standard.
$N8601Bw.Taking input in an encoded form (an internal representation), this format generates datetimes, durationsand intervals as ISO 8601 basic forms PnYnMnDTnHnMnS and yyyymmddThhmmss.
min max defaultVariable width 1 200 55
ExampleIn the following example, the DATA step function is8601_convert is used to convert sample textualdata to an encoded form prior to it being transformed by the format itself.
data _null_; length dur $25;length datim $25;length intval $50;beg='02jan2012:11:30:21'dt;fin='08apr2014:13:32:22'dt;call is8601_convert('dt/dt','du',beg,fin,dur);call is8601_convert('dt','dt',beg,datim);call is8601_convert('dt/dt', 'intvl', beg, fin, intval);put dur=$n8601b50.;put datim=$n8601b50.;put intval=$n8601b50.;run;
Which produces the following output in the log:
dur=P2Y3M6DT2H2M1Sdatim=20120102T113021intval=20120102T113021/20140408T133222
Reference for language elementsVersion 3.3
235
$N8601BAw.Taking input in an encoded form (i.e. an internal representation), this format generates datetimes,durations and intervals as ISO 8601 forms PyyyymmddThhmmss and yyyymmddThhmmss.
min max defaultVariable width 1 200 55
ExampleIn the example below, the DATA step function is8601_convert is used to convert sample textualdata to an encoded form prior to it being transformed by the format itself.
data _null_; length dur $25;length datim $25;length intval $50;beg='02jan2012:11:30:21'dt;fin='08apr2014:13:32:22'dt;call is8601_convert('dt/dt','du',beg,fin,dur);call is8601_convert('dt','dt',beg,datim);call is8601_convert('dt/dt', 'intvl', beg, fin, intval);put dur=$n8601ba50.;put datim=$n8601ba50.;put intval=$n8601ba50.;run;
Which produces the following output in the log:
dur=P00020306T020201datim=20120102T113021intval=20120102T113021/20140408T133222
$N8601Ew.Taking input in an encoded form (an internal representation), this format generates datetimes, durationsand intervals as ISO 8601 forms PnYnMnDTnHnMnS and yyyy-mmddThh:mm:ss.
min max defaultVariable width 1 200 55
Reference for language elementsVersion 3.3
236
ExampleIn the example below, the DATA step function is8601_convert is used to convert sample textualdata to an encoded form prior to it being transformed by the format itself.
data _null_; length dur $25;length datim $25;length intval $50;beg='02jan2012:11:30:21'dt;fin='08apr2014:13:32:22'dt;call is8601_convert('dt/dt','du',beg,fin,dur); /* Convert to a duration */call is8601_convert('dt','dt',beg,datim); /* Convert to a datetime */call is8601_convert('dt/dt', 'intvl', beg, fin, intval); /* Convert to an interval */put dur=$n8601e50.;put datim=$n8601e50.;put intval=$n8601e50.;run;
Which produces the following output in the log:
dur=P2Y3M6DT2H2M1Sdatim=2012-01-02T11:30:21intval=2012-01-02T11:30:21/2014-04-08T13:32:22
$N8601EAw.Taking input in an encoded form (an internal representation), this format generates datetimes, durationsand intervals as ISO 8601 forms Pyyyy-mm-ddThh:mm:ss and yyyy-mm-ddThh:mm:ss.
min max defaultVariable width 1 200 55
ExampleIn the example below, the DATA step function is8601_convert is used to convert sample textualdata to an encoded form prior to it being transformed by the format itself.
data _null_; length dur $25;length datim $25;length intval $50;beg='02jan2012:11:30:21'dt;fin='08apr2014:13:32:22'dt;call is8601_convert('dt/dt','du',beg,fin,dur);call is8601_convert('dt','dt',beg,datim);call is8601_convert('dt/dt', 'intvl', beg, fin, intval);put dur=$n8601ea50.;put datim=$n8601ea50.;put intval=$n8601ea50.;run;
Reference for language elementsVersion 3.3
237
Which produces the following output in the log:
dur=P0002-03-06T02:02:01datim=2012-01-02T11:30:21intval=2012-01-02T11:30:21/2014-04-08T13:32:22
$N8601EHw.Taking input in an encoded form (an internal representation), this format generates datetimes, durationsand intervals as ISO 8601 forms Pyyyy-mm-ddThh:mm:ss and yyyy-mm-ddThh:mm:ss. This is thesame as the $N8601EAw. format, except that it uses a hyphen for missing components.
min max defaultVariable width 1 200 55
ExampleIn the following example below, the DATA step function is8601_convert is used to convert sampletextual data to an encoded form prior to it being transformed by the format itself.
data _null_; length dur $25;length datim $25;length intval $50;beg='02jan2012:11:30'dt;fin='08apr2014:13:32'dt;call is8601_convert('dt/dt','du',beg,fin,dur);call is8601_convert('dt','dt',beg,datim);call is8601_convert('dt/dt', 'intvl', beg, fin, intval);put dur=$n8601eh50.;put datim=$n8601eh50.;put intval=$n8601eh50.;run;
Which produces the following output in the log:
dur=P0002-03-06T02:02:-datim=2012-01-02T11:30:00intval=2012-01-02T11:30:00/2014-04-08T13:32:00
Reference for language elementsVersion 3.3
238
$N8601EXw.Taking input in an encoded form (an internal representation), this format generates datetimes, durationsand intervals as ISO 8601 forms Pyyyy-mm-ddThh:mm:ss and yyyy-mm-ddThh:mm:ss. This is thesame as the $N8601EAw. format, except that it uses x for each digit of a missing component.
min max defaultVariable width 1 200 55
ExampleIn the example below, the DATA step function is8601_convert is used to convert sample textualdata to an encoded form prior to it being transformed by the format itself.
data _null_; length dur $25;length datim $25;length intval $50;beg='02jan2012:11:30'dt;fin='08apr2014:13:32'dt;call is8601_convert('dt/dt','du',beg,fin,dur);call is8601_convert('dt','dt',beg,datim);call is8601_convert('dt/dt', 'intvl', beg, fin, intval);put dur=$n8601ex50.;put datim=$n8601ex50.;put intval=$n8601ex50.;run;
Which produces the following output in the log
dur=P0002-03-06T02:02:xdatim=2012-01-02T11:30:00intval=2012-01-02T11:30:00/2014-04-08T13:32:00
$N8601Hw.Taking input in an encoded form (i.e. an internal representation), this format generates datetimes,durations and intervals as ISO 8601 forms Pyyyy-mm-ddThh:mm:ss and yyyy-mm-ddThh:mm:ss.
This format is the same as the $N8601EAw. format, except that it suppresses omitted components indurations and uses a hyphen for omitted components in datetime values.
min max defaultVariable width 1 200 55
Reference for language elementsVersion 3.3
239
ExampleIn the following example below, the DATA step function is8601_convert is used to convert sampletextual data to an encoded form prior to it being transformed by the format itself.
data _null_; length dur $25;length datim $25;length intval $50;beg='02jan2012:11:30'dt;fin='08apr2014:13:32'dt;call is8601_convert('dt/dt','du',beg,fin,dur);call is8601_convert('dt','dt',beg,datim);call is8601_convert('dt/dt', 'intvl', beg, fin, intval);put dur=$n8601h50.;put datim=$n8601h50.;put intval=$n8601h50.;run;
Which produces the following output in the log:
dur=P2Y3M6DT2H2M-Sdatim=2012-01-02T11:30:00intval=2012-01-02T11:30:00/2014-04-08T13:32:00
$N8601Xw.Taking input in an encoded form (i.e. an internal representation), this format generates datetimes,durations and intervals as ISO 8601 forms Pyyyy-mm-ddThh:mm:ss and yyyy-mm-ddThh:mm:ss.
This format is the same as the $N8601EAw. format, except that it drops omitted components indurations and uses an x for each digit of an omitted component in datetime values.
min max defaultVariable width 1 200 55
Reference for language elementsVersion 3.3
240
ExampleIn the following example, the DATA step function is8601_convert is used to convert sample textualdata to an encoded form prior to it being transformed by the format itself.
data _null_; length dur $25;length datim $25;length intval $50;beg='02jan2012:11:30'dt;fin='08apr2014:13:32'dt;call is8601_convert('dt/dt','du',beg,fin,dur);call is8601_convert('dt','dt',beg,datim);call is8601_convert('dt/dt', 'intvl', beg, fin, intval);put dur=$n8601x50.;put datim=$n8601x50.;put intval=$n8601x50.;run;
Which produces the following output in the log:
dur=P2Y3M6DT2H2MxSdatim=2012-01-02T11:30:00intval=2012-01-02T11:30:00/2014-04-08T13:32:00
B8601DAw.Converts a numeric date into a basic ISO 8601 YYYYMMDD form.
min max defaultVariable width 10 10 10
Exampledata _null_; d = 19995;put d b8601da10.;run;
Which produces the following output in the log:
20140929
Reference for language elementsVersion 3.3
241
E8601DAw.Converts a numeric date into an extended ISO 8601 YYYY-MM-DD form.
min max defaultVariable width 10 10 10
Exampledata _null_; d=19995;put d e8601da.;run;
Which produces the following output in the log:
2014-09-29
B8601DNw.Converts a numeric datetime into a basic ISO 8601 YYYYMMDD form.
This format extracts and writes the date from the specified numeric datetime,omitting the timecomponent.
min max defaultVariable width 10 10 10
Exampledata _null_; d = 1727610480;put d b8601dn.;run;
Which produces the following output in the log:
20140929
E8601DNw.Converts a numeric datetime into an extended ISO 8601 YYYY-MM-DD form.
This format extracts and writes the date from the specified numeric datetime, omitting the timecomponent.
Reference for language elementsVersion 3.3
242
min max defaultVariable width 10 10 10
Exampledata _null_; d = 1727610480;put d e8601dn10.;run;
Which produces the following output in the log:
2014-09-29
B8601DTw.dConverts a numeric datetime into a basic ISO 8601 YYYYMMDDTHHMMSS datetime form.
min max defaultVariable width 19 26 19
Exampledata _null_; d = 1727610480;put d b8601dt.;run;
Which produces the following output in the log:
20140929T114800
E8601DTw.dConverts a numeric datetime into an extended ISO 8601 YYYY-MM-DDTHH:MM:SS datetime form.
min max defaultVariable width 19 26 19
Exampledata _null_; d = 1727610480;put d e8601dt.;run;
Reference for language elementsVersion 3.3
243
Which outputs te following in the log:
2014-09-29T11:48:00
B8601DZw.Converts a numeric datetime into a UTC ISO 8601 YYYYMMDDTHHMMSS+|=HHMM datetime andtimezone form.
min max defaultVariable width 20 35 26
Exampledata _null_; d = 1727610480;put d b8601dz35.;run;
Which produces the following output in the log:
20140929T114800+0000
E8601DZw.Converts a numeric datetime into an extended UTC ISO 8601 YYYY-MM-DDTHH:MM:SS+|-HH:MMdatetime and timezone form.
The SAS language does not have any concept of 'timezone', the timezone is either printed 00:00 or 'Z'for 'zulu'.
min max defaultVariable width 20 35 26
Exampledata _null_; d = 1727610480;put d e8601dz35.;run;
Which produces the following output in the log:
2014-09-29T11:48:00+00:00
Reference for language elementsVersion 3.3
244
B8601LZw.Converts a numeric time into the basic ISO 8601 form: HHMMSS+|-HHMM, by writing the time and atime-zone offset.
min max defaultVariable width 9 20 14
Exampledata _null_; d = 3000;put d b8601lz.;run;
Which produces the following output in the log:
005000+0100
E8601LZw.Converts a numeric time into the extended ISO 8601 form: HH:MM:SS+|-HH:MM, by writing the timeand a time-zone offset.
min max defaultVariable width 9 20 14
Exampledata _null_; d = 3000;put d e8601lz.;run;
Which produces the following output in the log:
00:50:00+01:00
B8601TMw.dConverts a numeric time into the basic ISO 8601 form: HHMMSS.
min max defaultVariable width 6 15 8
Reference for language elementsVersion 3.3
245
Exampledata _null_; d = 3000;put d b8601tm.;run;
Which produces the following output in the log:
005000
E8601TMw.dConverts a numeric time into the extended ISO 8601 form: HH:MM:SS.
min max defaultVariable width 8 15 8
Exampledata _null_; d = 3000;put d e8601tm.;run;
Which produces the following output in the log:
00:50:00
B8601TZw.Converts a numeric time to UTC and writes it using the ISO 8601 basic time notation HHMMSS+|-HHMM.
min max defaultVariable width 7 20 14
Exampledata _null_; d = 3000;put d b8601tz.;run;
Which produces the following output in the log:
005000+0000
Reference for language elementsVersion 3.3
246
E8601TZw.Converts a numeric time to UTC and writes it using the ISO 8601 extended time notation HH:MM:SS+|-HH:MM.
min max defaultVariable width 9 20 14
Exampledata _null_; d = 3000;put d e8601tz.;run;
Which produces the following output in the log:
00:50:00+00:00
IS8601DAw.Converts a numeric date into an extended ISO 8601 YYYY-MM-DD form.
This format is an alias of E8601DAw.
min max defaultVariable width 10 10 10
Exampledata _null_; d = 19995;put d is8601da.;run;
Which produces the following output in the log.
2014-09-29
IS8601DNw.Converts a numeric datetime into an extended ISO 8601 YYYY-MM-DD form - it extracts and writes thedate from the specified numeric datetime, omitting the time component.
This format is an alias of E8601DNw.
Reference for language elementsVersion 3.3
247
min max defaultVariable width 10 10 10
Exampledata _null_; d = 1727610480;put d is8601dn.;run;
Which produces the following output in the log:
2014-09-29
IS8601LZw.Converts a numeric time into the extended ISO 8601 form: HH:MM:SS+|-HH:MM, by writing the timeand a time-zone offset.
This format is an alias of E8601LZw.
min max defaultVariable width 9 20 14
Exampledata _null_; d=3000;put d is8601lz.;run;
Which produces the following output in the log:
00:50:00+01:00
IS8601TMw.dConverts a numeric time into the extended ISO 8601 form: HH:MM:SS.
This format is an alias of E8601TMw.d.
min max defaultVariable width 8 15 8
Reference for language elementsVersion 3.3
248
Exampledata _null_; d=3000;put d is8601tm.;run;
Which produces the following output in the log:
00:50:00
IS8601TZw.Converts a numeric time to UTC, writing it using the ISO 8601 extended time notation HH:MM:SS+|-HH:MM.
This format is an alias of E8601TZw.
min max defaultVariable width 9 20 14
Exampledata _null_; d=3000;put d is8601tz.;run;
Which produces the following output in the log:
00:50:00+00:00
IS8601DTw.dConverts a numeric datetime into an extended ISO 8601 YYYY-MM-DDTHH:MM:SS datetime form.
This format is an alias of E8601DTw.d.
min max defaultVariable width 19 26 19
Exampledata _null_; d=1727610480;put d is8601dt.;run;
Reference for language elementsVersion 3.3
249
Which produces the following output in the log:
2014-09-29T11:48:00
IS8601DZw.Converts a numeric datetime into an extended UTC ISO 8601 YYYY-MM-DDTHH:MM:SS+|=HH:MMdatetime and timezone form.
This format is an alias of E8601DZw.
min max defaultVariable width 20 35 26
Exampledata _null_; d=1727610480;put d is8601dz.;run;
Which produces the following output in the log:
2014-09-29T11:48:00+00:00
International date formatsFormats that represent date-time data in a specified language.
HDATEw.Converts a numeric date into a Hebrew form, using the default 'Long Date' and 'Medium Date' patternsfor the locale, resulting in an output form of d MMM y, with variations as imposed by the availablespace.
When displayed, it may appear rearranged in the output log according to whether or not the configuredlocale embodies left-to-right or right-to-left reading conventions. See http://demo.icu-project.org/icu-bin/locexp?d_=en&_=he_IL for further information about Hebrew date formats.
min max defaultVariable width 9 17 17
Reference for language elementsVersion 3.3
250
Exampledata _null_; d=19995;put d hdate17.;r=put(d, hdate17.);put r $hex.;run;
Which produces the following output in the log:
בספט 2014 29323920D791D7A1D7A4D798203230313420
HEBDATEw.Converts a numeric date into a form consistent with the Hebrew calendar.
min max defaultVariable width 11 45 16
Exampledata _null_; d=19995; put d hebdate20.; put d hebdate25.; put d hebdate34.; put d hebdate45.;run;
Which produces the following output in the log:
ה׳/א׳/תשע״הה׳ תשרי תשע״ה ה׳ תשרי תשע״ה שני ה׳ תשרי ה׳ תשע״ה
xxxDFDDw.Converts a numeric date into a form that contains the same calendar elements as DDMMYY, in aspecific target language/dialect.
xxx denotes the target language/dialect and is specified using one of:
• AFR for Afrikaans• CAT for Catalan• CRO for Croatian
Reference for language elementsVersion 3.3
251
• CSY for Czech• DAN for Danish• DES for Swiss_German• DEU for German• ENG for English• ESP for Spanish• FIN for Finnish• FRA for French• FRS for Swiss_French• HUN for Hungarian• ITA for Italian• MAC for Macedonian• NLD for Dutch• NOR for Norwegian• POL for Polish• PTG for Portuguese• RUS for Russian• SLO for Slovenian• SVE for Swedish
The EURDFDDw. format does not indicate any specific language. Instead, it lets you set the language ofthe format by using a system option, DFLANG.
min max defaultOutput widths for alllanguages/dialects exceptthose listed below
2 10 8
English 2 10 10Finnish 2 10 10
Reference for language elementsVersion 3.3
252
Exampledata _null_;d=0;put "AFR " d afrdfdd10.;put "CAT " d catdfdd10.;put "CRO " d crodfdd10.;put "CSY " d csydfdd10.;put "DAN " d dandfdd10.;put "DES " d desdfdd10.;put "DEU " d deudfdd10.;put "ENG " d engdfdd10.;put "ESP " d espdfdd10.;put "FIN " d findfdd10.;put "FRA " d fradfdd10.;put "FRS " d frsdfdd10.;put "HUN " d hundfdd10.;put "ITA " d itadfdd10.;put "MAC " d macdfdd10.;put "NLD " d nlddfdd10.;put "NOR " d nordfdd10.;put "POL " d poldfdd10.;put "PTG " d ptgdfdd10.;put "RUS " d rusdfdd10.;put "SLO " d slodfdd10.;put "SVE " d svedfdd10.;run;
Which produces the following output in the log:
AFR 01.01.1960CAT 01/01/1960CRO 01.01.1960CSY 01/01/1960DAN 01.01.1960DES 01.01.1960DEU 01.01.1960ENG 01.01.1960ESP 01.01.1960FIN 01.01.1960FRA 01/01/1960FRS 01/01/1960HUN 60.1.1.ITA 01/01/1960MAC 01.01.1960NLD 01-01-1960NOR 01.01.1960POL 01-01-1960PTG 01/01/1960RUS 01.01.1960SLO 01.01.1960SVE 01.01.1960
Reference for language elementsVersion 3.3
253
xxxDFDEw.Converts a numerical date into a form that contains the same calendar elements as DATE, in a specifictarget language/dialect.
xxx denotes the target language/dialect and is specified using one of:
• AFR for Afrikaans• CAT for Catalan• CRO for Croatian• CSY for Czech• DAN for Danish• DES for Swiss_German• DEU for German• ENG for English• ESP for Spanish• FIN for Finnish• FRA for French• FRS for Swiss_French• HUN for Hungarian• ITA for Italian• MAC for Macedonian• NLD for Dutch• NOR for Norwegian• POL for Polish• PTG for Portuguese• RUS for Russian• SLO for Slovenian• SVE for Swedish
The EURDFDEw. format does not indicate any specific language. Instead, it lets you set the language ofthe format by using a system option, DFLANG.
min max defaultOutput widths for alllanguages/dialects exceptthose listed below
5 9 7
Czech 10 14 12Finnish 9 10 9Hungarian 12 14 12
Reference for language elementsVersion 3.3
254
Exampledata _null_;d=0;put "AFR " d afrdfde9.;put "CAT " d catdfde9.;put "CRO " d crodfde9.;put "CSY " d csydfde10.;put "DAN " d dandfde9.;put "DES " d desdfde9.;put "DEU " d deudfde9.;put "ENG " d engdfde9.;put "ESP " d espdfde9.;put "FIN " d findfde9.;put "FRA " d fradfde9.;put "FRS " d frsdfde9.;put "HUN " d hundfde12.;put "ITA " d itadfde9.;put "MAC " d macdfde9.;put "NLD " d nlddfde9.;put "NOR " d nordfde9.;put "POL " d poldfde9.;put "PTG " d ptgdfde9.;put "RUS " d rusdfde9.; put "SLO " d slodfde9.;put "SVE " d svedfde9.;run;
Which produces the following output in the log:
AFR 01Jan1960CAT 01Gen1960CRO 01sij1960CSY 01leden60DAN 01jan1960DES 01Jan1960DEU 01Jan1960ENG 01JAN1960ESP 01ene1960FIN 1.1.-60FRA 01jan1960FRS 01jan1960HUN 60.jan.1.ITA 01Gen1960MAC 01jan1960NLD 01jan1960NOR 01jan1960POL 01sty1960PTG 01jan1960/* Server encoding of WCYRILLIC required for RUSDFWKX */RUS 01Янв1960SLO 01jan1960SVE 01jan1960
Reference for language elementsVersion 3.3
255
xxxDFDNw.Converts a numerical date into a form that contains the same calendar elements as WEEKDAY (that is,a number representing the day of the week), in a specific target language/dialect.
xxx denotes the target language/dialect and is specified using one of:
• AFR for Afrikaans• CAT for Catalan• CRO for Croatian• CSY for Czech• DAN for Danish• DES for Swiss_German• DEU for German• ENG for English• ESP for Spanish• FIN for Finnish• FRA for French• FRS for Swiss_French• HUN for Hungarian• ITA for Italian• MAC for Macedonian• NLD for Dutch• NOR for Norwegian• POL for Polish• PTG for Portuguese• RUS for Russian• SLO for Slovenian• SVE for Swedish
The EURDFDNw. format does not indicate any specific language. Instead, it lets you set the language ofthe format by using a system option, DFLANG.
min max defaultVariable width 1 32 1
Reference for language elementsVersion 3.3
256
Exampledata _null_;d=0;put "AFR " d afrdfdn9.;put "CAT " d catdfdn9.;put "CRO " d crodfdn9.;put "CSY " d csydfdn9.;put "DAN " d dandfdn9.;put "DES " d desdfdn9.;put "DEU " d deudfdn9.;put "ENG " d engdfdn9.;put "ESP " d espdfdn9.;put "FIN " d findfdn9.;put "FRA " d fradfdn9.;put "FRS " d frsdfdn9.;put "HUN " d hundfdn9.;put "ITA " d itadfdn9.;put "MAC " d macdfdn9.;put "NLD " d nlddfdn9.;put "NOR " d nordfdn9.;put "POL " d poldfdn9.;put "PTG " d ptgdfdn9.;put "RUS " d rusdfdn9.; put "SLO " d slodfdn9.;put "SVE " d svedfdn9.;run;
Which produces the following output in the log:
AFR 5CAT 5CRO 5CSY 5DAN 5DES 5DEU 5ENG 5ESP 5FIN 5FRA 5FRS 5HUN 5ITA 5MAC 5NLD 5NOR 5POL 5PTG 5RUS 5SLO 5SVE 5
Reference for language elementsVersion 3.3
257
xxxDFDTw.Converts a numerical date into a form that contains the same calendar elements as DATETIME, inaspecific target language/dialect.
xxx denotes the target language/dialect and is specified using one of:
• AFR for Afrikaans• CAT for Catalan• CRO for Croatian• CSY for Czech• DAN for Danish• DES for Swiss_German• DEU for German• ENG for English• ESP for Spanish• FIN for Finnish• FRA for French• FRS for Swiss_French• HUN for Hungarian• ITA for Italian• MAC for Macedonian• NLD for Dutch• NOR for Norwegian• POL for Polish• PTG for Portuguese• RUS for Russian• SLO for Slovenian• SVE for Swedish
The EURDFDTw. format does not indicate any specific language. Instead, it lets you set the language ofthe format by using a system option, DFLANG.
min max defaultOutput widths for alllanguages/dialects exceptthose listed below
7 40 16
Czech 12 40 21Hungarian 12 40 19
Reference for language elementsVersion 3.3
258
Exampledata _null_;d=0;put "AFR " d afrdfdt20.;put "CAT " d catdfdt20.;put "CRO " d crodfdt20.;put "CSY " d csydfdt20.;put "DAN " d dandfdt20.;put "DES " d desdfdt20.;put "DEU " d deudfdt20.;put "ENG " d engdfdt20.;put "ESP " d espdfdt20.;put "FIN " d findfdt20.;put "FRA " d fradfdt20.;put "FRS " d frsdfdt20.;put "HUN " d hundfdt20.;put "ITA " d itadfdt20.;put "MAC " d macdfdt20.;put "NLD " d nlddfdt20.;put "NOR " d nordfdt20.;put "POL " d poldfdt20.;put "PTG " d ptgdfdt20.;put "RUS " d rusdfdt20.; put "SLO " d slodfdt20.;put "SVE " d svedfdt20.;run;
Which produces the following output in the log:
AFR 01Jan1960:00:00:00CAT 01Gen1960:00:00:00CRO 01sij1960:00:00:00CSY 01leden60:00:00:00DAN 01jan1960:00:00:00DES 01Jan1960:00:00:00DEU 01Jan1960:00:00:00ENG 01JAN1960:00:00:00ESP 01ene1960:00:00:00FIN 1.1.1960:00:00:00FRA 01jan1960:00:00:00FRS 01jan1960:00:00:00HUN 60.jan.1. 00:00:00ITA 01Gen1960:00:00:00MAC 01jan1960:00:00:00NLD 01jan1960:00:00:00NOR 01jan1960:00:00:00POL 01sty1960:00:00:00PTG 01jan1960:00:00:00/* Server encoding of WCYRILLIC required for RUSDFWKX */RUS 01Янв1960:00:00:00SLO 01jan1960:00:00:00SVE 01jan1960:00:00:00
Reference for language elementsVersion 3.3
259
xxxDFDWNw.Converts a numerical date into a form that contains the same calendar elements as DOWNAME (thatis, the name of the day of the week), into a specific language/dialect.
xxx denotes the target language/dialect and is specified using one of:
• AFR for Afrikaans• CAT for Catalan• CRO for Croatian• CSY for Czech• DAN for Danish• DES for Swiss_German• DEU for German• ENG for English• ESP for Spanish• FIN for Finnish• FRA for French• FRS for Swiss_French• HUN for Hungarian• ITA for Italian• MAC for Macedonian• NLD for Dutch• NOR for Norwegian• POL for Polish• PTG for Portuguese• RUS for Russian• SLO for Slovenian• SVE for Swedish
The EURDFDWNw. format does not indicate any specific language. Instead, it lets you set the languageof the format by using a system option, DFLANG.
min width max width default widthOutput widths for alllanguages/dialects exceptthose listed below
1 32 9
Croatian 1 32 10Czech 1 32 7Danish 1 32 7
Reference for language elementsVersion 3.3
260
min width max width default widthSwiss_German 1 32 10German 1 32 10English 1 32 11Finnish 1 32 11French 1 32 8Macedonian 1 32 10Norwegian 1 32 7Polish 1 32 12Russian 1 32 11Swedish 1 32 7
Exampledata _null_;d=0;put "AFR " d afrdfdwn20.;put "CAT " d catdfdwn20.;put "CRO " d crodfdwn20.;put "CSY " d csydfdwn20.;put "DAN " d dandfdwn20.;put "DES " d desdfdwn20.;put "DEU " d deudfdwn20.;put "ENG " d engdfdwn20.;put "ESP " d espdfdwn20.;put "FIN " d findfdwn20.;put "FRA " d fradfdwn20.;put "FRS " d frsdfdwn20.;put "HUN " d hundfdwn20.;put "ITA " d itadfdwn20.;put "MAC " d macdfdwn20.;put "NLD " d nlddfdwn20.;put "NOR " d nordfdwn20.;put "POL " d poldfdwn20.;put "PTG " d ptgdfdwn20.;put "RUS " d rusdfdwn20.; put "SLO " d slodfdwn20.;put "SVE " d svedfdwn20.;run;
Which produces the following output in the log:
AFR VrydagCAT DivendresCRO petakCSY ptekDAN fredagDES FreitagDEU FreitagENG FridayESP viernesFIN Perjantai
Reference for language elementsVersion 3.3
261
FRA VendrediFRS VendrediHUN péntekITA VenerdMAC petokNLD vrijdagNOR fredagPOL pitekPTG Sexta-feira/* Server encoding of WCYRILLIC required for RUSDFWKX */RUS Пятница SLO petekSVE Fredag
xxxDFMNw.Converts a numerical date into a form that contains the same calendar elements as MONNAME (that is,the name of the month), into a specific language/dialect.
xxx denotes the target language/dialect and is specified using one of:
• AFR for Afrikaans• CAT for Catalan• CRO for Croatian• CSY for Czech• DAN for Danish• DES for Swiss_German• DEU for German• ENG for English• ESP for Spanish• FIN for Finnish• FRA for French• FRS for Swiss_French• HUN for Hungarian• ITA for Italian• MAC for Macedonian• NLD for Dutch• NOR for Norwegian• POL for Polish• PTG for Portuguese• RUS for Russian• SLO for Slovenian
Reference for language elementsVersion 3.3
262
• SVE for Swedish
min max defaultOutput widths for alllanguages/dialects exceptthose listed below
1 32 8
Afrikaans 1 32 9Danish 1 32 9Swiss German 1 32 9German 1 32 9English 1 32 11Spanish 1 32 10Finnish 1 32 11French 1 32 9Swiss French 1 32 9Hungarian 1 32 10Italian 1 32 9Macedonian 1 32 9Dutch 1 32 9Norwegian 1 32 9Polish 1 32 12Portuguese 1 32 9Slovenian 1 32 9
The EURDFMNw. format does not indicate any specific language. Instead, it lets you set the language ofthe format by using a system option, DFLANG.
Reference for language elementsVersion 3.3
263
Exampledata _null_;d=0;put "AFR " d afrdfmn20.;put "CAT " d catdfmn20.;put "CRO " d crodfmn20.;put "CSY " d csydfmn20.;put "DAN " d dandfmn20.;put "DES " d desdfmn20.;put "DEU " d deudfmn20.;put "ENG " d engdfmn20.;put "ESP " d espdfmn20.;put "FIN " d findfmn20.;put "FRA " d fradfmn20.;put "FRS " d frsdfmn20.;put "HUN " d hundfmn20.;put "ITA " d itadfmn20.;put "MAC " d macdfmn20.;put "NLD " d nlddfmn20.;put "NOR " d nordfmn20.;put "POL " d poldfmn20.;put "PTG " d ptgdfmn20.;put "RUS " d rusdfmn20.; put "SLO " d slodfmn20.;put "SVE " d svedfmn20.;run;
Which produces the following output in the log:
AFR JanuarieCAT GenerCRO sijeanjCSY ledenDAN januarDES JanuarDEU JanuarENG JanuaryESP eneroFIN tammikuutaFRA janvierFRS janvierHUN januárITA GennaioMAC januariNLD januariNOR januarPOL styczePTG janeiro/* Server encoding of WCYRILLIC required for RUSDFWKX */RUS ЯнварьSLO januarSVE januari
Reference for language elementsVersion 3.3
264
xxxDFMYw.Converts a numerical date into a form that contains the same calendar elements as MMMYY into aspecific language/dialect.
The language/dialect code in the following table replaces xxx in the format name. For example, toconvert to the default width Spanish, the format name is ESPDFDFMY5.
language/dialect min width max width default widthAfrikaans AFR 5 7 5Catalan CAT 5 32 5Croatian CRO 5 32 5Czech CSY 10 32 10Danish DAN 5 7 5Dutch NLD 5 7 5English ENG 5 7 5Finnish FIN 8 8 8French FRA 5 7 5Swiss French FRS 5 7 5German DEU 5 7 5Swiss German DES 5 7 5Hungarian HUN 9 32 9Italian ITA 5 7 5Macedonian MAC 5 32 5Norwegian NOR 5 7 5Polish POL 5 32 5Portuguese PTG 5 7 5Russian RUS 5 32 5Slovenian SLO 5 32 5Spanish ESP 5 7 5Swedish SVE 5 7 5
The EURDFMYw. format does not indicate any specific language. Instead, it lets you set the language ofthe format by using a system option, DFLANG.
Reference for language elementsVersion 3.3
265
Exampledata _null_;d=0;put "AFR " d afrdfmy.;put "CAT " d catdfmy.;put "CRO " d crodfmy.;put "CSY " d csydfmy.;put "DAN " d dandfmy.;put "DES " d desdfmy.;put "DEU " d deudfmy.;put "ENG " d engdfmy.;put "ESP " d espdfmy.;put "FIN " d findfmy.;put "FRA " d fradfmy.;put "FRS " d frsdfmy.;put "HUN " d hundfmy.;put "ITA " d itadfmy.;put "MAC " d macdfmy.;put "NLD " d nlddfmy.;put "NOR " d nordfmy.;put "POL " d poldfmy.;put "PTG " d ptgdfmy.;put "RUS " d rusdfmy.; put "SLO " d slodfmy.;put "SVE " d svedfmy.;run;
Which produces the following output in the log:
AFR Jan60CAT Gen60CRO sij60CSY leden1960DAN jan60DES Jan60DEU Jan60ENG JAN60ESP ene60FIN tammi60FRA jan60FRS jan60HUN 1960.jan.ITA Gen60MAC jan60NLD jan60NOR jan60POL sty60PTG jan60/* Server encoding of WCYRILLIC required for RUSDFWKX */RUS Янв1960 SLO jan60SVE jan60
Reference for language elementsVersion 3.3
266
xxxDFWDXw.Converts a numerical date into a form that contains the same calendar elements as WORDDATX, into aspecifc language/dialect.
The language/dialect code in the following table replaces xxx in the format name. For example, toconvert to the default width Spanish, the format name is ESPDFWDX24.
language/dialect min width max width default widthAfrikaans AFR 3 37 29Catalan CAT 3 40 16Croatian CRO 3 40 16Czech CSY 8 40 16Danish DAN 3 18 18Dutch NLD 2 38 28English ENG 3 32 28Finnish FIN 3 20 20French FRA 3 18 18Swiss French FRS 3 18 18German DEU 3 18 18Swiss German DES 3 18 18Hungarian HUN 6 40 18Italian ITA 3 17 17Macedonian MAC 3 40 17Norwegian NOR 3 17 17Polish POL 3 40 17Portuguese PTG 3 37 23Russian RUS 3 40 16Slovenian SLO 3 40 17Spanish ESP 3 24 24Swedish SVE 3 17 17
The EURDFWDXw. format does not indicate any specific language. Instead, it lets you set the languageof the format by using a system option, DFLANG.
Exampledata _null_;d=0;put "AFR " d afrdfwdx15.; put "CAT " d catdfwdx15.;
Reference for language elementsVersion 3.3
267
put "CRO " d crodfwdx15.;put "CSY " d csydfwdx25.;put "DAN " d dandfwdx15.;put "DES " d desdfwdx15.;put "DEU " d deudfwdx15.;put "ENG " d engdfwdx15.;put "ESP " d espdfwdx15.;put "FIN " d findfwdx15.;put "FRA " d fradfwdx15.;put "FRS " d frsdfwdx15.;put "HUN " d hundfwdx15.;put "ITA " d itadfwdx15.;put "MAC " d macdfwdx15.;put "NLD " d nlddfwdx15.;put "NOR " d nordfwdx15.;put "POL " d poldfwdx15.;put "PTG " d ptgdfwdx25.;put "RUS " d rusdfwdx15.; put "SLO " d slodfwdx15.;put "SVE " d svedfwdx15.;run;
Which produces the following output in the log:
AFR 1 Jan 1960CAT 1 Gen 1960CRO 1. sij 1960CSY 1 leden 1960DAN 1. jan 1960DES 1. Jan 1960DEU 1. Jan 1960ENG 1 Jan 1960ESP 1 ene 1960FIN 1. tammi 1960FRA 1er jan 1960FRS 1er jan 1960HUN 1960.jan.1.ITA 01 Gen 1960MAC 1. jan 1960NLD 1 jan 1960NOR 1 jan 1960POL 1 sty 1960PTG 1 de janeiro de 1960/* Server encoding of WCYRILLIC required for RUSDFWKX */RUS 1 Янв 1960SLO 1. jan 1960SVE 1 jan 1960
xxxDFWKXw.Converts a numerical date into a form that contains the same calendar elements as WEEKDATX, into aspecific language/dialect.
The language/dialect code in the following table replaces xxx in the format name. For example, toconvert to the default width Spanish, the format name is ESPDFWKX29.
Reference for language elementsVersion 3.3
268
language/dialect min max defaultVariable width 3 40 29Afrikaans AFR 2 38 28Catalan CAT 2 40 27Czech CRO 2 40 25Croation CSY 2 40 25Danish DAN 2 31 31Dutch NLD 7 40 16English ENG 3 37 37Finnish FIN 2 37 37French FRA 3 27 27Swiss French FRS 3 27 27German DEU 2 30 30Swiss German DES 2 30 30Hungarian HUN 3 40 28Italian ITA 3 28 28Macedonian MAC 3 40 29Norwegian NOR 3 26 26Polish POL 2 40 34Portuguese PTG 3 38 38Russian RUS 2 40 29Slovenian SLO 3 40 29Spanish ESP 1 35 35Swedish SVE 3 26 26
The EURDFWKXw. format does not indicate any specific language. Instead, it lets you set the languageof the format by using a system option, DFLANG.
Exampledata _null_;d=0;put "AFR " d afrdfwkx25.;put "CAT " d catdfwkx25.;put "CRO " d crodfwkx25.;put "CSY " d csydfwkx25.;put "DAN " d dandfwkx25.;put "DES " d desdfwkx25.;put "DEU " d deudfwkx25.;put "ENG " d engdfwkx25.;put "ESP " d espdfwkx25.;put "FIN " d findfwkx25.;put "FRA " d fradfwkx25.;
Reference for language elementsVersion 3.3
269
put "FRS " d frsdfwkx25.;put "HUN " d hundfwkx25.;put "ITA " d itadfwkx25.;put "MAC " d macdfwkx25.;put "NLD " d nlddfwkx25.;put "NOR " d nordfwkx25.;put "POL " d poldfwkx25.;put "PTG " d ptgdfwkx38.;put "RUS " d rusdfwkx25.; put "SLO " d slodfwkx25.;put "SVE " d svedfwkx25.;run;
Which outputs the following in the log:
AFR Vrydag, 1 Jan 1960CAT Divendres, 1 Gen 1960CRO petak, 1. sij 1960CSY ptek, 1 leden 1960DAN fredag, den 1. jan 1960DES Freitag, 1. Jan 1960DEU Freitag, 1. Jan 1960ENG Friday, 1 Jan 1960ESP viernes, 1 ene 1960FIN Pe, 1. tammi 1960FRA Vendredi 1er jan 1960FRS Vendredi 1er jan 1960HUN 1960.jan.1., péntekITA Venerd, 01 Gen 1960MAC petok, 1. jan 1960NLD vrijdag, 1 jan 1960NOR fredag, 1 jan 1960POL pitek, 1 sty 1960PTG Sexta-feira, 1 de janeiro de 1960/* Server encoding of WCYRILLIC required for RUSDFWKX */RUS Пятница, 1 Янв 1960 SLO petek, 1. jan 1960SVE Fredag, 1 jan 1960
NLS-sensitive date formatsFormats that represent date-time data based on a specified locale value.
NLDATEw.Converts a date into a representation based upon the specified locale including the day number, themonth and the year.
min max defaultVariable width 1 200 20
Reference for language elementsVersion 3.3
270
Exampledata _null_;d=19995;options locale=en_GB;put d nldate.;run;
data _null_;d=19995;options locale=fr_FR;put d nldate.;run;
Which produces the following output in the log:
29 September 2014 ...29 septembre 2014
NLDATEMDw.Converts a date into a representation based upon the specified locale, writing it out as the day of themonth followed by the name of the month.
min max defaultVariable width 1 200 20
Exampledata _null_;d=19995;options locale=en_GB;put d nldatemd.;run;
data _null_;d=19995;options locale=fr_FR;put d nldatemd.;run;
Which produces the following output in the log:
29 September ...29 septembre
Reference for language elementsVersion 3.3
271
NLDATEMNw.Converts a date into a representation based upon the specified locale, writing it out as the name of themonth.
min max defaultVariable width 1 200 20
Exampledata _null_;d=19995;options locale=en_GB;put d nldatemn.;run;
data _null_;d=19995;options locale=fr_FR;put d nldatemn.;run;
Which produces the following output in the log:
September ...septembre
NLDATEWw.Cnverts a date into a representation based upon the specified locale, writing the name of the day, theday of the month, the name of the month and the year.
min max defaultVariable width 1 200 20
Exampledata _null_;d=19995;options locale=en_GB;put d nldatew.;run;
data _null_;d=19995;options locale=fr_FR;put d nldatew.;run;
Reference for language elementsVersion 3.3
272
Which produces the following output in the log:
Mon, 29 Sep 2014 ...lun. 29 sept. 2014
NLDATEWNw.Converts a date into a representation based upon the specified locale, writing the name of the day.
min max defaultVariable width 1 200 20
Exampledata _null_;d=19995;options locale=en_GB;put d nldatewn.;run;
data _null_;d=19995;options locale=fr_FR;put d nldatewn.;run;
Which produces the following output in the log:
Monday ...lundi
NLDATEYMw.Converts a date into a representation based upon the specified locale, writing the name of the monthand the year.
min max defaultVariable width 1 200 20
Reference for language elementsVersion 3.3
273
Exampledata _null_;d=19995;options locale=en_GB;put d mandate.;run;
data _null_;d=19995;options locale=fr_FR;put d mandate.;run;
Which produces the following output in the log:
September 2014 ...septembre 2014
NLDATEYRw.Converts a date into a representation based upon the specified locale, just writing the year.
min max defaultVariable width 1 200 10
Exampledata _null_;d=19995;options locale=en_GB;put d nldateyr.;run;
data _null_;d=19995;options locale=fr_FR;put d nldateyr.;run;
Which produces the following output in the log:
2014 ...2014
Reference for language elementsVersion 3.3
274
NLDATMw.Converts a datetime into a representation based upon the specified locale, writing it as day number,month name, year and time.
min max defaultVariable width 1 50 30
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatm.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatm.;run;
Which produces the following output in the log:
29 September 2014 11:48:00 ...29 septembre 2014 11:48:00
NLDATMAPw.Converts a datetime into a representation based upon the specified locale, writing it as day number,month name, year, and time AM or PM.
min max defaultVariable width 1 50 30
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmap.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmap.;run;
Reference for language elementsVersion 3.3
275
Which produces the following output in the log:
29 September 2014 11:48:00 am ...29 septembre 2014 11:48:00 AM
NLDATMDTw.Converts a datetime into a representation based upon the specified locale, writing it as day number,month name and year.
min max defaultVariable width 1 50 20
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmdt.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmdt.;run;
Which produces the following output in the log:
29 September 2014 ...29 septembre 2014
NLDATMMDw.Converts a datetime into a representation based upon the specified locale, writing it as day number andthe month name.
min max defaultVariable width 1 50 20
Reference for language elementsVersion 3.3
276
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmmd.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmmd.;run;
Which produces the following output in the log:
29 September ...29 septembre
NLDATMMNw.Converts a datetime into a representation based upon the specified locale, writing the name of themonth.
min max defaultVariable width 1 50 20
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmmn.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmmn.;run;
Which produces the following output in the log:
September ...septembre
Reference for language elementsVersion 3.3
277
NLDATMTMw.Converts a datetime into a representation based upon the specified locale, writing the time of day.
min max defaultVariable width 1 50 20
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmtm.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmtm.;run;
Which produces the following output in the log:
11:48:00 ...11:48:00
NLDATMTZw.Converts a datetime into a representation based upon the specified locale, writing a time and atimezone.
min max defaultVariable width 1 50 30
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmtz.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmtz.;run;
Reference for language elementsVersion 3.3
278
Which produces the following output in the log:
11:48 BST ...11:48 UTC+1
NLDATMWw.Converts a datetime into a representation based upon the specified locale, writing out a day, datenumber, year and time.
min max defaultVariable width 1 50 32
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmw.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmw.;run;
Which produces the following output in the log:
Mon, 29 Sep 2014 11:48 ...lundi 29 septembre 2014 11:48:00
NLDATMWZw.Converts a datetime into a representation based upon the specified locale, writing out a day, datenumber, year, time and timezone.
min max defaultVariable width 1 50 36
Reference for language elementsVersion 3.3
279
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmwz.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmwz.;run;
Which produces the following output in the log:
Monday, 29 September 2014 11:48 BST ...lundi 29 septembre 2014 11:48 UTC+1
NLDATMYMw.Converts a datetime into a representation based upon the specified locale, writing the name of themonth and a year.
min max defaultVariable width 1 50 20
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmym.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmym.;run;
Which produces the following output in the log:
September 2014 ...septembre 2014
Reference for language elementsVersion 3.3
280
NLDATMYRw.Converts a datetime into a representation based upon the specified locale, writing just the year.
min max defaultVariable width 1 50 20
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmyr.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmyr.;run;
Which produces the following output in the log:
2014 ...2014
NLDATMZw.Converts a datetime into a representation based upon the specified locale and including a time zone,writing it as shown below.
min max defaultVariable width 1 50 30
Exampledata _null_;d=1727610480;options locale=en_GB;put d nldatmz.;run;
data _null_;d=1727610480;options locale=fr_FR;put d nldatmz.;run;
Reference for language elementsVersion 3.3
281
Which produces the following output in the log:
29 September 2014 11:48 BST ...29 septembre 2014 11:48 UTC+1
NLSTRMONw.Converts a number representing the month of the year into a locale-specific string.
min max defaultVariable width 1 50 10
Exampledata _null_;d=1;options locale=en_GB;put d nlstrmon.;run;
data _null_;d=1;options locale=fr_FR;put d nlstrmon.;run;
Which produces the following output in the log:
JAN ...JANV.
NLSTRQTRw.Converts a number representing an annual quarter into a locale-specific string.
min max defaultVariable width 1 50 20
Reference for language elementsVersion 3.3
282
Exampledata _null_;d=1;options locale=en_GB;put d nlstrqtr.;run;
data _null_;d=1;options locale=fr_FR;put d nlstrqtr.;run;
Which produces the following output in the log:
1st quarter ...1er trimestre
NLSTRWKw.Converts a number representing a day of the week into a locale-specific string.
min max defaultVariable width 1 50 20
Exampledata _null_;d=1;options locale=en_GB;put d nlstrwk.;run;
data _null_;d=1;options locale=fr_FR;put d nlstrwk.;run;
Which produces the following output in the log:
Monday ...lundi
Reference for language elementsVersion 3.3
283
NLTIMAPw.Converts a numeric time into a locale-specific string which includes a representation of AM or PM.
min max defaultVariable width 1 50 10
Exampledata _null_;d=3900;options locale=en_GB;put d nltimap20.;run;
data _null_;d=3900;options locale=fr_FR;put d nltimap20.;run;
Which produces the following output in the log:
1:05:00 am ...1:05:00 AM
NLTIMEw.Converts a numeric time into a locale-relative string representation of the time.
min max defaultVariable width 1 50 10
Exampledata _null_;d=3900;options locale=en_GB;put d nltime.;run;
data _null_;d=3900;options locale=fr_FR;put d nltime.;run;
Reference for language elementsVersion 3.3
284
Which produces the following output in the log:
01:05:00 ...01:05:00
NLS-sensitive money formatsFormats that represent numeric data as monetary values for a specified locale.
NLMNYw.dConverts a numeric amount of money into a money-format representation in the locale currency.
min max defaultVariable width 1 50 20
Exampledata _null_;d=10.51;options locale=en_US;put d nlmny9.2;run;
data _null_;d=10.51;options locale=fr_FR;put d nlmny9.2;run;
Which produces the following output in the log:
$10.51 ...10,51 €
NLMNYIw.dConverts a numeric amount of money into a money-format representation containing a string localecurrency code.
min max defaultVariable width 1 50 20
Reference for language elementsVersion 3.3
285
Exampledata _null_;d=10.51;options locale=en_US;put d nlmnyi9.2;run;
data _null_;d=10.51;options locale=fr_FR;put d nlmnyi9.2;run;
Which produces the following output in the log:
USD10.51 ...10,51 EUR
NLMNIxxxw.dFormats a numeric input as a currency; the final appearance of the value to display is informed by thesession locale.
xxx in the format denotes the currency, and is specified using one of:
• AED UAE Dirham• AUD Australia Dollar• BGN Bulgaria Lev• BRL Brazil Real• CAD Canada Dollar• CHF Switzerland Franc• CNY China Yuan Renminbi• CZK Czech Republic Koruna• DKK Denmark Krone• EGP Egypt Pound• EUR Euro• GBP Great Britain Pound• HKD Hong Kong Dollar• HRK Croatia Kuna• HUF Hungary Forint• IDR Indonesia Rupiah• ILS Israel Shekel
Reference for language elementsVersion 3.3
286
• INR India Rupee• JPY Japan Yen• KRW South Korea Won• LTL Lithuania Litas• LVL Latvia Lat• MOP Macau Pataca• MXN Mexico Peso• MYR Malaysia Ringgit• NOK Norway Krone• NZD New Zealand Dollar• PLN Poland Zloty• RUB Russia, Ruble• SEK Sweden Krona• SGD Singapore Dollar• THB Thailand Baht• TRY Turkey Lira• TWD Taiwan New Dollar• USD United States Dollar• ZAR South Africa Rand
min max defaultVariable width 1 50 20
Exampledata _null_;options locale=en_GB;d = 10.51;put d nlmniaed10.2;put d nlmniaud10.2;put d nlmnibgn10.2;put d nlmnibrl10.2;put d nlmnicad10.2;put d nlmnichf10.2;put d nlmnicny10.2;put d nlmniczk10.2;put d nlmnidkk10.2;put d nlmniegp10.2;put d nlmnieur10.2;put d nlmnigbp10.2;put d nlmnihkd10.2;put d nlmnihrk10.2;put d nlmnihuf10.2;put d nlmniidr10.2;put d nlmniils10.2;put d nlmniinr10.2;
Reference for language elementsVersion 3.3
287
put d nlmnijpy10.2;put d nlmnikrw10.2;put d nlmniltl10.2;put d nlmnilvl10.2;put d nlmnimop10.2;put d nlmnimxn10.2;put d nlmnimyr10.2;put d nlmninok10.2;put d nlmninzd10.2;put d nlmnipln10.2;put d nlmnirub10.2;put d nlmnisek10.2;put d nlmnisgd10.2;put d nlmnithb10.2;put d nlmnitry10.2;put d nlmnitwd10.2;put d nlmniusd10.2;put d nlmnizar10.2;run;
Which produces the following output in the log:
AED10.51 AUD10.51 BGN10.51 BRL10.51 CAD10.51 CHF10.51 CNY10.51 CZK10.51 DKK10.51 EGP10.51 EUR10.51 GBP10.51 HKD10.51 HRK10.51 HUF10.51 IDR10.51 ILS10.51 INR10.51 JPY10.51 KRW10.51 LTL10.51 LVL10.51 MOP10.51 MXN10.51 MYR10.51 NOK10.51 NZD10.51 PLN10.51 RUB10.51 SEK10.51 SGD10.51 THB10.51 TRY10.51 TWD10.51 USD10.51 ZAR10.51
Reference for language elementsVersion 3.3
288
NLMNLxxxw.dConverts the numeric input into a local form for a currency; the final appearance of the value to displayis informed by the session locale.
xxx in the format denotes the currency, and is specified using one of:
• AED UAE Dirham• AUD Australia Dollar• BGN Bulgaria Lev• BRL Brazil Real• CAD Canada Dollar• CHF Switzerland Franc• CNY China Yuan Renminbi• CZK Czech Republic Koruna• DKK Denmark Krone• EGP Egypt Pound• EUR Euro• GBP Great Britain Pound• HKD Hong Kong Dollar• HRK Croatia Kuna• HUF Hungary Forint• IDR Indonesia Rupiah• ILS Israel Shekel• INR India Rupee• JPY Japan Yen• KRW South Korea Won• LTL Lithuania Litas• LVL Latvia Lat• MOP Macau Pataca• MXN Mexico Peso• MYR Malaysia Ringgit• NOK Norway Krone• NZD New Zealand Dollar• PLN Poland Zloty• RUB Russia, Ruble• SEK Sweden Krona• SGD Singapore Dollar
Reference for language elementsVersion 3.3
289
• THB Thailand Baht• TRY Turkey Lira• TWD Taiwan New Dollar• USD United States Dollar• ZAR South Africa Rand
min max defaultVariable width 1 50 20
Exampledata _null_;options locale=en_GB;d = 10.51;put d nlmnlaed10.2;put d nlmnlaud10.2;put d nlmnlbgn10.2;put d nlmnlbrl10.2;put d nlmnlcad10.2;put d nlmnlchf10.2;put d nlmnlcny10.2;put d nlmnlczk10.2;put d nlmnldkk10.2;put d nlmnlegp10.2;put d nlmnleur10.2;put d nlmnlgbp10.2;put d nlmnlhkd10.2;put d nlmnlhrk10.2;put d nlmnlhuf10.2;put d nlmnlidr10.2;put d nlmnlils10.2;put d nlmnlinr10.2;put d nlmnljpy10.2;put d nlmnlkrw10.2;put d nlmnlltl10.2;put d nlmnllvl10.2;put d nlmnlmop10.2;put d nlmnlmxn10.2;put d nlmnlmyr10.2;put d nlmnlnok10.2;put d nlmnlnzd10.2;put d nlmnlpln10.2;put d nlmnlrub10.2;put d nlmnlsek10.2;put d nlmnlsgd10.2;put d nlmnlthb10.2;put d nlmnltry10.2;put d nlmnltwd10.2;put d nlmnlusd10.2;put d nlmnlzar10.2;run;
Reference for language elementsVersion 3.3
290
Which produces the following output in the log:
AED10.51 AU$10.51 BGN10.51 R$10.51 CA$10.51 CHF10.51 CN¥10.51 CZK10.51 DKK10.51 EGP10.51 €10.51 £10.51 HK$10.51 HRK10.51 HUF10.51 IDR10.51 ₪10.51 #10.51 ¥10.51 ₩10.51 LTL10.51 LVL10.51 MOP10.51 MX$10.51 MYR10.51 NOK10.51 NZ$10.51 PLN10.51 RUB10.51 SEK10.51 SGD10.51 #10.51 TRY10.51 NT$10.51 $10.51 ZAR10.51
YENw.dConverts a numeric amount into a corresponding representation in the Yen currency.
min max defaultVariable width 2 32 6
NLS-sensitive numeric formatsFormats that represent numeric data according to a specified locale.
Reference for language elementsVersion 3.3
291
NLNUMw.dConverts its numeric input into a number formatted using the session locale's number format, in whichthe decimal place and the 'thousands' separators are determined by the locale itself.
min max defaultVariable width 1 32 6
Exampledata _null_;options locale=en_GB;d = 1025.989;put d nlnum8.3;run;
data _null_;options locale=fr_FR;d = 1025.989;put d nlnum8.3;run;
data _null_;options locale=de_DE;d = 1025.989;put d nlnum8.3;run;
Which produces the following output in the log:
1,025.99...1 026,0...1.025,99
NLNUMIw.dConverts its numeric input into an international number format, using commas and periods asseparators.
This format differs from the NLNUM format, in which the separators are locale-determined. It alsodiffers from the COMMA format, which rounds more aggressively (losing precision) when attempting toaccommodate smaller output widths.
min max defaultVariable width 1 32 6
Reference for language elementsVersion 3.3
292
Exampledata _null_;options locale=en_GB;d = 1025.989;put d nlnumi9.3;run;
data _null_;options locale=fr_FR;d = 1025.989;put d nlnumi9.3;run;
data _null_;options locale=de_DE;d = 1025.989;put d nlnumi9.3;run;
Which produces the following output in the log:
1,025.989 ...1,025.989...1,025.989
NLPCTw.dConverts its numeric input into a percentage using the locale's number format.
min max defaultVariable width 1 32 6
ExampleThe second example below demonstrates how the number 1.7767 is expressed as a percentage usingthe French locale – by using a comma as the decimal point and placing a space before the percentagesymbol.
data _null_;options locale=en_GB;d = 1.7767;put d nlpct10.2;run;
data _null_;options locale=fr_FR;d = 1.7767;put d nlpct10.2;run;
Reference for language elementsVersion 3.3
293
Which produces the following output in the log:
177.67% ...177,67 %
NLPCTIw.dConverts its numeric input into a percentage form using an international number format, in which thedecimal point is represented by a period, but some locale-specific conventions are preserved (forexample, the insertion of a space before the percentage symbol in certain locales).
min max defaultVariable width 1 32 6
Exampledata _null_;options locale=en_GB;d = 1.7767;put d nlpcti10.2;run;
data _null_;options locale=fr_FR;d = 1.7767;put d nlpcti15.2;run;
data _null_;options locale=de_DE;d =1.7767;put d nlpcti10.2;run;
Which produces the following output in the log:
177.67% ...177.67 % ...177.67 %
Reference for language elementsVersion 3.3
294
NLPCTNw.dConverts its numeric input into a percentage, prepending a minus sign to negative values.
min max defaultVariable width 1 32 6
Exampledata _null_;d = 1.7767;e = -1.7767;put d nlpctn10.2;put e nlpctn10.2;run;
Which produces the following output in the log:
177.67% -177.67%
NLPCTPw.dConverts its numeric input into a percentage form using locale specific separators for thousands andthe decimal point.
min max defaultVariable width 1 32 6
Exampledata _null_;options locale=en_GB;d = 1.7767;e = -1.7767;put d nlpctp10.2;put e nlpctp10.2;run;
data _null_;options locale=fr_FR;d = 1.7767;e = -1.7767;put d nlpctp10.2;put e nlpctp10.2;run;
Reference for language elementsVersion 3.3
295
Which produces the following output in the log:
177.67% -177.67% ...177,67% -177,67%
NLBESTw.dConverts its numeric input into the best locale-specific representation.
min max defaultVariable width 1 32 12
Exampledata _null_;options locale=en_GB;d = 1111.7767;e = -1111.7767;put d nlbest10.2;put e nlbest10.2;run;
data _null_;options locale=fr_FR;d = 1111.7767;e = -1111.7767;put d nlbest10.2;put e nlbest10.2;run;
Which produces the following output in the log:
1111.7767-1111.7767... 1111,7767-1111,7767
NLPVALUEw.dConverts its numeric input into a p-value represented according to the session locale.
min max defaultVariable width 3 32 6
Reference for language elementsVersion 3.3
296
Exampledata _null_;options locale=en_GB;d = 1.11;e = 0.11;put d nlpvalue10.2;put e nlpvalue10.2;run;
data _null_;options locale=fr_FR;d = 1.11;e = 0.11;put d nlpvalue10.2;put e nlpvalue10.2;run;
Which produces the following output in the log:
1.11 0.11... 1,11 0,11
InformatsInformats define display representation of the input dataset.
Informats are used when you need to acquire formatted, non-standard data and bring it into a SASlanguage program. Their function is suggested in the name - informat – they facilitate formatted input,essentially informing WPS how to read variables. The SAS language only supports two types of data –standard character and standard numeric – but it is possible that you may wish to process external datathat isn't presented as either standard character or standard numeric. This is what informats are for,and they are often employed as part of INPUT statements. Informats are usually classified into threebroad categories:
Character informatsCharacter informats transform external character data into a standard character form. Characterinformats have the pattern: $<informat-name>w. - w is the total width of the input field andthe terminating period is mandatory. The $w. informat, which omits an informat name, is used forreading standard character data values.
Numeric informatsThese transform external numeric data into a standard numeric form. Numeric informats have thepattern: <informat-name>w.d - w is the total width of the input field and d is an optional powerof 10 by which the result is divided (but only if the input does not contain a decimal point, in whichcase it is ignored). The period following the width is, again, mandatory. The w.d informat, whichomits a name, is used for reading standard numeric data.
Reference for language elementsVersion 3.3
297
Date informatsThese transform character representations of dates into a standard form - a number representingthe number of days since the SAS language epoch date - 1st Jan 1960. Closely-related, datetimeformats perform similar services, returning the number of elapsed seconds since 00:00:00 onthe epoch date. Date and datetime informats have the pattern: $<informat-name>w. - w is thetotal width of the input field and the terminating period is mandatory.
Example informat use casesThe following example uses the $w. informat to read character data - by default, it trims leading blanksand left-aligns the input:
data _null_;input s $20.;put s;cards; World Programming;run;
The output:
World Programming
Next, the w.d informat is used to read standard numeric data - note how the second item has beendivided by 10,000:
data _null_;input s 9.4;put s;cards;123456.7812345678;run;
Which produces the output:
123456.781234.5678
Finally, an example of reading non-standard character data - a representation of a date. TheANYDTDTE. informat converts a variety of date-like and time-like values into a numeric date value
data _null_;input d anydtdte11.;put d;cards;29 SEP 2014;run;
This informat has transformed a non-standard representation of a date into a standard, numeric, epoch-based value:
19995
Reference for language elementsVersion 3.3
298
Core informatsSome of the most widely used informats, fundamental to the SAS language.
BESTw.dThis informat reads numeric data. Trailing blanks on input data are ignored and its default length is 12.It is identical to Dw.d. and Ew.d.
Exampledata _null_;input s best7.2;put s;cards;123456 1234.56 ;run;
Which produces the following output in the log:
1234.561234.56
Dw.dThis informat reads numeric data. Trailing blanks on input data are ignored and its default length is 12.It is identical to BESTw.d. and Ew.d.
Exampledata _null_;input s d7.2;put s;cards;123456 1234.56 ;run;
Which produces the following output in the log:
1234.561234.56
Reference for language elementsVersion 3.3
299
Ew.dThis informat reads numeric data. Trailing blanks on input data are ignored and its default length is 12.It is identical to BESTw.d. and Dw.d.
Exampledata _null_;input s e7.2;put s;cards;123456 1234.56 ;run;
Which produces the following output in the log:
1234.561234.56
Fw.dThis format reads external numeric data – trailing blanks on input data are ignored.
min max defaultVariable width 1 32 1
Exampledata _null_;input s f7.2;put s;cards;123456 1234.56 ;run;
Which produces the following output in the log:
1234.561234.56
Basic character informatsFundamental character informats for different platforms.
Reference for language elementsVersion 3.3
300
$ASCIIw.This informat reads ASCII data into a native-format string. On an ASCII platform, this has no effect.
min max defaultVariable width 1 32767 1
$BASE64Xw.This informat reads base64-encoded ASCII text into character data.
min max defaultVariable width 1 32767 1
Exampledata _null_;s="World Programming";t=put(s, $base64x100.); /* Convert to base64 */put t;r=input(t, $base64x100.); /* Read in from base64 */put r;run;
Which produces the following output in the log:
V29ybGQgUHJvZ3JhbW1pbmc=World Programming
$BINARYw.This informat reads a string containing a sequence of binary characters into a character representation.
min max defaultVariable width 1 32767 8,*8
Exampledata _null_;s="010101110101000001010011";r=input(s, $binary24.);put r;run;
Reference for language elementsVersion 3.3
301
Which produces the following output in the log:
WPS
$CHARw.This informat reads character data into a string. If enough space is available, leading and trailing blanksare retained.
min max defaultVariable width 1 32767 8
Exampledata _null_;s=" World Programming ";r=input(s, $char30.);put r $30. "*";run;
Which produces the following output in the log:
World Programming *
$CHARZBw.This informat reads hex-encoded character data into a string. Binary zeroes are converted to blanks.
min max defaultVariable width 1 32767 1
Exampledata _null_;s="0000575053"x;r=input(s,$charzb20.);put r $20.;run;
Which produces the following output in the log:
WPS
Reference for language elementsVersion 3.3
302
$CSTRw.This informat reads a null-terminated string into a blank-padded string.
min max defaultVariable width 1 32767 1
Exampledata _null_;s="57505300"x;r=input(s,$cstr8.);put r "*";put r $hex. "*";run;
Which produces the following output in the log:
WPS *57505320202020*
$EBCDICw.On an EBCDIC platform, this informat has no effect. On an ASCII platform, it transforms EBCDIC inputdata into an ASCII representation.
min max defaultVariable width 1 32767 1
Exampledata _null_;s="WPS";r=put(s,$ebcdic20.);t=input(r, $ebcdic20.);put t;run;
Which produces the following output in the log:
WPS
Reference for language elementsVersion 3.3
303
$Fw.This informat reads character data into a string, trimming leading and trailing blanks.
min max defaultVariable width 1 32767 1
Exampledata _null_;s=" World Programming ";t=input(s, $f100.); put t "*";run;
Which produces the following output in the log:
World Programming *
$HEXw.This informat reads hex-encoded character data into a session-encoded string.
min max defaultVariable width 1 32767 2,*2
Exampledata _null_;s="575053";r=input(s,$hex20.);put r;run;
Which produces the following output in the log:
WPS
$PHEXw.This informat reads packed hexadecimal character data into a session-encoded string.
min max defaultVariable width 1 32767 2,/2
Reference for language elementsVersion 3.3
304
$QUOTEw.This informat reads character data, removing pairs of quotation marks.
min max defaultVariable width 1 32767 8
Exampledata _null_;s='"WPS"';r=input(s,$quote.);put r;put s;run;
Which produces the following output in the log:
WPS"WPS"
$REVERJw.This informat reads character data into a visually reversed form, retaining leading and trailing blanks.
min max defaultVariable width 1 32767 1
Exampledata _null_;s=" gnimmargorP dlroW ";r=input(s,$reverj30.);put r $30. "*";run;
Which produces the following output in the log:
World Programming *
Reference for language elementsVersion 3.3
305
$REVERSw.This informat reads character data into a visually reversed form, stripping trailing blanks first, so that theoutput is left-aligned.
min max defaultVariable width 1 32767 1
Exampledata _null_;s=" gnimmargorP dlroW ";r=input(s,$revers30.);put r $30. "*";run;
Which produces the following output in the log:
World Programming *
$UPCASEw.This informat reads character data into an upper case form.
min max defaultVariable width 1 32767 8
Exampledata _null_;s="world programming";r=input(s,$upcase30.);put r;run;
Which produces the following output in the log:
WORLD PROGRAMMING
Reference for language elementsVersion 3.3
306
$VARYINGw.This informat reads character strings of varying length. Its second parameter sets the maximum lengthof the variable being processed.
Exampledata _null_ ; length c $ 15 ; input len 2. c $varying15. len date date9. ; put c date;cards ; 777777777nov20141211111111111111oct2014;
Which produces the following output in the log:
7777777 20034111111111111 20007
Bidirectional informatsCharacter informats that deal with data written from left to right and from right to left.
$LOGVSw.This informat reads a string in left-to-right logical order into a string in visual order.
min max defaultVariable width 1 32767 200
Exampledata _null_;s='#####';r=input(s, $logvs20.);put r;run;
Which produces the following output in the log:
/* System encoding needs to be set to ARABIC for correct behaviour */ #####
Reference for language elementsVersion 3.3
307
$LOGVSRw.This informat reads a string in right-to-left logical order into a string in visual order.
min max defaultVariable width 1 32767 200
Exampledata _null_;s="#####";r=input(s, $logvsr20.);put r;run;
Which produces the following output in the log:
/* System encoding needs to be set to ARABIC for correct behaviour */ #####
$VSLOGw.This informat reads a string in visual order into a string in left-to-right logical order.
min max defaultVariable width 1 32767 200
Exampledata _null_;s="#####";r=input(s, $vslog20.);put r;run;
Which produces the following output in the log:
/* System encoding needs to be set to ARABIC for correct behaviour */ #####
Reference for language elementsVersion 3.3
308
$VSLOGRw.This informat reads a string in visual order into a string in right-to-left logical order.
min max defaultVariable width 1 32767 200
Exampledata _null_;s='#####';r=input(s, $vslogr20.);put r;run;
Which produces the following output in the log:
/* System encoding needs to be set to ARABIC for correct behaviour */ #####
Unicode informatsCharacter informats for different variants of the Unicode encoding.
$UCS2Bw.This informat reads data in big-endian, 16-bit UCS2 Unicode encoding into a session-encodedcharacter data form.
min max defaultVariable width 2 32000 8
Exampledata _null_;s="0057006F0072006C0064002000500072006F006700720061006D006D0069006E0067"x;r=input(s, $ucs2b60.);put r;run;
Which produces the following output in the log:
World Programming
Reference for language elementsVersion 3.3
309
$UCS2BEw.This informat reads session-encoded character strings into a big-endian, 16-bit UCS2 Unicodeencoding.
min max defaultVariable width 2 32000 8
Exampledata _null_;s="World Programming";r=input(s, $ucs2be60.);put r;run;
Which produces the following output in the log:
W o r l d P r o g r a m m i n g
$UCS2Lw.This informat reads little-endian, 16-bit UCS2 Unicode encoded data into session-encoded characterform.
min max defaultVariable width 2 32000 8
Exampledata _null_;s="57006F0072006C0064002000500072006F006700720061006D006D0069006E006700"x;r=input(s, $ucs2l60.);put r;run;
Which produces the following output in the log:
World Programming
Reference for language elementsVersion 3.3
310
$UCS2LEw.This informat reads a session-encoded character string into a little-endian 16-bit UCS2 form.
min max defaultVariable width 2 32000 8
Exampledata _null_;s="World Programming";r=input(s, $ucs2le100.);put r;run;
Which produces the following output in the log:
W o r l d P r o g r a m m i n g
$UCS2Xw.This informat reads 16-bit UCS2 machine-endian unicode data into a character string.
min max defaultVariable width 2 32000 8
Example/* If executed on an x86 machine */data _null_;s="57006F0072006C0064002000500072006F006700720061006D006D0069006E006700"x;r=input(s, $ucs2x100.);put r;run;
Which produces the following output in the log:
World Programming
Reference for language elementsVersion 3.3
311
$UCS2XEw.This informat reads session-encoded character data into a 16-bit UCS2 Unicode encoding in theendianness of the executing machine.
min max defaultVariable width 2 32000 8
Exampledata _null_;s="World Programming";r=input(s, $ucs2xe100.);put r;run;
Which produces the following output in the log:
/* If executed on an x86 machine */W o r l d P r o g r a m m i n gWorld Programming
$UCS4Bw.This informat reads big-endian, 32-bit UCS4 Unicode encoded data into a session-encoded characterform.
min max defaultVariable width 4 32000 8
Exampledata _null_;s="000000570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067"x;t=input(s, $ucs4b100.); put t;run;
Which produces the following output in the log:
World Programming
Reference for language elementsVersion 3.3
312
$UCS4Lw.This informat reads little-endian, 32-bit UCS4 Unicode-encoded data into a session-encoded characterform.
min max defaultVariable width 4 32000 8
Exampledata _null_;s="570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067000000"x;t=input(s, $ucs4l100.); put t;run;
Which produces the following output in the log:
World Programming
$UCS4Xw.This informat converts 32-bit UCS4 Unicode machine-endian encoded data into a session-encodedcharacter form.
min max defaultVariable width 4 32000 8
Example/* If executed on an x86 machine */data _null_;s="570000006F000000720000006C000000640000002000000050000000720000006F0000006700000072000000610000006D0000006D000000690000006E00000067000000"x;t=input(s, $ucs4x100.); put t;run;
Which produces the following output in the log:
World Programming
Reference for language elementsVersion 3.3
313
$UCS4XEw.This informat reads a session-encoded character string into machine-endian 32-bit UCS4 Unicodeencoded data.
min max defaultVariable width 4 32000 8
Exampledata _null_;s="World Programming";t=input(s, $ucs4xe100.); put t;run;
Which produces the following output in the log:
/* If executed on an x86 machine */W o r l d P r o g r a m m i n g
$UESCw.This informat reads a UESC character string into a session-encoded character string.
min max defaultVariable width 1 32767 8
Exampledata _null_;s="\u0023World Programming\u0024";t=input(s, $uesc50.); put t;run;
Which produces the following output in the log:
#World Programming$
Reference for language elementsVersion 3.3
314
$UESCEw.This informat reads character data converting all but the 0–9, A–Z, a–z and space characters toUnicode universal character names in the \uXXXX notation.
min max defaultVariable width 1 32767 8
Exampledata _null_;s="#World Programming$";t=input(s, $uesce50.); put t;run;
Which produces the following output in the log:
\u0023World Programming\u0024
$UNCRw.This informat reads character data, converting characters in the Unicode numeric character referenceformat (&#ddddd; notation) into a session-encoded character form. This notation is described in http://www.w3.org/TR/html4/charset.html#h-5.3.1
min max defaultVariable width 1 32767 8
Exampledata _null_;s="#World Programming&";t=input(s, $uncr100.); put t;run;
Which produces the following output in the log:
#World Programming&
Reference for language elementsVersion 3.3
315
$UNCREw.This informat reads character data, converting all but 0–9, A–Z, a–z and space to the Unicode numericcharacter reference format (&#ddddd notation). This notation is described in http://www.w3.org/TR/html4/charset.html#h-5.3.1.
min max defaultVariable width 1 32767 8
Exampledata _null_;s="&World Programming#";t=input(s, $uncre50.); put t;run;
Which produces the following output in the log:
&World Programming#
$UPARENw.This informat reads a sequence of characters encoded individually as <uxxxx> (where xxxx is theUnicode code point for the character in hexadecimal) into a session-encoded string.
min max defaultVariable width 1 32767 8
Exampledata _null_;s="<u0057><u006F><u0072><u006C><u0064><u0020><u0050><u0072><u006F><u0067><u0072><u0061><u006D><u006D><u0069><u006E><u0067>";t=input(s, $uparen200.); put t;run;
Which produces the following output in the log:
World Programming
Reference for language elementsVersion 3.3
316
$UPARENEw.This informat reads a session-encoded string into a string representation in which each character isencoded as <uxxxx> where xxxx is the Unicode code point for the character concerned.
min max defaultVariable width 1 32767 8
Exampledata _null_;s="World Programming";t=input(s, $uparene200.); put t;run;
Which produces the following output in the log:
<u0057><u006F><u0072><u006C><u0064><u0020><u0050><u0072><u006F><u0067><u0072><u0061><u006D><u006D><u0069><u006E> lt;u0067>
$UTF8Xw.This informat transforms UTF-8 data into session-encoded data.
min max defaultVariable width 1 32000 8
$UTF8XEw.This informat transforms session-encoded data into UTF-8.
min max defaultVariable width 1 32000 8
Simple numeric informatsFundamental informats for numeric data.
Reference for language elementsVersion 3.3
317
BINARYw.dThis informat reads a binary value into a numeric value.
min max defaultVariable width 1 64 8
Exampledata _null_;d=3;b=put(d, binary10.);put b;r=input(b, binary10.);put r;run;
Which produces the following output in the log:
00000000113
BITSw.dThis informat reads a specified number of bits from its argument, converting them into a numericvariable. The number of bits is determined by the width and the process starts at an offset determinedby the specified number of decimal digits.
min max defaultVariable width 1 64 1
Exampledata _null_;d="Z"; /* ASCII 90 = BINARY 01011010 */r=input(d, bits4.1); put r;run;
Which produces the following output in the log:
11
Reference for language elementsVersion 3.3
318
BZw.dThis informat reads numeric values converting spaces to zeroes. The decimal part, if present, denotes apower of 10 to divide the value provided.
min max defaultVariable width 1 32 1
Exampledata _null_;d="1000";r=input(d, bz6.2);put r;run;
Which produces the following output in the log:
10
COMMAw.dThis informat reads numeric data, removing embedded commas and currency signs. The decimal part,if present, denotes a power of 10 to divide the value provided.
min max defaultVariable width 1 32 1
Exampledata _null_;d="123,456,789";r=input(d, comma10.3);put r;run;
Which produces the following output in the log:
12345.678
Reference for language elementsVersion 3.3
319
COMMAXw.dThis informat reads numeric data, removing embedded periods and currency signs. The decimal part, ifpresent, denotes a power of 10 to divide the value provided.
min max defaultVariable width 1 32 1
Exampledata _null_;d="123.456.789";r=input(d, commax10.3);put r;run;
Which produces the following output in the log:
12345.678
DOLLARw.dThis informat reads numeric data, removing embedded commas and currency signs. The decimal part,if present, denotes a power of 10 to divide the value provided.
This informat is an alias of COMMAw.d
min max defaultVariable width 1 32 1
DOLLARXw.dThis informat reads numeric data, removing embedded commas and currency signs. The decimal part,if present, denotes a power of 10 to divide the value provided.
This informat is an alias of COMMAw.d
min max defaultVariable width 1 32 1
Reference for language elementsVersion 3.3
320
EUROw.dThis informat reads numeric data removing embedded Euro currency symbols, commas and othercharacters.
min max defaultVariable width 1 32 1
Exampledata _null_;s=1096543.123;t= put(s, euro20.3);r= input(t, euro20.3);put t;put r;run;
Which produces the following output in the log:
E1,096,543.1231096543.123
EUROXw.dThis informat reads numeric data removing embedded Euro currency characters.
min max defaultVariable width 1 32 1
Exampledata _null_;s="E1096543.123";r= input(s, eurox20.3);put r;run;
Which produces the following output in the log:
1096543.123
Reference for language elementsVersion 3.3
321
FLOATw.dThis informat reads a floating point value. If present, the decimal part represents a power of 10 by whichthe result is divided.
min max defaultVariable width 4 4 4
Exampledata _null_;s=123.456;t=put(s,float4.);r=input(t, float4.2);put r;run;
Which produces the following output in the log:
1.2345600128
HEXw.This informat reads hexadecimal character data into a numeric form.
min max defaultVariable width 1 16 8
Exampledata _null_;s="FF";r=input(s, hex.);put r;run;
Which produces the following output in the log:
255
Reference for language elementsVersion 3.3
322
IBw.dThis informat reads integer binary data, converting to session form.
min max defaultVariable width 1 8 4
IBRw.dThis informat reads integer binary data in a machine-specific form and converts it to a session form.
min max defaultVariable width 1 8 4
NUMXw.dThis informat reads numeric values converting commas to periods.
min max defaultVariable width 1 32 12
Exampledata _null_;s=123456.789;t=put(s, numx12.4);put t;r=input(t, numx12.);put r;run;
Which produces the following output in the log:
123456,7890123456.789
Reference for language elementsVersion 3.3
323
PDw.dThis informat reads packed decimal data into a numeric value.
min max defaultVariable width 1 16 1
Exampledata _null_;s=123;t=put(s, pd3.);put t $hex.;r=input(t,pd3.);put r;run;
Which produces the following output in the log:
000123123
PERCENTw.dThis informat reads percentages into a numeric value.
min max defaultVariable width 1 32 6
Exampledata _null_;s=0.28;t=put(s,percent.);put t;r=input(t,percent.);put r;run;
Which produces the following output in the log:
28%0.28
Reference for language elementsVersion 3.3
324
PIBw.dThis informat reads a positive integer binary representation into a numeric value.
min max defaultVariable width 1 8 1
Exampledata _null_;s="88D612"x;r=input(s,pib8.0);put r;run;
Which produces the following output in the log:
1234568
PIBRw.dThis informat reads a little-endian positive integer representation into a numeric value.
min max defaultVariable width 1 8 1
Exampledata _null_;s="88D612"x;r=input(s,pibr8.0);put r;run;
Which produces the following output in the log:
1234568
PKw.dThis informat reads a packed decimal representation into a numeric form.
min max defaultVariable width 1 16 1
Reference for language elementsVersion 3.3
325
Exampledata _null_;s=1234567.95;r=put(s, pk7.4);put r $hex.;t=input(r, pk7.4);put t;run;
Which produces the following output in the log:
000123456795001234567.95
RBw.dThis informat reads a real binary representation into a numeric value.
min max defaultVariable width 2 8 4
Exampledata _null_;s=1234567.95;r=put(s, rb4.0);put r $hex.;t=input(r, rb5.0);put t;run;
Which produces the following output in the log:
87D632411234567
S370FFw.dThis informat reads open edition 1047 EBCDIC (IBM mainframe) format on non-z/OS machines into anumeric value. It has no effect on z/OS machines.
min max defaultVariable width 1 32 12
Reference for language elementsVersion 3.3
326
Exampledata _null_;s=10;r=put(s, s370ff.);put r $hex.;t=input(r, s370ff.);put t;run;
Which produces the following output in the log:
40404040404040404040F1F010
S370FIBw.dThis informat reads big-endian integer-binary IBM mainframe format data into a numeric form.
min max defaultVariable width 1 8 4
Exampledata _null_;s=10;r=put(s, s370fib8.);put r $hex.;t=input(r, s370fib8.);put t;run;
Which produces the following output in the log:
000000000000000A10
S370FIBUw.dThis informat reads unsigned big-endian positive integer binary IBM mainframe format into a numericvalue.
min max defaultVariable width 1 8 4
Reference for language elementsVersion 3.3
327
Exampledata _null_;s=10;r=put(s, s370fibu8.);put r $hex.;t=input(r, s370fibu8.);put t;run;
Which produces the following output in the log:
000000000000000A10
S370FPDw.dThis informat reads z/OS packed decimal format data into a numeric value.
min max defaultVariable width 1 16 1
Exampledata _null_;s=10;r=put(s, s370fpd8.);put r $hex.;t=input(r,s370fpd8.);put t;run;
Which produces the following output in the log:
000000000000010C10
S370FPDUw.dThis informat reads z/OS unsigned packed decimal format into a numeric value.
min max defaultVariable width 1 16 1
Reference for language elementsVersion 3.3
328
Exampledata _null_;s=10;r=put(s, s370fpdu8.);put r $hex.;t=input(r,s370fpdu8.);put t;run;
Which produces the following output in the log:
000000000000010F10
S370FPIBw.dThis informat reads z/OS big-endian positive integer binary format into a numeric form.
min max defaultVariable width 1 8 4
Exampledata _null_;s=10;r=put(s, s370fpib8.);put r $hex.;t=input(r,s370fpib8.);put t;run;
Which produces the following output in the log:
000000000000000A10
S370FRBw.dThis informat reads z/OS real binary format into a numeric value.
min max defaultVariable width 2 8 6
Reference for language elementsVersion 3.3
329
Exampledata _null_;s=10;r=put(s, s370frb8.);put r $hex.;t=input(r,s370frb8.);put t;run;
Which produces the following output in the log:
41A000000000000010
S370FZDw.dThis informat reads z/OS zoned decimal format into a numeric value.
min max defaultVariable width 1 32 8
Exampledata _null_;s=10;r=put(s, s370fzd8.);put r $hex.;t=input(r,s370fzd8.);put t;run;
Which produces the following output in the log:
F0F0F0F0F0F0F1C010
S370FZDBw.dThis informat reads z/OS zoned decimal format into a numeric value.
min max defaultVariable width 1 32 8
Reference for language elementsVersion 3.3
330
S370FZDLw.dThis informat reads z/OS zoned decimal format with a sign nibble at the beginning into a numeric form.
min max defaultVariable width 1 32 8
Exampledata _null_;s=10;r=put(s, s370fzdl8.);put r $hex.;t=input(r,s370fzdl8.);put t;run;
Which produces the following output in the log:
C0F0F0F0F0F0F1F010
S370FZDSw.dThis informat reads z/OS zoned decimal format with a sign byte at the beginning into a numeric value.
min max defaultVariable width 2 32 8
Exampledata _null_;s=10;r=put(s, s370fzds8.);put r $hex.;t=input(r,s370fzds8.);put t;run;
Which produces the following output in the log:
4EF0F0F0F0F0F1F010
Reference for language elementsVersion 3.3
331
S370FZDTw.dThis informat reads z/OS zoned decimal format with a sign byte at the end into a numeric form.
min max defaultVariable width 2 32 8
Exampledata _null_;s=10;r=put(s, s370fzdt8.);put r $hex.;t=input(r,s370fzdt8.);put t;run;
Which produces the following output in the log:
F0F0F0F0F0F1F04E10
S370FZDUw.dThis informat reads z/OS zoned decimal format with no sign byte into a numeric value.
min max defaultVariable width 1 32 8
Exampledata _null_;s=10;r=put(s, s370fzdu8.);put r $hex.;t=input(r,s370fzdu8.);put t;run;
Which produces the following output in the log:
F0F0F0F0F0F0F1F010
Reference for language elementsVersion 3.3
332
TRAILSGNw.dThis informat reads a character representation of a number with a trailing sign into a numeric value. Ifpresent, the decimal part represents a power of 10 by which the result is divided.
min max defaultVariable width 1 32 6
Exampledata _null_;s="123+";t="456-";r1=input(s,trailsgn10.0);r2=input(t,trailsgn10.4);put r1;put r2;run;
Which produces the following output in the log:
123-0.0456
YENw.dThis informat reads numeric data, removing embedded commas and yen signs. The decimal part, ifpresent, denotes a power of 10 to divide the value provided.
min max defaultVariable width 1 32 1
ZDw.dThis informat reads a platform-dependent zoned decimal format into a numeric value.
min max defaultVariable width 1 32 1
Reference for language elementsVersion 3.3
333
Exampledata _null_;s=123456;r=put(s,zd10.2);put r $hex.;t=input(r,zd10.2);put t; run;
Which produces the following output in the log:
3030313233343536307B123456
ZDBw.dThis informat converts platform-dependent zoned decimal data in which zeros are blank into a numericvalue.
min max defaultVariable width 1 32 1
Numeric date informatsInformats that convert a numeric date into a formatted character representation.
ANYDTDTEw.This informat reads a variety of date-like and time-like values into a numeric date value.
min max defaultVariable width 5 60 9
Reference for language elementsVersion 3.3
334
Exampledata _null_;input checkdate : anydtdte.;put checkdate;put checkdate=: date9.;cards;18SEP201418SEP2014 12:24:32.8SEP2014;run;
Which produces the following output in the log:
19984checkdate=18SEP201419984checkdate=18SEP201419967checkdate=01SEP2014
ANYDTDTMw.This informat teads a range of date-like and time-like values into a numeric datetime value.
min max defaultVariable width 1 60 19
Exampledata _null_;input checkdatetime : anydtdtm20.;put checkdatetime;put checkdatetime=: datetime25.;cards;18SEP201418SEP2014 12:24:32.8SEP2014;run;
Which produces the following output in the log:
1726617600checkdatetime=18SEP2014:00:00:001726617600checkdatetime=18SEP2014:00:00:001725148800checkdatetime=01SEP2014:00:00:00
Reference for language elementsVersion 3.3
335
ANYDTTMEw.This informat reads a variety of time-like values into a numeric time value.
min max defaultVariable width 1 60 8
Exampledata _null_;input checktime : anydttme20.;put checktime;put checktime=: time12.;cards;12:24:32.8;run;
Which produces the following output in the log:
44672.8checktime=12:24:33
DATEw.This informat reads date values in the form DDMMMYY or DDMMMYYYY or DD-MMM-YYYY into anumeric date.
min max defaultVariable width 7 32 7
Exampledata _null_;e="01-JAN-1960";d="18-SEP-2014";r1=input(e,date20.);r2=input(d,date20.);put r1;put r2;run;
Which produces the following output in the log:
019984
Reference for language elementsVersion 3.3
336
DATETIMEw.This informat reads datetime values in the form DDMMMYY:HH:MM:SS or DDMMMYYYY:HH:MM:SSor DD-MMM-YYYY:HH:MM:SS into a numeric datetime.
min max defaultVariable width 13 40 18
Exampledata _null_;e="01JAN60:00:00:00";d="18-SEP-14:15:27:20";r1=input(e,datetime20.);r2=input(d,datetime20.);put r1;put r1 datetime20.;put r2;put r2 datetime20.;run;
Which produces the following output in the log:
0 01JAN1960:00:00:001726673240 18SEP2014:15:27:20
DDMMYYw.This informat reads a date in a DD/MM/YY or DD/MM/YYYY representation into a numeric date.
min max defaultVariable width 6 32 6
Exampledata _null_;d="19/09/2014";r=input(d, ddmmyy20.);put r;run;
Which produces the following output in the log:
19985
Reference for language elementsVersion 3.3
337
HHMMSSw.This informat reads a time expressed as HH:MM:SS into a numeric time format.
min max defaultVariable width 1 20 8
Exampledata _null_;d="09:43:00";r=input(d, hhmmss20.);put r;run;
Which produces the following output in the log:
34980
JULIANw.This informat reads a YYDDD or YYYYDDD Julian date into a numeric format.
min max defaultVariable width 5 32 5
Exampledata _null_;d="2014034";r=input(d, julian20.);put r;run;
Which produces the following output in the log:
19757
MDYAMPMw.This informat reads datetimes expressed as MM-DD-YY HH.MM AM|PM or MM-DD-YYYY HH.MM AM|PM into a numeric datetime form.
min max defaultVariable width 8 40 16
Reference for language elementsVersion 3.3
338
Exampledata _null_;d="09-15-14 4.45 pm";r=input(d,mdyampm20.);put r;run;
Which produces the following output in the log:
1726418700
MINGUOw.This informat reads a Taiwanese date form into a numeric date.
min max defaultVariable width 6 10 6
Exampledata _null_;d="49/01/01";e="0490101";r=input(d,minguo10.);s=input(e,minguo10.);put r;put s;run;
Which produces the following output in the log:
00
MMDDYYw.This informat reads a date in a MM/DD/YY or MM/DD/YYYY representation into a numeric date.
min max defaultVariable width 6 32 6
Reference for language elementsVersion 3.3
339
Exampledata _null_;d="09/19/2014";r=input(d,mmddyy10.);put r;run;
Which produces the following output in the log:
19985
MONYYw.This informat converts a date expressed as MMMYY or MMMYYYY into a numeric date format.
min max defaultVariable width 5 32 5
Exampledata _null_;d="SEP2014";r=input(d,monyy20.);put r;run;
Which produces the following output in the log:
19967
MSECw.MSEC reads the output of the z/OS TIME macro, or equivalently the STCK instruction.
The STCK instruction produces a 64 bit big-endian value where bit position 51 (where the first bit isposition 0) is incremented every microsecond. It returns the value as a time of day.
min max defaultVariable width 1 8 8
Reference for language elementsVersion 3.3
340
NENGOw.This informat reads a Japanese date format (including an initial era signifier) into a numeric date.
min max defaultVariable width 10 16 10
Exampledata _null_;d="H.26/08/15";r=input(d,nengo10.);put r;run;
Which produces the following output in the log:
19950
PDJULGw.This informat reads a packed decimal representation of a Julian date into a numeric date.
min max defaultVariable width 3 4 4
Exampledata _null_;d=0;r=put(d,pdjulg4.); /* Convert date to packed decimal form */put r $hex.; /* Examine it */ s=input(r,pdjulg4.); /* Read and format it as (original) date */put s;run;
Which produces the following output in the log:
1960001F0
Reference for language elementsVersion 3.3
341
PDJULIw.This informat reads a packed decimal representation (CCYYDDDF) of a Julian date into a numeric date.
min max defaultVariable width 4 4 4
Exampledata _null_;d=0;r=put(d,pdjuli4.);put r $hex.;s=input(r,pdjuli4.);put s;run;
Which produces the following output in the log:
0060001F0
PDTIMEw.This informat reads a packed decimal representation of a time into a numeric time.
min max defaultVariable width 4 4 4
Exampledata _null_;d="0112825F"x;r=input(d,pdtime4.);put r;put r $time.;run;
Which produces the following output in the log:
4130511:28:25
Reference for language elementsVersion 3.3
342
RMFDURw.Reads durations stored in z/OS RMF (Resource Management Facility) records.
min max defaultVariable width 4 4 4
RMFSTAMPw.Reads time values stored in z/OS RMF (Resource Management Facility) records.
min max defaultVariable width 8 8 8
SHRSTAMPw.Reads timestamps from z/OS SHR records.
min max defaultVariable width 8 8 8
SMFSTAMPw.Reads timestamps from z/OS SMF records.
min max defaultVariable width 8 8 8
TIMEw.Reads a representation of a time in HH:MM:SS format into a numeric time.
min max defaultVariable width 5 32 8
Reference for language elementsVersion 3.3
343
Exampledata _null_;t="01:01:01";r=input(t,time9.);put r;run;
Which produces the following output in the log:
3661
TODSTAMPw.Reads the output of the z/OS STCK instruction and produces a datetime value, rather than a time ofday value.
min max defaultVariable width 1 8 8
TUw.Reads the output of the z/OS TIME macro with the TU option.
This informat produces a time of day as an unsigned 32 bit number. The low order bit is equal to onetimer unit. There are exactly 38,400 timer units per second, so a timer unit is approximately 26.041667microseconds.
min max defaultVariable width 4 4 4
YMDDTTMw.dReads datetimes in the form YY-MM-DD HH:SS or YYYY-MM-DD HH:SS into numeric datetimeobjects.
min max defaultVariable width 13 40 18
Reference for language elementsVersion 3.3
344
Exampledata _null_;d="2014-09-19 14:33";r=input(d, ymddttm20.);put r;run;
Which produces the following output in the log:
1726756380
YYMMDDw.Reads dates in the form YY-MM-DD or YYYY-MM-DD into numeric date objects.
min max defaultVariable width 6 32 6
Exampledata _null_;d="2014-09-19";r=input(d, yymmdd20.);put r;run;
Which produces the following output in the log:
19985
YYMMNw.Reads dates in the form YYYYMM or YYMM into numeric date objects.
min max defaultVariable width 4 6 4
Exampledata _null_;d="201409";r=input(d, yymmn6.);put r;run;
Reference for language elementsVersion 3.3
345
Which produces the following output in the log:
19967
YYQw.Reads yearly quarters in the form YYQn or YYYYQn into a numeric date, where n is 1,2,3 or 4.
min max defaultVariable width 4 32 6
Exampledata _null_;d="2014Q1";r=input(d, yyq6.);put r;run;
Which produces the following output in the log:
19724
ISO8601 date informatsInformats that represent date-time data according to the ISO 8601 standard.
$N8601Bw.dReads ISO 8601 datetimes, durations and intervals expressed in basic or extended form.
min max defaultVariable width 1 32767 50
Exampledata _null_;input d $n8601b.;put d;cards;P20140915T134200;run;
Reference for language elementsVersion 3.3
346
Which produces the following output in the log:
2014915134200FFD
$N8601Ew.dReads ISO 8601 datetimes, durations and intervals expressed in extended form only.
min max defaultVariable width 1 32767 50
Exampledata _null_;d="P2014-09-15T13:42:00"; /* Extended notation */conv = input(d, $n8601e.);put conv;run;
Which produces the following output in the log:
2014915134200FFD
B8601DAw.Converts a basic ISO 8601 YYYYMMDD form into a numeric date.
min max defaultVariable width 10 10 10
Exampledata _null_;d="19600101";conv=input(d,b8601da.);put conv;run;
Which produces the following output in the log:
0
Reference for language elementsVersion 3.3
347
B8601DNw.Reads a basic ISO 8601 YYYYMMDD form into a numeric datetime in which the time component is setto zero.
min max defaultVariable width 10 10 10
Exampledata _null_;d="19600101";conv=input(d,b8601dn.);put conv;run;
Which produces the following output in the log:
0
B8601DTw.Converts a basic ISO 8601 YYYYMMDDTHHMMSS form into a numeric datetime.
min max defaultVariable width 19 26 19
Exampledata _null_;dt="19600101T000001";conv=input(dt,b8601dt.);put conv;run;
Which produces the following output in the log:
1
Reference for language elementsVersion 3.3
348
B8601DZw.Reads a UTC ISO 8601 YYYYMMDDTHHMMSS+|=HHMM datetime and timezone form into a numericdatetime.
min max defaultVariable width 20 35 26
Exampledata _null_;dt="19600101T000000+0000";conv=input(dt,b8601dz.);put conv;run;
Which produces the following output in the log:
0
B8601LZw.Converts an input in ISO 8601 basic UTC time notation: HHMMSS+|-HHMM to a numeric time.
This informat is an alias of B8601TZ.
min max defaultVariable width 9 20 14
B8601TMw.Reads a basic ISO 8601 time form: HHMMSS into a numeric time.
min max defaultVariable width 6 15 8
Exampledata _null_;t="010000";conv=input(t,b8601tm.);put conv;run;
Reference for language elementsVersion 3.3
349
Which produces the following output in the log:
3600
B8601TZw.Converts an input in ISO 8601 basic UTC time notation: HHMMSS+|-HHMM to a numeric time.
min max defaultVariable width 9 20 14
Exampledata _null_;t="152001-0500";conv=input(t,b8601tz20.20);put conv;run;
Which produces the following output in the log:
73201
E8601DAw.Reads an extended ISO 8601 YYYY-MM-DD form into a numeric date.
min max defaultVariable width 10 10 10
Exampledata _null_;d="2014-09-18";e="1960-01-01";r=input(d, E8601DA.);s=input(e, E8601DA.);put r;put s;
Which produces the following output in the log:
199840
Reference for language elementsVersion 3.3
350
E8601DNw.Reads an extended ISO 8601 YYYY-MM-DD form into a numeric datetime.
min max defaultVariable width 10 10 10
Exampledata _null_;d="2014-09-18";e="1960-01-01";r=input(d, E8601DN.);s=input(e, E8601DN.);put r;put s;
Which produces the following output in the log:
17266176000
E8601DTw.Reads an extended ISO 8601 YYYY-MM-DDTHH:MM:SS datetime form into a numeric datetime.
min max defaultVariable width 19 26 19
Exampledata _null_; d="2014-09-17T09:25:00";e="1960-01-01T00:00:00";r=input(d, E8601DT.);s=input(e, E8601DT.);put r;put s;run;
Which produces the following output in the log:
17265651000
Reference for language elementsVersion 3.3
351
E8601DZw.Reads an extended UTC ISO 8601 YYYY-MM-DDTHH:MM:SS+|=HH:MM datetime and timezone forminto a numeric datetime.
min max defaultVariable width 20 35 26
Exampledata _null_; d="2014-09-17T09:25:00+09:00";e="1960-01-01T00:00:00+00:00";r=input(d, E8601DZ.);s=input(e, E8601DZ.);put r;put s;run;
Which produces the following output in the log:
17265327000
E8601TMw.Reads an extended ISO 8601 form: HH:MM:SS into a numeric time.
min max defaultVariable width 8 15 8
Exampledata _null_; d="06:45:00";r=input(d, E8601TM.);put r;run;
Which produces the following output in the log:
24300
Reference for language elementsVersion 3.3
352
E8601TZw.Reads an ISO 8601 extended time notation HH:MM:SS+|-HH:MM form into a numeric time.
min max defaultVariable width 9 20 14
Exampledata _null_; d="06:45:00+01:15";r=input(d, E8601TZ.);put r;run;
Which produces the following output in the log:
19800
E8601LZw.Reads an ISO 8601 extended time notation HH:MM:SS+|-HH:MM form into a numeric time.
This informat is an alias of E8601TZ.
min max defaultVariable width 9 20 14
IS8601DAw.Reads an extended ISO 8601 YYYY-MM-DD form into a numeric date.
This informat is an alias of E8601DA.
min max defaultVariable width 10 10 10
IS8601DNw.Reads an extended ISO 8601 YYYY-MM-DD form into a numeric datetime.
This informat is an alias of E8601DN.
Reference for language elementsVersion 3.3
353
min max defaultVariable width 10 10 10
IS8601DTw.Reads an extended ISO 8601 YYYY-MM-DDTHH:MM:SS datetime form into a numeric datetime.
This informat is an alias of E8601DT.
min max defaultVariable width 19 26 19
IS8601DZw.Reads an extended UTC ISO 8601 YYYY-MM-DDTHH:MM:SS+|=HH:MM datetime and timezone forminto a numeric datetime.
This informat is an alias of E8601DZ.
min max defaultVariable width 20 35 26
IS8601LZw.Reads an ISO 8601 extended time notation HH:MM:SS+|-HH:MM form into a numeric time.
This informat is an alias of E8601LZ.
min max defaultVariable width 9 20 14
IS8601TMw.Reads an extended ISO 8601 form: HH:MM:SS into a numeric time.
This informat is an alias of E8601TM.
min max defaultVariable width 8 15 8
Reference for language elementsVersion 3.3
354
IS8601TZw.Reads an ISO 8601 extended time notation HH:MM:SS+|-HH:MM form into a numeric time.
This informat is an alias of E8601TZ.
min max defaultVariable width 9 20 14
ND8601DAw.Reads an extended ISO 8601 YYYY-MM-DD form into a numeric date.
This informat is an alias of B8601DA.
min max defaultVariable width 10 10 10
ND8601DNw.Reads a basic ISO 8601 YYYYMMDD form into a numeric datetime in which the time component is setto zero.
This informat is an alias of B8601DN.
min max defaultVariable width 10 10 10
ND8601DTw.Converts a basic ISO 8601 YYYYMMDDTHHMMSS form into a numeric datetime.
This informat is an alias of B8601DT.
min max defaultVariable width 19 26 19
Reference for language elementsVersion 3.3
355
ND8601DZw.Reads an extended UTC ISO 8601 YYYY-MM-DDTHH:MM:SS+|=HH:MM datetime and timezone forminto a numeric datetime.
This informat is an alias of B8601DZ.
min max defaultVariable width 20 35 26
ND8601LZw.Converts an input in ISO 8601 basic UTC time notation: HHMMSS+|-HHMM to a numeric time.
This informat is an alias of B8601LZ.
min max defaultVariable width 9 20 14
ND8601TMw.Reads a basic ISO 8601 time form: HHMMSS into a numeric time.
This informat is an alias of B8601TM.
min max defaultVariable width 6 15 8
ND8601TZw.Converts an input in ISO 8601 basic UTC time notation: HHMMSS+|-HHMM to a numeric time.
This is an alias of B8601TZ.
min max defaultVariable width 9 20 14
Reference for language elementsVersion 3.3
356
NLS-sensitive date informatsInformats that represent date-time data based on a specified locale value.
NLDATEw.Reads a locale-specific date representation into a numeric date value.
min max defaultVariable width 1 32 12
Exampleoptions locale=en_GB;data _null_;d=input("23 September 2014", nldate19.);put d=;run;
options locale=fr_FR;data _null_;e=input("23 septembre 2014", nldate19.);put e=;run;
Which produces the following output in the log:
d=19989...e=19989
NLDATMw.Reads a locale-specific datetime representation into a numeric datetime.
min max defaultVariable width 1 50 20
Reference for language elementsVersion 3.3
357
Exampleoptions locale=en_GB;data _null_;d=input("23 September 2014 11:06:00", nldatm26.);put d=;run;
options locale=fr_FR;data _null_;e=input("23 septembre 2014 11:06:00", nldatm26.);put e=;run;
Which produces the following output in the log:
d=1727089560 ...e=1727089560
NLTIMEw.Reads a locale-specific time representation into a time value.
min max defaultVariable width 1 32 10
Exampleoptions locale=en_GB;data _null_;d=input("11:06:00", nltime26.);put d=;run;
options locale=fr_FR;data _null_;e=input("11:06:00", nltime26.);put e=;run;
Which produces the following output in the log:
d=39960...e=39960
Reference for language elementsVersion 3.3
358
NLS-sensitive money informatsInformats that represent numeric data as monetary values for a specified locale.
NLMNYw.dReads a locale-specific money-format representation into a numeric amount of money.
min max defaultVariable width 1 32 8
Exampledata _null_;options locale=en_US;am="$10.51";r=input(am, nlmny.);put r;run;
Which produces the following output in the log:
10.51
NLMNYIw.dReads a money-format representation containing a string locale currency code into a numeric moneyvalue.
min max defaultVariable width 1 32 8
Exampledata _null_;options locale=en_US;am="USD10.51";r=input(am, nlmnyi.);put r;run;
Which produces the following output in the log:
10.51
Reference for language elementsVersion 3.3
359
NLMNIXXXw.dReads a country-specific currency form into a numeric amount.
xxx in the format denotes the currency, and is specified using one of:
• AED UAE Dirham• AUD Australia Dollar• BGN Bulgaria Lev• BRL Brazil Real• CAD Canada Dollar• CHF Switzerland Franc• CNY China Yuan Renminbi• CZK Czech Republic Koruna• DKK Denmark Krone• EGP Egypt Pound• EUR Euro• GBP Great Britain Pound• HKD Hong Kong Dollar• HRK Croatia Kuna• HUF Hungary Forint• IDR Indonesia Rupiah• ILS Israel Shekel• INR India Rupee• JPY Japan Yen• KRW South Korea Won• LTL Lithuania Litas• LVL Latvia Lat• MOP Macau Pataca• MXN Mexico Peso• MYR Malaysia Ringgit• NOK Norway Krone• NZD New Zealand Dollar• PLN Poland Zloty• RUB Russia, Ruble• SEK Sweden Krona• SGD Singapore Dollar
Reference for language elementsVersion 3.3
360
• THB Thailand Baht• TRY Turkey Lira• TWD Taiwan New Dollar• USD United States Dollar• ZAR South Africa Rand
min max defaultVariable width 1 32 8
Exampledata _null_;am="AED10.51";r=input(am, nlmniaed.);put r;run;
Which produces the following output in the log:
10.51
NLMNLXXXw.dReads a local form of a country-specific currency into a numeric amount.
xxx in the format denotes the currency, and is specified using one of:
• AED UAE Dirham• AUD Australia Dollar• BGN Bulgaria Lev• BRL Brazil Real• CAD Canada Dollar• CHF Switzerland Franc• CNY China Yuan Renminbi• CZK Czech Republic Koruna• DKK Denmark Krone• EGP Egypt Pound• EUR Euro• GBP Great Britain Pound• HKD Hong Kong Dollar• HRK Croatia Kuna• HUF Hungary Forint
Reference for language elementsVersion 3.3
361
• IDR Indonesia Rupiah• ILS Israel Shekel• INR India Rupee• JPY Japan Yen• KRW South Korea Won• LTL Lithuania Litas• LVL Latvia Lat• MOP Macau Pataca• MXN Mexico Peso• MYR Malaysia Ringgit• NOK Norway Krone• NZD New Zealand Dollar• PLN Poland Zloty• RUB Russia, Ruble• SEK Sweden Krona• SGD Singapore Dollar• THB Thailand Baht• TRY Turkey Lira• TWD Taiwan New Dollar• USD United States Dollar• ZAR South Africa Rand
min max defaultVariable width 1 32 8
Exampledata _null_;am="€10.51";r=input(am, nlmnleur.);put r;run;
Which produces the following output in the log:
10.51
NLS-sensitive numeric informatsInformats that represent numeric data according to a specified locale.
Reference for language elementsVersion 3.3
362
NLNUMw.dReads locale-specific numeric data into a numeric form.
min max defaultVariable width 1 32 8
Exampledata _null_;options locale="en_GB";am="1,254,234";r=input(am, nlnum32.);put r;run;
Which produces the following output in the log:
1254234
NLNUMIw.dReads locale-specific international format numbers into a numeric value.
min max defaultVariable width 1 32 8
Exampledata _null_;options locale="en_GB";am="1,254,234";r=input(am, nlnumi32.);put r;run;
Which produces the following output in the log:
1254234
Reference for language elementsVersion 3.3
363
NLPCTw.dReads a locale-specific percentage expression into a numeric value.
min max defaultVariable width 1 32 8
Exampledata _null_;options locale="en_GB";am="10 %";r=input(am, nlpct3.2);put r;run;
Which produces the following output in the log:
0.1
NLPCTIReads an international, session-locale percentage into a numeric value.
min max defaultVariable width 1 32 8
Exampledata _null_;options locale="en_GB";am="10 %";r=input(am, nlpcti3.2);put r;run;
Which produces the following output in the log:
0.1
Reference for language elementsVersion 3.3
364
Components
HASH Component
Supported statements• HASH• ADD• CHECK• CLEAR• DECLARE• DEFINEDATA• DEFINEDONE• DEFINEKEY• DELETE• EQUALS• FIND• FIND_NEXT• FIND_PREV• HAS_NEXT• HAS_PREV• ITEM_SIZE• NUM_ITEMS• OUTPUT• REF• REMOVE• REMOVEDUP• REPLACE• REPLACEDUP• SUM• SUMDUP
Reference for language elementsVersion 3.3
365
HASHHASH [ ( { argument, … } ) ]
argument[ DATASET : dataset with options i |
DUPLICATE :[ "replace" |
"r" |"error" |"e"
] |HASHEXP : integer |MULTIDATA : yes-no |SUMINC : "variable" |ORDERED : yes-no
]
i See Input dataset.
yes-no[ "yes" | "y" | "no" | "n" ]
ADDADD ( { KEY : key-value , … } { DATA : value , … } );
CHECKCHECK ( { KEY : key-value , … } );
CLEARCLEAR ( );
Reference for language elementsVersion 3.3
366
DECLAREDECLARE component-type component-nameReference
[ ( { component-argument : value , … } )] ;
DEFINEDATADEFINEDATA ( [ ALL : "YES" | { variable-name , … } ] );
DEFINEDONEDEFINEDONE ( MEMRC : "char-value" );
DEFINEKEYDEFINEKEY ( [ ALL : "YES" | { "variable-name" , … } ] );
DELETEDELETE ( );
EQUALSEQUALS ( HASH : "other-hash-name" RESULT : "variable-name" );
FINDFIND ( { KEY : "value" , … } );
Reference for language elementsVersion 3.3
367
FIND_NEXTFIND_NEXT ( );
FIND_PREVFIND_PREV ( );
HAS_NEXTHAS_NEXT ( RESULT : variable );
HAS_PREVHAS_PREV ( RESULT : variable );
ITEM_SIZEITEM_SIZE ;
NUM_ITEMSNUM_ITEMS ;
OUTPUT
OUTPUT ( { DATASET : dataset-name i, … } );
i See Dataset.
Reference for language elementsVersion 3.3
368
REFREF ( { KEY : key-value , … } { DATA : value , … } );
REMOVEREMOVE ( { KEY : "key-value" , … } );
REMOVEDUPREMOVEDUP ( { KEY : "key-value" , … } );
REPLACEREPLACE ( { KEY : "key-value" , … } { DATA : value , … } );
REPLACEDUPREPLACEDUP ( { DATA : value , … } );
SUMSUM ( SUM : variable );
SUMDUPSUMDUP ( SUM : variable );
Reference for language elementsVersion 3.3
369
HITER Component
Supported statements• HITER• FIRST• LAST• NEXT• PREV• SUM
HITERHITER
[ ( { "HITER-object-name" , … } )]
FIRSTFIRST ( );
LASTLAST ( );
NEXTNEXT ( );
PREVPREV ( );
Reference for language elementsVersion 3.3
370
SUMSUM ( SUM : variable );
JAVAOBJ Component
Supported statements• JAVAOBJ• CALLSTATICtypeMETHOD• CALLtypeMETHOD• CALLSTATICVOIDMETHOD• CALLVOIDMETHOD• EXCEPTIONCHECK• EXCEPTIONCLEAR• EXCEPTIONDESCRIBE• FLUSHJAVAOUTPUT• GETSTATICtypeFIELD• GETtypeFIELD• SETSTATICtypeFIELD• SETtypeFIELD
JAVAOBJJAVAOBJ
[ ( class_identifier[ { constructor-argument , … }] )
]
class identifier[ { package-name / … } ] class-name [ { $ nested-class-name … } ]
Reference for language elementsVersion 3.3
371
JAVAOBJ type[ BYTE |
CHAR |SHORT |INT |LONG |FLOAT |DOUBLE |STRING
]
Substitute term type by one of these types in the component names that follow.
CALLSTATICtypeMETHODCALLSTATICtypeMETHOD ( method-name [ { method-argument , … } ] , return-variable );
CALLtypeMETHODCALLtypeMETHOD ( method-name [ { method-argument , … } ] , return-variable );
CALLSTATICVOIDMETHODCALLSTATICVOIDMETHOD ( method-name [ { method-argument , … } ] );
CALLVOIDMETHODCALLVOIDMETHOD ( method-name [ { method-argument , … } ] );
EXCEPTIONCHECKEXCEPTIONCHECK ( numeric-variable );
Reference for language elementsVersion 3.3
372
EXCEPTIONCLEAREXCEPTIONCLEAR ( );
EXCEPTIONDESCRIBEEXCEPTIONDESCRIBE ( boolean-value );
FLUSHJAVAOUTPUTFLUSHJAVAOUTPUT ( );
GETSTATICtypeFIELDGETSTATICtypeFIELD ( field-name , return-variable );
GETtypeFIELDGETtypeFIELD ( field-name , return-variable );
SETSTATICtypeFIELDSETSTATICtypeFIELD ( field-name , value );
SETtypeFIELDSETtypeFIELD ( field-name , value );
Reference for language elementsVersion 3.3
373
DATA Step Statements
_NEW_name = _NEW_ component-type (
[ { component-argument : value , … }] ) ;
ABORTABORT [ | ABEND | RETURN ] [ exit-code ] [ NOLIST ] ;
ARRAYARRAY array-name { [ * | { dimension , … } ] } [ $ ] [ default-length ] [ _temporary_ |
variable-listi ] ;
i See Variable Lists.
ATTRIBATTRIB { variable-list i
{ FORMAT = format |INFORMAT = informat |LABEL = "label" |LENGTH = [ $ ] length
… } … } ;
i See Variable Lists.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
Reference for language elementsVersion 3.3
374
CALLCALL routine ( [ { argument , … } ] );
CARDSCARDS ;
CARDS4CARDS4 ;
CONTINUECONTINUE ;
DATADATA
[ |_NULL_ |{ output-data-set-with-options i … }
] ;
i See Output dataset.
DATALINESDATALINES ; data-lines
DATALINES4DATALINES4 ; data-lines
Reference for language elementsVersion 3.3
375
DECLAREDECLARE component-type name (
[ { component-argument : value , … }] ) ;
DELETEDELETE ;
DESCRIBEDESCRIBE ;
This data step statement is only valid for data step views or stored compiled data steps and instructsWPS to print the source of a stored compiled data step or data step view to the system log. It preventsthe implicit execution of a stored compiled data step.
DODO ; statements END ;
DO, iterativeDO index-variable = { do-specification, … } ; statements END ;
do-specificationstart [ TO stop ] [ BY increment ]
[ WHILE ( expression i)][ UNTIL ( expression ii)]
i See Language of SAS Expressions.ii See Language of SAS Expressions.
Reference for language elementsVersion 3.3
376
DO UNTILDO UNTIL ( expression i); statements END ;
i See Language of SAS Expressions.
DO WHILEDO WHILE ( expression i); statements END ;
i See Language of SAS Expressions.
DROPDROP variable-list i;
i See Variable Lists.
ENDEND ;
ERRORERROR [ message ]
EXECUTEEXECUTE ;
This data step statement is only valid for stored compiled data steps and instructs WPS to execute astored compiled dataset. It is implicit unless the DESCRIBE data step statement has been specified.
Reference for language elementsVersion 3.3
377
FILEIn general terms, a FILE statement identifies an external file to be used by the DATA step into which towrite output from a corresponding PUT statement.
When used with ODS, via the FILE-PRINT-ODS statement, it lists the variables to include in the ODSoutput, and must be used if you have specified the _ODS_ option in the PUT statement.
Note:The _ODS_ option determines that values are written to the data component for each of the variablesdefined as columns via the COLUMNS statement below, using the number of lines specified via N =Number below.
Caution:The FILE-PRINT-ODS statement must precede the PUT _ODS_ statement in the DATA step.
When the FILE statement tries to write beyond the final column, the resultant behaviour can becontrolled using the following overflow controls:
• DROPOVER. This discards those values that would otherwise be written beyond the final column.• FLOWOVER. This creates new lines for those values that would otherwise be written beyond the final
column.• STOPOVER. This immediately terminates processing of the DATA step, and generates an error
message.
Syntax:
FILE
[ LOG |PRINT |file-print-ods |external-filei
] { option … } ;
i See External Files.
file-print-odsPRINT ODS
{ N = number |[ DROPOVER | FLOWOVER | STOPOVER ] |COLUMNS = (
{ column-name |[ = variable-name
[ (
{ DYNAMIC = dynamic-value-name
Reference for language elementsVersion 3.3
378
[ = [ variable-name | constant ] ] |
FORMAT = format-name |GENERIC = [ ON | OFF ] |LABEL = column-label
… } )]
]… } ) |
DYNAMIC = ( { dynamic-value-name = [ | variable-name | constant ] … } ) |GENERIC = [ ON | OFF ] |LABEL = column-label |OBJECT = object-name |OBJECTLABEL = object-label |TEMPLATE = table-definition-name |VARIABLES = (
{ variable-name |[ = column-name
[ (
{ DYNAMIC = dynamic-value-name[ = [ variable-name | constant ] ] |
FORMAT = format-name |GENERIC = [ ON | OFF ] |LABEL = column-label
… } )]
]… } )
… }
option[ [ BLKSIZE | BLK ] = block-size |
BUFND = bufnd |BUFNI = bufni |CLOSE = disposition |[ COLUMN | COL ] = variable |DCB = fileref |[ DELIMITER | DLM ] = [ "delimiter-char" | character-variable ] |DEVTYPE = variable |DLMSOPT = [ "T" | "t" ] |DLMSTR = [ "delimiter-string" | character-variable ] |DROPOVER |DSCB = variable |DSD |[ FEEDBACK | FDBK ] = variable |
Reference for language elementsVersion 3.3
379
FILENAME = variable |FILEVAR = variable |FLOWOVER |
[ FOOTNOTES |FOOTNOTE |NOFOOTNOTES |NOFOOTNOTE
] |HEADER = label |IGNOREDOSEOF |JFCB = variable |KEYLEN = variable |KEYPOS = variable |LINE = variable |LINESIZE = linesize |LINESLEFT = variable |LRECL = record-length |MOD |N = [ available-lines | PAGESIZE | PS ] |OLD |[ PAD | NOPAD ] |PAGESIZE = pagesize |PASSWD = "delimiter-string" |[ PRINT | NOPRINT ] |RECFM =
[ D |F |FB |N |P |S |S370V |S370VB |S370VS |S370VBS |S370VSTREAM |S370VSSTREAM |U |V |VB
] |RECORDS = variable |RESET |RRN = variable |STOPOVER |TERMSTR = [ CR | CRLF | LF | NL | NULL ] |
Reference for language elementsVersion 3.3
380
[ TITLES |TITLE |NOTITLES |NOTITLE
] |UCBNAME = variable |[ VOLUME | VOLUMES ] = variable |VSAM |_FILE_ = variable
]
FORMATFORMAT
{ variable-list i format |DEFAULT = format_name
… } ;
i See Variable Lists.
GO TO[ GO TO | GOTO ] label ;
IF, subsettingIF condition i;
i See Language of SAS Expressions.
IF-THEN/ELSEIF condition iTHEN true-executable-statement
[ ELSE false-executable-statement]
i See Language of SAS Expressions.
Reference for language elementsVersion 3.3
381
INFILEINFILE
[ [ CARDS |DATALINES |CARDS4 |DATALINES4
] |external-filei
] { option … } ;
i See External Files.
option[ [ BACKWARD | BWD ] |
[ BLKSIZE | BLK ] = block-size |BUFND = bufnd |BUFNI = bufnd |
[ CARDS |CARDS4 |DATALINES |DATALINES4
] |CCHHR = variable |[ COLUMN | COL ] = variable |[ CONTROLINTERVAL | CTLINTV | CNV ] |DCB = fileref |[ DELIMITER | DLM ] = "delimiter-char" |DLMSOPT = " { I | i | T | t … } " |DLMSTR = [ "delimiter-string" | character-variable ] |DSCB = variable |DSD |END = variable |EOF = label |EOV = variable |ERASE = variable |[ EXPANDTABS | NOEXPANDTABS ] |[ FEEDBACK | FDBK ] = variable |FILENAME = variable |FILEVAR = variable |FIRSTOBS = n |FLOWOVER |GENKEY |IGNOREDOSEOF |
Reference for language elementsVersion 3.3
382
JFCB = variable |KEY = variable |KEYGE |KEYLEN = variable |KEYPOS = variable |LENGTH = variable |LINE = variable |LINESIZE = linesize |LRECL = record-length |MISSOVER |[ NORLS | NRLS | RLS ] |N = available-lines |OBS = [ observation-number | MAX ] |[ PAD | NOPAD ] |PASSWD = "delimiter-string" |[ PRINT | NOPRINT ] |RBA = variable |RECFM = record-format |RECORDS = variable |RESET |RLS |RLSREAD = [ NRI | CR | CRE ] |RRN = variable |SCANOVER |[ SEQUENTIAL | SEQ ] |[ SHAREBUFFERS | SHAREBUFS ] |SKIP |START = variable |STOPOVER |TERMSTR = [ CR | CRLF | LF | NL | NULL ] |TRUNCOVER |[ UNBUFFERED | UNBUF ] |UPDATE = variable |[ VOLUME | VOLUMES ] = variable |VSAM |_INFILE_ = variable
]
INFORMATINFORMAT { variable-list i informat … } ;
i See Variable Lists.
Reference for language elementsVersion 3.3
383
INPUTINPUT
{ pointer-control |column-input |list-input |formatted-input |informat-list
… } [ | @ | @@ ] ;
pointer-control[ @
[ n |numeric-variable |( expression i)
] |+
[ n |numeric-variable |( expression ii)
] |#
[ n |numeric-variable |( expression iii)
] |/
]
i See Language of SAS Expressions.ii See Language of SAS Expressions.iii See Language of SASExpressions.
column-inputvariable [ $ ] start-column [ - end-column ]
formatted-input[ variable informat iv |
( variable-list v)( informat-list )]
iv See INFORMAT.v See Variable Lists.
Reference for language elementsVersion 3.3
384
informat-list{ [ n * ] informat vi |
pointer-control… }
vi See INFORMAT.
list-input[ variable [ $ ] |
variable : informat vii |variable & [ informat ] viii |variable ~ [ informat ] ix
]
vii See INFORMAT.viii See INFORMAT.ix See INFORMAT.
KEEPKEEP variable-list i;
i See Variable Lists.
LABELLABEL { variable-list i= "label" … } ;
i See Variable Lists.
Labels,Statementlabel: statement ;
LEAVELEAVE ;
Reference for language elementsVersion 3.3
385
LENGTHLENGTH { variable-list i[ $ ] length … }
[ DEFAULT = default_length] ;
i See Variable Lists.
LINKLINK label ;
LISTLIST ;
MERGEMERGE { input-data-set-with-options i … } [ END = variable ] ;
i See Input dataset.
MODIFYMODIFY master-ds i
[ |option1 |option2 |option3 |option4
] ;
i See Input dataset.
Reference for language elementsVersion 3.3
386
option1trans-ds ii
{ |NOBS = variable |END = variable |UPDATEMODE = [ MISSINGCHECK | NOMISSINGCHECK ]
… }
ii See Input dataset.
option2KEY = index { | NOBS = variable | END = variable … }
option3POINT = index [ NOBS = variable ]
option4[ NOBS = variable | END = variable ]
OUTPUTOUTPUT { data-set-name … } ;
PUTIn general terms, a PUT statement determines which lines are written, and controls how and where theyare written. When output is to be written to an external file, this is specified in a corresponding FILEstatement.
When used with the _ODS_ option, it writes values to the data component for each of the variablesdefined as columns via the COLUMNS statement in the FILE-PRINT-ODS statement (refer to the FILEstatement).
Caution:The FILE-PRINT-ODS statement must precede the PUT _ODS_ statement in the DATA step.
Syntax:
Reference for language elementsVersion 3.3
387
PUT
{ _ALL_ |_ODS_ |[ n * ] "character-string" |"character-string" |column-output |format-list |formatted-output |list-output |named-output |pointer-control
… } [ | @ | @@ ] ;
pointer-control[ @
[ n |numeric-variable |( expression i)
] |+
[ n |numeric-variable |( expression ii)
] |#
[ n |numeric-variable |( expression iii)
] |/ |_BLANKPAGE_ |_PAGE_
]
i See Language of SAS Expressions.ii See Language of SAS Expressions.iii See Language of SASExpressions.
column-outputvariable start-column [ - end-column ]
Reference for language elementsVersion 3.3
388
formatted-output[ variable [ ~ ] format iv |
( variable-list v)( format-list )]
iv See FORMAT.v See Variable Lists.
format-list{ [ n * ] format vi |
"character-string" |pointer-control
… }
vi See FORMAT.
list-outputvariable
[ |: format vii |: ~ format viii |~ : format ix |& format x |& ~ format xi |~ & format xii
]
vii See FORMAT.viii See FORMAT.ix See FORMAT.x See FORMAT.xi See FORMAT.xii SeeFORMAT.
named-outputvariable =
[ |start-column [ - end-column ] |formatxiii
]
xiii See FORMAT.
Reference for language elementsVersion 3.3
389
PUTLOGPUTLOG [ message ]
REDIRECTREDIRECT [ INPUT | OUTPUT ] { old-dataset-name = new-dataset-name … } ;
This data step statement is only valid for stored compiled data steps and changes which datasets thestored compiled data step will use for input or output. It may be used multiple times in a data step.
REMOVEREMOVE { data-set-name … } ;
RENAMERENAME { old-variable-name = new-variable-name … } ;
REPLACEREPLACE { data-set-name … } ;
RETAINRETAIN { variable-list i
[ |initial-value |( { initial-value … } )
] … } ;
i See Variable Lists.
Reference for language elementsVersion 3.3
390
RETURNRETURN ;
SELECTSELECT [ ( expression i) ] ; { when-clause … } [ otherwise-clause ] END ;
i See Language of SAS Expressions.
when-clauseWHEN ( { expression ii, … } ) statement
ii See Language of SAS Expressions.
otherwise-clause[ OTHERWISE | OTHER ] statement
SETSET { input-data-set-with-options i … } { option … } ;
i See Input dataset.
option[ END = variable |
KEY = index [ / UNIQUE ] |NOBS = variable |POINT = variable
]
SKIPSKIP n ;
Reference for language elementsVersion 3.3
391
STOPSTOP ;
Sumvariable + expression ;
UPDATEUPDATE input-data-set-with-options itransaction-dataset-with-options ii[ END =
variable ][ UPDATEMODE = [ MISSINGCHECK | NOMISSINGCHECK ] ] BY by-variable ;
i See Input dataset.ii See Input dataset.
WHEREWHERE condition ;
DO, iterativeDO index-variable = { do-specification, … } ; statements END ;
do-specificationstart [ TO stop ] [ BY increment ]
[ WHILE ( expression i)][ UNTIL ( expression ii)]
i See Language of SAS Expressions.ii See Language of SAS Expressions.
Reference for language elementsVersion 3.3
392
DO UNTILDO UNTIL ( expression i); statements END ;
i See Language of SAS Expressions.
DO WHILEDO WHILE ( expression i); statements END ;
i See Language of SAS Expressions.
GO TO[ GO TO | GOTO ] label ;
IF, subsettingIF condition i;
i See Language of SAS Expressions.
IF-THEN/ELSEIF condition iTHEN true-executable-statement
[ ELSE false-executable-statement]
i See Language of SAS Expressions.
Reference for language elementsVersion 3.3
393
Describing data in a DATA step
CARDSCARDS ;
CARDS4CARDS4 ;
DATALINESDATALINES ; data-lines
DATALINES4DATALINES4 ; data-lines
Data Step Functions and Call Routines
Bitwise functionsUse bitwise functions to manipulate bits in variables using AND, OR, XOR and other operations.
You might need to use these functions with datasets that contain bit-like data in variables; for example,where Yes and No are represented by 1 and 0.
BANDReturns the value result of combining arguments using bitwise AND.
BAND ( number1 , number2 )
Reference for language elementsVersion 3.3
394
Combines the values of two arguments using a bitwise AND. Each bit in the arguments is compared,and if two corresponding bits are 1, the resulting bit is 1. Any other combination of corresponding bitsresults in a bit value of 0. The result is returned as a numeric value.
Return type: Numeric
number1
Type: Numeric
The first value to be combined.
number2
Type: Numeric
The second value to be combined.
Each number is interpreted as a 32-bit integer. If you pass a number that is not an integer, any fractionis ignored and the number converted to an integer. A runtime error is returned if the integer is less thanzero or greater than 232-1.
ExampleIn the following example two numbers are combined using the BAND function. The result is written to thelog.
DATA _NULL_; result=BAND(10, 12); put "The result is: " result; RUN;
This produces the following output:
The result is: 8
The numbers are combined as the binaries 1010 and 1100; the function creates the binary 1000,which is returned as the corresponding decimal 8.
BORReturn the result of combining two arguments using a bitwise OR.
BOR ( number1 , number2 )
Combines the values of two arguments using a bitwise OR. Each bit in the arguments is compared; ifcorresponding bits are 0, the resulting bit is 0. Any other combination of corresponding bits results in abit value of 1. The result is returned as a numeric value.
Return type: Numeric
Reference for language elementsVersion 3.3
395
number1
Type: Numeric
The first value to be combined.
number2
Type: Numeric
The second value to be combined.
Each number is interpreted as a 32-bit integer. If you pass a number that is not an integer, any fractionis ignored and the number converted to an integer. A runtime error is returned if the integer is less thanzero or greater than 232-1.
ExampleIn the following example, two numbers are combined using the BOR function. The result is written to thelog.
DATA _NULL; result=BOR(10, 12); PUT "The result is: " result; run;
This produces the following output:
The result is: 14
The numbers are combined as the binaries 1010 and 1100; the function creates the binary 1110,which is returned as the corresponding decimal 14.
BXORReturns the result of combining two arguments using a bitwise XOR.
BXOR ( number1 , number2 )
Combines the values of two arguments using a bitwise XOR. Each bit in the arguments is compared;the function adds the bits in the corresponding location of number1 and number2, and discards thecarry. The result is 0 when two 0s or two 1s correspond; otherwise the result is 1. For example, if 0 inone argument corresponds with 0 in the other, then the result is 0. The result of the function is returnedas a numeric value.
Return type: Numeric
number1
Type: Numeric
Reference for language elementsVersion 3.3
396
The first value to be combined.
number2
Type: Numeric
The second value to be combined.
Each number is interpreted as a 32-bit integer. If you pass a number that is not an integer, any fractionis ignored and the number converted to an integer. A runtime error is returned if the integer is less thanzero or greater than 232-1.
ExampleIn the following example, two numbers are combined using the BXOR function. The result is written tothe log.
DATA _NULL_; result=BXOR(10, 12); PUT "The result is: " result; run;
This produces the following output:
The result is: 6
The numbers are combined as the binaries 1010 and 1100; the function creates the binary 0110,which is returned as the corresponding decimal 6.
BNOTReturns the result of swap bit values using a bitwise NOT.
BNOT ( number )
Swaps the values of each bit in an argument using a bitwise NOT. The result is 0 if a bit is 1, or 1 if a bitis 0.
Return type: Numeric
number
Type: Numeric
The value to be bit-swapped.
Each number is interpreted as a 32-bit integer. If you pass a number that is not an integer, any fractionis ignored and the number converted to an integer. A runtime error is returned if the integer is less thanzero or greater than 232-1.
Reference for language elementsVersion 3.3
397
ExampleIn the following example, the binary digits of a number are swapped using the BNOT function. The resultis written to the log.
DATA _NULL_; result=BNOT(0); PUT "The result is: " result; run;
This produces the following output:
The result is: 4294967295
The decimal number 0 is converted to the 32-bit binary number00000000000000000000000000000000; this function creates the binary11111111111111111111111111111111 which is returned as the corresponding decimal integer,4294967295.
BLSHIFTReturns the result of shifting the bits of an argument to the left.
BLSHIFT ( number , shift-amt )
Performs a left bit-shift, which moves the bits in a value to the left. The bits lost by the shift at theleft-hand end of the value are replaced by zeros at the right-hand end of the value. You can specifythe number of bits to be shifted. For example, if the binary value 0101 is bit-shifted to the left by oneposition, the result will be 1010. If the binary value 001101 is bit-shifted to the left by two positions, theresult will be 110100.
Return type: Numeric
number
Type: Numeric
The value to be bit-shifted to the left.
shift-amt
Type: Numeric
The number of bits to be shifted.
number is interpreted as a 32-bit integer. If you pass a number that is not an integer, any fraction isignored and the number converted to an integer. A runtime error is returned if the integer is less thanzero or greater than 232-1.
Reference for language elementsVersion 3.3
398
ExampleIn the following example, the binary digits of a number are bit-shifted to the left by two digits. The resultis written to the log.
DATA _NULL_; result=BLSHIFT(75,2); PUT "The result is: " result;run;
This produces the following output:
The result is: 300
The number 75 corresponds to the binary 001001011; a left-shift of two digits results in 100101100,which is returned as the corresponding decimal, 300.
BRSHIFTReturns the result of shift the bits of an argument to the right.
BRSHIFT ( number , shift-amt )
Performs a right bit-shift, which moves the bits in a value to the right. The bits lost by the shift at theright-hand end of the value are replaced by zeroes at the left-hand end of the string. You can specifythe number of bits to be shifted. For example, if the binary value 101 is bit-shifted to the right by oneposition, the result will be 010. If the binary value 1101 is bit-shifted to the right by two positions, theresult will be 0011.
Return type: Numeric
number
Type: Numeric
The value to be bit-shifted to the right.
shift-amt
Type: Numeric
The number of bits to be shifted.
argument-1 is, however, interpreted as a 32-bit integer. If you pass a number that is not an integer, anyfraction is ignored and the number converted to an integer. A runtime error is returned if the integer isless than zero or greater than 232-1.
Reference for language elementsVersion 3.3
399
ExampleIn the following example, the binary digits of a number are bit-shifted to the right by two digits. Theresult is written to the log.
data example; result=BRSHIFT(75,2); PUT "The result is: " result; run;
This produces the following output:
The result is: 18
The decimal number 75 corresponds to the binary 001001011; a right-shift of two digits results in000010010, which is returned as the corresponding decimal 18.
Combination functions and call routinesThe functions and CALL routines in this group provide information on combinations and permutations;for example, returning the number of possible combinations of four items selected from a group of tenitems.
Both combinations and permutations are selections of a number of items from a larger number of items;for example, four number from ten numbers, or three toys from ten toys. With a combination, orderis not important ; the numbers 5, 9, 10 and the numbers 10,5, 9 are the same combination. With apermutation, order matters; the numbers 5, 9, 10 are a different permutation to the numbers 10,5,9.
The number of permutations and combinations are also affected by whether repetitions are allowed;that is, whether choosing an item reduces the total items available, or not. For example, if you choosethree numbers from ten, each choice reduces by one the group of numbers from which you can choose;you can then only create a permutation without repetition. However, if a friendly number-monger wereto replace each drawn number with the same number, you would be able to create a permutation withrepetition. In these functions, repetition is not allowed, for either combinations or permutations.
ALLPERMGet the position at which a permutation changes from the previous permutation.
ALLPERM ( k , { value , … } )
Returns the position of the left hand in the pair of items that were changed in the previous permutationto create the order of items in the specified permutation. Items are permuted starting with the orderof the group of items you specify. The items must be provided as a list of arguments, or as an array.The position returned is that of the left-hand item of the pair of items that had to change to create thespecified permutation.
Reference for language elementsVersion 3.3
400
Return type: Numeric
k
Type: Numeric
The rank of the permutation. The permutations are numbered from 1 to the number ofpermutations. No repetitions are allowed. For example, the number of permutations of threeitems with no repetitions is six. The initial permutation (that supplied in var_1...var_n) isnumbered 1, the final permutation is numbered 6.
value
Type: Var
An item to be permuted. Each item must be stored in arguments or in an array. Each value mustbe the same length; if the lengths vary, use formatting or other functions to make them the same.
ExampleIn the following example, the function returns the position of the left hand item of the pair that changedto create the specified permutation. The result is written to the log and to the example dataset.
data example; var1 = '100'; var2 = 'egg'; var3 = 'red'; result1 = allperm(2,var1,var2,var3); put "The position of the left hand item of the pair that changed is: " result1;run;
This produces the following output:
The position of the left hand item of the pair that changed is: 2
In this example, the permutations (remembering that the function permutes with no repetitions) are:
100 egg red100 red eggegg 100 redegg red 100red 100 eggred egg 100
In the specified line, line two, the items that were changed to make that permutation were egg andred in line 1, which became red and egg in line two. The left-hand item of the pair that changed is,therefore, the second item.
Reference for language elementsVersion 3.3
401
If the example program is modified as follows:
data example; var1 = '100'; var2 = 'egg'; var3 = 'red'; do i = 1 to perm(3); result1 = allperm(i,var1,var2,var3); put result1; end;run;
All permutations are checked in the DO loop, and the following results are returned and written to the logwith the PUT statement:
021212
The first result is 0; it is the first permutation, the items are as ordered in var1,var2,var3 and nochanges have been made. The second result is 2, as already described. The third result is 1.
100 egg red First line - no changes have been made, so 0 is returned100 red egg red and egg swapped. The first (left-hand) index position of the pair of items
that were swapped to make this change is at index position 2.egg 100 red 100 and red moved. The first (left-hand) index position of the pair of items that
were moved to make this change is at index position 1.
And so on for each permutation.
COMBObtain the number of combinations of a group of items.
COMB ( n , r )
Obtains the number of combinations for a specified number of items in a group of items, and returns theresult. Repetition is not allowed.
Return type: Numeric
n
Type: Numeric
The total number of items in a group.
Reference for language elementsVersion 3.3
402
r
Type: Numeric
The number of items to be combined.
Example 1In the following example, the function calculates the number of combinations of three items in a groupof ten items. The result is written to the log and to the example dataset.
data example; result=comb(5,3); put "The number of combinations is: " result;run;
This produces the following output:
The number of combinations is: 10
Example 2In the following example, the function calculates the number of combinations of four items in a group often items.
data example; result=comb(10,4); put "The number of combinations is: " result;run;
This produces the following output:
The number of combinations is: 210
LCOMBReturn the number of combinations for a group of items as a natural logarithm.
LCOMB ( n , r )
Calculates the number of combinations for a specified number of items in a group of items and returnsthe result as a natural logarithm. Repetition is not allowed.
Return type: Numeric
n
Type: Numeric
The total number of items in a group.
Reference for language elementsVersion 3.3
403
r
Type: Numeric
The number of items to be combined.
Example 1In the following example, the function calculates the number of combinations of three items in a groupof ten items. The result is written to the log and to the example dataset.
data example; result=lcomb(5,3); put "The number of combinations is: " result;run;
This produces the following output:
The number of combinations is: 2.302585093
The result is the natural logarithm of 10.
Example 2In the following example, the function calculates the number of combinations of four items in a group often items.
data _null_; result=lcomb(10,4); put "The number of combinations is: " result;run;
This produces the following output:
The number of combinations is: 2.302585093
The result is the natural logarithm of 210.
LPERMReturn the number of permutations as a natural logarithm.
LPERM ( n [ , r ] )
Calculates the number of permutations for a specified number of items in a group of items and returnsthe result as a natural logarithm.
Return type: Numeric
n
Type: Numeric
Reference for language elementsVersion 3.3
404
The number of items in the group.
rOptional argument
Type: Numeric
The number of items to be permuted.
Example 1In the following example, the function calculates the number of permutations of three items in a group often items. Repetition is not allowed. The result is written to the log and to the example dataset.
data example; result=lperm(5,3); put "The number of permutations is: " result;run;
This produces the following output:
The number of permutations is: 4.0943445622
The result is the natural logarithm of 60.
Example 1In the following example, the function calculates the number of combinations of four items in a group often items. Repetition is not allowed. The result is written to the log and to the example dataset.
data example; result=lperm(10,4); put "The number of permutations is: " result;run;
This produces the following output:
The number of permutations is: 8.5251613611
The result is the natural logarithm of 5040.
PERMReturn the number of permutations of a group of items.
PERM ( n [ , r ] )
Returns the number of permutations for a specified number of items in a group of items. The items arepermuted without repetition. Repetition is not allowed.
Return type: Numeric
Reference for language elementsVersion 3.3
405
n
Type: Numeric
The total number of items in a collection.
rOptional argument
Type: Numeric
The number of items to be permuted.
Example 1In the following example, the function calculates the number of permutations of three items in a group offive items. The result is written to the log and to the example dataset.
data example; result=perm(5,3); put "The number of permutations is: " result;run;
This produces the following output:
The number of permutations is: 60
Example 1In the following example, the function calculates the number of combinations of four items in a group often items. The result is written to the log and to the example dataset.
data example; result=perm(10,4); put "The number of permutations is: " result;run;
This produces the following output:
The number of permutations is: 5040
CALL ALLPERMReturn all permutations of a group of items.
CALL ALLPERM ( k , { value , … } );
Returns the permutation at a specified rank in a list of permuted sequences. Items are permutedbeginning from the series of items you specify. The items to be permuted must be provided as a list ofarguments, or as an array.
Reference for language elementsVersion 3.3
406
Note:This CALL routine should be used to return a list of permutations, not an individual permutation.
k
Type: Numeric
The rank of the permutation. The permutations are ranked from 1 to the number of permutations.No repetitions are allowed. For example, the number of permutations of three items with norepetitions allowed is six; the rank of the initial list of items to be permuted is 1, the rank of thefinal permutation is numbered 6.
value
Type: Var
The items to be permuted. The items must be stored in arguments or an array. The value of eachitem must be the same length; if the lengths vary, use formatting or other functions to make themthe same.
Basic ExampleIn the following example, the CALL routine writes the list of all permutations of the items 1,2 and 3 tothe allperms dataset.
data allperms; var1=1; var2=2; var3=3; do i = 1 to fact(3); call allperm(i, var1,var2,var3); output; end;run;
This writes to the allperms dataset a list of all permutations of the supplied items.
Reference for language elementsVersion 3.3
407
Example Using ArrayIn the following example, the CALL routine writes to the allperms dataset a list of all permutations ofthe items 1,2, 3, 4, and 6.
data allperms; array nums(5) (1 2 3 4 5); do i = 1 to fact(5); call allperm(i, of nums(*)); output; end;run;
As there are 120 permutations of five items, only the first eighteen observations of the dataset areshown below:
Input and output functions and call routinesThe input and output functions enable you to get information about an open dataset. A dataset identifieris returned during the open process, which can then be used with the other input and output functionsto return information about the attributes of the dataset, the format of variables in the dataset, the libraryname and reference for the dataset and so on. You can also get observations from the dataset andvariables from a specified observation.
Reference for language elementsVersion 3.3
408
ATTRCGet character attributes of a dataset.
ATTRC ( dataset-id , attribute )
Get information about character-based attributes of a dataset, such as its character set, whether it isencrypted, the library with which it is associated, and so on.
For information on the numeric attributes of datasets, see ATTRN.
Return type: Character
dataset-id
Type: Numeric
The identifier of the dataset for which you want information. The identifier is returned by the OPENfunction, which should be called before this function is used.
attribute
Specifies the attribute for which information will be returned. The attributes listed below areavailable. The value returned by an attribute is also described.
"CHARSET"
The character set in which the data is stored.
"ENCRYPT"
A value indicating whether the data is encryped or not. YES if it is, otherwise NO.
"ENGINE"
The name of the engine used to open the file. For example, WPD for WPS's own datasetfiles.
"LABEL"
The label associated with the dataset.
"LIB"
The name of the library assigned to a dataset (if one has been assigned).
"MEM"
The name of the dataset in use.
"MODE"
The mode with which the file was opened. This will be I, IN or IS. See OPEN for details.
"MTYPE"
Indicates whether the dataset is a view (VIEW) or data (DATA).
Reference for language elementsVersion 3.3
409
"SORTEDBY"
If the dataset is sorted, the observation on which the data is sorted. Otherwise, blank isreturned.
"SORTLVL"
Indicates whether the dataset has been sorted, and the type of sort. If the dataset has notbeen sorted, this will be blank, otherwise:
• WEAK — The dataset has been defined as sorted using the SORTEDBY option to theDATA statement, in which case the sort order has not been validated by WPS, and isshown as not validated in the metadata for the dataset.
• STRONG — The dataset has been sorted using mechanisms such as the PROC SORTprocedure, in which case the sort order has is validated by WPS, and is shown asvalidated in the metadata for the dataset.
"SORTSEQ"
The dataset collation order, such as ASCII or EBCDIC, or one of the national collationordering schemes. The collation order is set using the SORTSEQ system option or the PROCSORT option SORTSEQ. If the collating sequence is the same as the device on which theDATA step is run, then null is returned.
"TYPE"
Returns the value specified for the DATA step option TYPE=. If no value has been set forthe option, blank is returned.
ExampleIn the the following example, the function is used to return various attrubites of the dataset. The result iswritten to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); ca = attrc(id,"encrypt"); put 'Is the dataset encrypted? ' ca; ca = attrc(id,"engine"); put 'Which engine was used to open the dataset? ' ca; ca = attrc(id,"charset"); put 'Which character set does the dataset use? ' ca; ca = attrc(id,"mode"); put 'In which mode was the dataset opened? ' ca; returnc = close(id);run;
Reference for language elementsVersion 3.3
410
This produces the following output:
Is the dataset encrypted? NOWhich engine was used to open the dataset? WPDWhich character set does the dataset use? ASCIIIn which mode was the dataset opened? I
ATTRNGet numeric attributes of a dataset.
ATTRN ( dataset-id , attribute )
Get information about the numeric attributes of a dataset, such as the number of observations, the dateand time the dataset was created and modified, and so on.
For information on the character attributes of datasets, see ATTRC.
Return type: Numeric
dataset-id
Type: Numeric
The identifier of the dataset for which you want information. The identifier is returned by the OPENfunction, which should be called before this function is used.
attribute
Specifies which attribute to return. The attributes listed below are available. The value returnedby an attribute is also described.
"ANOBS"
Indicates whether the number of observations in the dataset are known; 1 if true, 0otherwise.
"ANY"
Indicates whether variables are identifired or not. If no variables are identified, -1 isreturned. If variables are identified, but there are no observations, 0 is returned. Otherwise,0 is returned.
"ARAND"
Indicates whether random access is allowed to the dataset; 1 if true, 0 otherwise.
"ARWU"
Indicates whether the dataset is read only; 1 if true, 0 otherwise.
"AUDIT"
Indicates whether audit logging is supported; 1 if true, 0 otherwise.
Reference for language elementsVersion 3.3
411
Note:Audit logging is not currently supported
"AUDIT_DATA"
Indicates whether after images of updated records are stored; 1 if true, 0 otherwise.
Note:Audit logging is not currently supported
"AUDIT_BEFORE"
Indicates whether before images of updated records are stored; 1 if true, 0 otherwise.
Note:Audit logging is not currently supported
"AUDIT_ERROR"
Indicates whether an attempt to store after images of updated records have beenunsuccessful; 1 if true, 0 otherwise.
Note:Audit logging is not currently supported
"CRDTE"
Date and time the dataset was created.
"ICONST"
A value identifying the type of integrity constraint.
Note:Integrity constraints are not currently supported
"INDEX"
Indicates whether the dataset supports indexing; 1 if true, 0 otherwise.
"ISINDEX"
Indicates whether the dataset is indexed; 1 if true, 0 otherwise.
"ISSUBSET"
Indicates the observations in the dataset are a subset of a table; 1 if true, 0 otherwise.
"LRECL"
The logical record length of the dataset.
"MODTE"
The date and time at which the dataset was last modified.
Reference for language elementsVersion 3.3
412
"NDEL"
The number of observations marked for deletion.
"NLOBS"
The number of observations not marked for deletion.
"NLOBSF"
The number of observations in the dataset, if known; -1 otherwise. For example, if thedataset is an SQL view or a dataset view, the number of observations contained cannot beknown beforehand, so for such a view -1 would be returned.
"NOBS"
The number of observations, including deleted observations.
"NVARS"
The number of variables in the dataset.
"RANDOM"
Indicates whether the datset can be accessed randomly; 1 if true, 0 otherwise.
"TAPE"
Indicates whether the datset can be dataset can only be accessed sequentially; 1 if true, 0otherwise.
"VAROBS"
Indicates whether the number of observations in the dataset is known; 1 if true, 0otherwise.
"WHSTMT"
Indicates whether a dataset WHERE statement is active, and if so, what type. The value willbe 0, if no WHERE statement is active, or 2 if a temporary WHERE clause is active.
Reference for language elementsVersion 3.3
413
ExampleIn the the following example, the function is used to return various numeric attributes of the dataset. Theresult is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); na = attrn(id,"lrecl"); put 'The logical record length of the dataset is: ' na; na = attrn(id,"isindex"); put 'Is the dataset index sequential? ' na; nd = attrn(id,"crdte"); put 'The dataset was last modified on ' nd datetime.; returnc = close(id);run;
This produces the following output:
The logical record length of the dataset is: 284Is the dataset index sequential? 1The dataset was last modified on 01FEB16:07:00:01
CEXISTDetermine whether a catalog or catalog entry exists.
CEXIST ( catalog-name-or-catalog-entry [ , state ] )
Determines whether the specified named catalog or catalog entry exists. Returns 1 (true) if the catalogor catalog entry exists, 0 otherwise).
Return type: Numeric
catalog-name-or-catalog-entry
Type: Character
The catalog name or catalog entry.
stateOptional argumentOnly one value is available:
"U"Checks whether the catalog or catalog entry is also updatable, that is, it has write access.
Reference for language elementsVersion 3.3
414
ExampleIn the following example, it is assumed the catalog specified exists. The result is written to the log andto the example dataset.
data example; filename f catalog 'work.cat1.entry.demo'; result = cexist('work.cat1'); op = ifc(result,"The catalog entry exists","The catalog entry doesn't exist"); put op;run;
This produces the following output:
The catalog entry exists
CALL SETIdentify the variables in an dataset and make them available.
CALL SET ( dataset-id );
Identifies the variables in a dataset, and makes them available to other functions in the DATA step. Thisenables the variables to be used with the variable names specified in the dataset.
dataset-id
Type: Numeric
The identifier of the dataset. The identifier is returned by the OPEN function, which should becalled before this function is used.
Reference for language elementsVersion 3.3
415
ExampleIn the following example, the routine is used to identify the variables in an observation, and these arethen used in various PUT functions and a string function. The result is written to the log and to theexample dataset.
data example; zip=0; x=0; y=0; city=""; state=0; statecode=""; id = open('sashelp.zipcode'); call set(id);
f = fetchobs(id,10); put zip= x= y=;
f = fetchobs(id,11); put city= state= statecode=;
f = fetchobs(id,12); put zip= x= y= city= state= statecode=;
q = quote(city);
returnc = close(id);run;
This produces the following output:
zip=611 x=-66.797578 y=18.287716city=A state=72 statecode=Pzip=613 x=-66.719283 y=18.472737 city=A state=72 statecode=P
CLOSEClose an open dataset.
CLOSE ( dataset-id )
Closes a dataset opened with the OPEN function. The dataset to be closed is specified using the datasetidentifier returned by OPEN. If the dataset is successfully closed, 0 (zero) is returned.
Return type: Numeric
dataset-id
Type: Numeric
The dataset identifier generated by the corresponding OPEN function.
Reference for language elementsVersion 3.3
416
OPEN returns 0 (zero) if the file specified does not exist. CLOSE does not recognise 0 as valid identifier,and will return an error if you attempt to close a file using it.
ExampleIn the following example, the identifier returned by the OPEN function is used in the subsequent CLOSEfunction. The result is written to the example dataset and to the log.
data example; id = open('sashelp.zipcode'); put "The identifier is: " id; id=1; returnc = close(id); if returnc = 0 then cs = 'Dataset closed successfully'; else cs = 'Dataset not closed'; put cs;run;
This produces the following output:
The identifier is: 1Dataset closed successfully
CUROBSReturn the position of the current observation in the dataset.
CUROBS ( dataset-id )
For the observation currently held in the Dataset Data Vector (DDV), returns its position in the opendataset. For example, if the FETCHOBS function has been used to get the tenth observation in thecurrent dataset, then CUROBS will return 10.
Return type: Numeric
dataset-id
Type: Numeric
The identifier for the dataset generated by the corresponding OPEN function.
Reference for language elementsVersion 3.3
417
ExampleIn the following example, the function returns the position of the observation selected by the FETCHOBSfunction. The result is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); fo = fetchobs(id,10); return = curobs(id); cds = close(id); put 'The current observation is: ' return;run;
This produces the following output:
The current observation is: 10
DSNAMEGet the dataset name.
DSNAME ( dataset-id )
Returns the name of the current dataset, opened using the OPEN function.
Return type: Character
dataset-id
Type: Numeric
The identifier of the dataset for which you want information. The identifier is returned by the OPENfunction, which should be called before this function is used.
ExampleIn the following example, the function returns the name of the dataset previously opened using theOPEN function. The result is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); name = dsname(id); cds = close(id); put 'The current dataset is: ' name;run;
This produces the following output:
The current dataset is: SASHELP.zipcode.DATA
Reference for language elementsVersion 3.3
418
EXISTCheck for the existence of a library member.
EXIST ( member-name [ , member-type ] )
Checks whether a specified member exists in a library. You can also specify the type of member, ifrequired.
Return type: Numeric
member-name
Type: Character
The name of the library member.
member-typeOptional argument
Type: Character
The type of library member. This can be, for example, DATA (the default) for a dataset, CATALOGfor a catalog, and so on.
ExampleIn the following example, the function checks for the existence of a dataset and of a catalog in a libraryon the Windows operating system. The result is written to the log and to the example dataset.
data example; if exist('sashelp.locale', 'catalog') then put "The library member exists"; else put "The dataset doesn't exist"; if exist('sashelp.zipcode') then put "The library member exists"; else put "The dataset doesn't exist";run;
This produces the following output:
FETCHFetch the next observation from a dataset.
FETCH ( dataset-id [ , option ] )
Reference for language elementsVersion 3.3
419
Fetches the next observation from a dataset. The dataset is specified using an identifier generatedby the OPEN function used to open the dataset. The observation is read into the Dataset DataVector (DDV); the observation can then be accessed by subsequent functions. By default, theobservation fetched will be the first observation; the next invocation of the function returns the secondobservation, and so on. However, if the FETCHOBS function is first invoked with a specified observation,a subsequent FETCH will get the next observation.
Return type: Numeric
Can be:
0The observation was found and read into the DDV.
-1The observation specified is beyond the end of the dataset
dataset-id
Type: Numeric
The identifier for the dataset generated by the corresponding OPEN function.
optionOptional argument
There is one optional parameter:
"NOSET"
Ensures that variables in the DDV are not updated by corresponding variables obtainedfrom the dataset by the CALL SET routine.
Note:This function only effects the CALL SET routine. If you use another function, such asGETVARN, to obtain the variable NOSET has no effect.
"NOSET"
Ensures that variables in the DDV are not updated by corresponding variables obtainedfrom the dataset by the CALL SET routine.
Note:This function only effects the CALL SET routine. If you use another function, such asGETVARN, to obtain the variable NOSET has no effect.
Reference for language elementsVersion 3.3
420
Basic ExampleIn the following example, the function fetches observations that are then accessed by the GETVARNfunction, which in this example returns the third variable in the observation. The result is written to thelog and to the example dataset.
libname ref 'C:\Program Files\World Programming WPS 3\sashelp';data example; id = open('ref.zipcode'); do i= 1 to 10; gno = fetch(id); nextrec = getvarn(id,3); put nextrec; end; fo = fetchobs(id,13); nextrec = getvarn(id,3); put nextrec; fo = fetch(id); nextrec = getvarn(id,3); put nextrec;run;
This produces the following output:
-73.046388-73.049288-66.723627-67.186553-67.151954-67.135899-67.151346-66.977377-67.144161-66.797578-66.735892-66.673779
The example output lists the third variable (in this case, a longitude) from each selected observation.The first ten observations are fetched by the FETCH function; each invocation of the function in theDO selects the next observation. The FETCHOBS function is then used to select a specific observation(in this example, the thirteenth in the dataset). When FETCH is subsequently called it gets the nextobservation, which in this example will be the fourteenth in the dataset.
Reference for language elementsVersion 3.3
421
Example with NOSET OptionIn the following example, the function fetches observations that are then accessed by the GETVARNfunction, and by the CALL SET routine. The result is written to the log and to the example dataset.
data example;
zip= 0.0; x = 0.0; y = 0.0; id = open('sashelp.zipcode'); f = fetchobs(id,10); fv = getvarn(id,2); call set(id); put fv= zip= x= y=;
f = fetch(id); fv = getvarn(id,2); call set(id); put fv= zip= x= y=; f = fetch(id,"noset"); fv = getvarn(id,2); call set(id); put fv= zip= x= y=; returnc = close(id); run;
This produces the following output:
fv=18.287716 zip=0 x=0 y=0fv=18.471326 zip=612 x=-66.728149 y=18.471326fv=18.472737 zip=612 x=-66.728149 y=18.471326
In this example, observations are fetched from the dataset. Variables are then obtained from theobservation in the DDV using GETVARN and CALL SET. The GETVARN function gets the secondvariable, which corresponds to y in these observations. In the second use of the FETCH function NOSETis specified. The zip, x and y variables remain the same as those returned in the previous CALL SET.However, GETVARN returns the value 18.456904; this demonstrates that FETCH did obtain the nextvalue, and that NOSET only affects the CALL SET routine.
FETCHOBSFetch the specified observation from a dataset.
FETCHOBS ( dataset-id , obs-num [ , options ] )
Reference for language elementsVersion 3.3
422
Fetches the specified observation from a dataset. The dataset is specified using an identifier generatedby the OPEN function used to open the dataset. The observation is read into the Dataset Data Vector(DDV); the observation can then be accessed by subsequent functions.
Return type: Numeric
Can be:
0The observation was found and read into the DDV
-1The observation specified is beyond the end of the dataset
dataset-id
Type: Numeric
The identifier for the dataset generated by the corresponding OPEN function.
obs-num
Type: Numeric
The observation number of the observation to be found and then read into the DDV. Theobservations are numbered from 1 sequentially through to the end of the file.
optionsOptional argument
Type: Character
NOSET
Ensures that variables in the Dataset Data Vector are not updated by correspondingvariables obtained from the dataset by the CALL SET routine.
ABS
When finding the observation specified by obs-num, deleted observations are by defaultignored. For example, if the dataset has ten observations, two of which have been deleted,the dataset would appear to only have eight observations. If obs-num is set to 10, then noobservation would be found and an error message returned. If this option is set, however,deleted records are not ignored and are included in the observation count. In the previousexample, therefore, the last observation would now be found.
Reference for language elementsVersion 3.3
423
Basic ExampleIn the following example, the function fetches observations that are then accessed by the GETVARNfunction, which in this example returns the third variable in the observation. The result is written to thelog and to the example dataset.
libname ref 'C:\Program Files\World Programming WPS 3\sashelp';data example; id = open('ref.zipcode'); do i= 60 to 70; gno = fetchobs(id,i); nextrec = getvarn(id,3); put nextrec; end; fo = fetchobs(id,78); nextrec = getvarn(id,3); put nextrec; fo = fetch(id); nextrec = getvarn(id,3); put nextrec;run;
This produces the following output:
-66.614749-66.61449-65.732399-66.244271-66.39152-65.774509-66.015222-66.04134-66.036044-66.036446-66.614009-66.161033-66.161026
The example output lists the first variable (in this case, a longitude) from each selected observation.The first ten observations are fetched by the FETCHOBS function, with the index of each observationprovided by the DO loop counter. The FETCHOBS function is then used to select a specific observation(in this example, observation 78 in the dataset). When FETCH is subsequently called, it gets the nextobservation, the 79th in the dataset.
Reference for language elementsVersion 3.3
424
Example with NOSET OptionIn the following example, the function fetches observations that are then accessed by the GETVARNfunction, and by the CALL SET routine. The result is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); zip= 0.0; x = 0.0; y = 0.0; f = fetchobs(id,10); fv = getvarn(id,2); call set(id); put fv= zip= x= y=;
f = fetchobs(id,11); fv = getvarn(id,2); call set(id); put fv= zip= x= y=; f = fetchobs(id,13,"noset"); fv = getvarn(id,2); call set(id); put fv= zip= x= y=; returnc = close(id); run;
This produces the following output:
fv=18.287716 zip=0 x=0 y=0fv=18.471326 zip=612 x=-66.728149 y=18.471326fv=18.456904 zip=612 x=-66.728149 y=18.471326
In this example, observations are fetched from the dataset. Variables are then obtained from theobservation in the DDV using GETVARN and CALL SET. The GETVARN function gets the secondvariable, which corresponds to y in these observations. In the third use of the FETCHOBS functionNOSET is used. The zip, x and y variables remain the same as those returned in the previous CALLSET. However, GETVARN returns the value 18.456904; this demonstrates that FETCH did obtain thenext value, and that NOSET only affects the CALL SET routine.
GETVARCGet a character variable from an observation.
GETVARC ( dataset-id , var-num )
Gets the specified variable from the current observation in the Dataset Data Vector (DDV). Anobservation can be inserted into the DDV using the FETCH or FETCHOBS functions. The variable mustbe a character string, otherwise an error is returned.
Reference for language elementsVersion 3.3
425
Return type: Character
dataset-id
Type: Numeric
The identifier for the dataset generated by the corresponding OPEN function.
var-num
Type: Numeric
The ordinal position of the variable you want to get from the observation. For example, if theobservation has six variables, and you want to obtain the fourth, you would specify 4 in thisparameter.
ExampleIn the following example, the function fetches observations that are then accessed by the GETVARCfunction, which in this example returns the fifth variable in the observation. The result is written to thelog and to the example dataset.
libname ref 'C:\Program Files\World Programming WPS 3\sashelp';data example; id = open('ref.zipcode'); do i= 2000 to 2010; gno = fetchobs(id, i); nextrec = getvarc(id,5); put nextrec; end;run;
This produces the following output:
DerbyDerby LineEast BurkeEast CharlestonEast HardwickEast HavenEast Saint JohnsburyGloverGranbyGreensboroGreensboro Bend
The example lists the fifth variable (in this case, an city name) from a series of selected observations.Ten observations are fetched by the FETCHOBS function, starting at the 51st observation; eachinvocation of the function in the DO selects the next observation.
Reference for language elementsVersion 3.3
426
GETVARNGet a numeric variable from an observation.
GETVARN ( dataset-id , var-num )
Gets the specified numeric variable from the current observation in the Dataset Data Vector (DDV). Anobservation can be inserted into the DDV using the FETCH or FETCHOBS functions. The variable mustbe numeric, otherwise an error is returned.
Return type: Numeric
dataset-id
Type: Numeric
The identifier for the dataset generated by the corresponding OPEN function.
var-num
Type: Numeric
The ordinal position of the variable you want to get from the observation. For example, if theobservation has six variables, and you want to obtain the fourth, you would specify 4 in thisparameter.
ExampleIn the following example, the function fetches five observations that are then accessed by a series ofGETVARN functions, which in this example return the first, second and third variables in the observation.The result is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode','in'); do i= 192 to 196; gno = fetchobs(id,i); zip = getvarn(id,1); y = getvarn(id,2); x = getvarn(id,3); put "Zipcode " zip z5. " is at Y = " y 5.2 " and X = " x 7.2 ; end;run;
This produces the following output:
Zipcode 00986 is at Y = 18.41 and X = -65.98Zipcode 00987 is at Y = 18.41 and X = -65.98Zipcode 00988 is at Y = 18.41 and X = -65.98Zipcode 01001 is at Y = 42.07 and X = -72.62Zipcode 01002 is at Y = 42.38 and X = -72.47
Reference for language elementsVersion 3.3
427
IORCMSGReturn an error message to _IORC_.
IORCMSG ( )
Returns an error message based on the numeric return code held in the _IORC_ automatic variable.This function can only be called from a DATA step that has at least one of the following:
• A MODIFY function• A SET function with the KEY statement
Return type: Character
This function enables you to display a text message about the status of the input/output operation,rather than a numeric code.
ExampleIn the following example, it is assumed the catalog specified exists. The result is written to the log andto the example dataset.
data example; id = open('sashelp.zipcode'); modify example; sl = quote(attrc(id,'SORTLVL')); put sl; cl = close(id); msg = IORCMSG(); put msg;run;
This produces the following output:
"STRONG"The IO operation completed successfully
LIBNAMEAssign a libref for a library.
LIBNAME ( libname , [ location ] , [ engine ] [ , options ] )
Assigns or deassigns a libref for a library. Returns 0 (zero) if the library is successfully assigned,otherwise -70008.
Return type: Numeric
Reference for language elementsVersion 3.3
428
libname
Type: Character
The name specified for the library.
locationOptional argument
Type: Character
The location of the library; for example, on Windows this could be a pathname such as C:\data\study1.
engineOptional argument
Type: Character
An engine type recognised by WPS. For example, WPD, V9SEQ, or SASDASD.
optionsOptional argument
Type: Character
An option specific to the dataset. See the LIBNAME statement associated with the engine formore details.
To deassign the libname, specify the function without a library. For example:
libname('ref','C:\Program Files\World Programming WPS 3\sashelp')
will assign the libname, while:
libname('ref')
will deassign it.
Example – assigning a libnameIn the following example, a LIBNAME function is used to specify a libname. The result is written to theexample dataset and to the log.
data example; lok = libname('ref','C:\Program Files\World Programming WPS 3\sashelp'); put 'Status returned: ' lok; id = open('ref.zipcode'); do i= 51 to 55; gno = fetchobs(id, i); nextrec = getvarn(id,3); put nextrec; end; cl = close(id);run;
Reference for language elementsVersion 3.3
429
This produces the following output:
Status returned: 0-66.398866-66.402557-66.863322-66.103857-66.101442
Status returned: 0 indicates that the libname was successfully created for the dataset.
Alternatively, if an attempt was made to create a reference to an unknown library:
data example; lok = libname('ref','C:\Program Files\World Programming WPS\sashelp'); put 'Status returned: ' lok; id = open('ref.zipcode'); do i= 51 to 55; gno = fetchobs(id, i); nextrec = getvarn(id,3); put nextrec; end; cl = close(id);run;
the following status would be returned:
Status returned: -70008
as well as error message indicating that the arguments to other function are invalid, because novariables had been returned.
Example – deassigning a libnameIn the following example, a previously assigned libname is deassigned using a LIBNAME function. Theresult is written to the example dataset and to the log.
data example; lok = libname('ref'); put 'Status returned: ' lok; id = open('ref.zipcode'); gno = fetchobs(id, 55); nextrec = getvarn(id,3); put nextrec; cl = close(id);run;
This produces the following output:
Status returned: 0
Reference for language elementsVersion 3.3
430
This shows that the LIBNAME function excuted successfully. However, the following statements andfunctions return error messages, as no observations and variables are returned; for example:
NOTE: Argument 1 to function FETCHOBS at line 1264 column 9 is invalidNOTE: Argument 1 to function GETVARN at line 1265 column 13 is invalid.NOTE: Argument to function CLOSE at line 1267 column 8 is invalid
If you were to use the LIBREF function to check whether the libname ref exists,
data example; libr = libref('ref'); put 'Has the specified libref been opened: ' libr;run;
the following would be returned:
Has the specified libref been opened: 70006
showing that the libname ref no longer has a library name associated with it.
LIBREFVerify that a specified libname has been assigned.
LIBREF ( argument )
Checks whether a specified library name has been assigned, and returns 0 (zero) if it has. If the libraryname does not exist, the error code 70006 is returned.
Return type: Numeric
argument
Type: Character
The libname you want to check.
Reference for language elementsVersion 3.3
431
ExampleIf the following DATA step had been executed:
data example; lok = libname('ref','C:\Program Files\World Programming WPS 3\sashelp'); put 'Status returned: ' lok; id = open('ref.zipcode'); do i= 51 to 55; gno = fetchobs(id, i); nextrec = getvarn(id,3); put nextrec; end; cl = close(id);run;
then the following example checks whether librefs named ref and reff have been opened. The resultis written to the example dataset and to the log.
data example; libr = libref('ref'); put 'Has the specified libref been opened: ' libr; libr = libref('reff'); put 'Has the specified libref been opened: ' libr;run;
This produces the following output:
Has the specified libref been opened: 0Has the specified libref been opened: 70006
NOTEGet an identifier for the current observation.
NOTE ( dataset-id )
Returns an identifier for the current observation from the open dataset.
Return type: Numeric
dataset-id
Type: Numeric
The dataset identifier generated by the corresponding OPEN function.
Reference for language elementsVersion 3.3
432
ExampleIn the following example, the identifier returned by the OPEN function is used in the subsequent NOTEfunction. The result is written to the example dataset and to the log.
data example; lok = libname('ref','C:\Program Files\World Programming WPS 3\sashelp'); id = open('ref.zipcode'); fo = fetchobs(id, 200); do i= 1 to 5; gno = fetch(id); author = getvarc(id,5); end; obno=note(id); put 'The identifer for the observation is: ' obno;run;
This produces the following output:
The identifer for the observation is: 1
OPENOpen a specified dataset.
OPEN ( dataset-name [ , type ] )
Opens the specified dataset and returns an identifier that can be used by other functions. If the datasetis not found, 0 is returned.
Return type: Numeric
dataset-name
Type: Character
The name of the dataset to be opened.
typeOptional argumentThe mode in which the dataset is opened:
"I"Random access mode.
"IN"Sequential access mode. Observations are read from beginning to end; previousobservations cannot be read.
"IS"Sequential access mode in which observations are read from beginning to end, butprevious observations can be read.
Reference for language elementsVersion 3.3
433
An opened dataset can be closed with the CLOSE function, specifying the identifier returned by theOPEN function.
Note:If the OPEN returns 0 because the dataset does not exist, using this value in a CLOSE function will causean error.
ExampleIn the following example, the identifiers returned by the OPEN function are used in the subsequentCLOSE function. The result is written to the example dataset and to the log.
data example; fo1 = open('sashelp.zipcode','IS'); fo2 = open('sashelp.mimetypes'); put 'Status returned: ' fo1; put 'Status returned: ' fo2; cr = close(fo1); cr = close(fo2);run;
This produces the following output:
Identifier returned: 1Identifier returned: 2
POINTPoint at an observation.
POINT ( dataset-id , note-id )
Points to an observation in a dataset previously identified by the NOTE function. If the observation existsin the dataset, 0 (zero) is returned; 40010 is returned otherwise.
Return type: Numeric
dataset-id
Type: Numeric
The identifier generated by the OPEN used to open the corresponding dataset.
note-id
Type: Numeric
The identifier generated by the NOTE function for the corresponding observation.
Reference for language elementsVersion 3.3
434
ExampleIn the following example, the identifier returned for the dataset by the OPEN function, and the identifiersreturned for observations by NOTE functions, are used to verify whether observations exist. The result iswritten to the example dataset and to the log.
data example; lok = libname('ref','C:\Program Files\World Programming WPS 3\sashelp'); id = open('ref.zipcode'); go = fetchobs(id,1); vz = getvarn(id,3); put vz; obno = note(id); do i = 1 to 100; rs= fetch(id); end; pt = point(id,obno); obs=fetchobs(id,point(id,obno)); vz = getvarn(id,3); put vz;run;
This produces the following output:
-73.046388-73.046388
The current observation is noted suing the NOTE function after the first observation is fetched usingFETCHOBS. A further 100 observations are subsequently read. The observation previously noted is thenspecified to POINT; the next FETCH therefore returns the first observation again.
REWINDReturn to the first record in the dataset.
REWIND ( dataset-id )
Positions the dataset pointer at the first record in the dataset.
Return type: Numeric
dataset-id
Type: Numeric
The identifier generated by the OPEN function corresponding to the dataset you want to berewound.
Reference for language elementsVersion 3.3
435
ExampleIn the following example, the identifier returned by the OPEN function is used in a REWIND function. Theresult is written to the example dataset and to the log.
data example; id = open('sashelp.zipcode'); go = fetchobs(id,2010); ob=getvarn(id,1); put 'Observation: ' ob; rc = rewind(id); go = fetch(id); ob=getvarn(id,1); put 'Observation: ' ob;run;
This produces the following output:
Observation: 5842Observation: 501
The first result is from the 2010th observation in the dataset; the second result is from the first.
VARFMTGet the format of a specified variable.
VARFMT ( dataset-id , variable-index )
Examines the metadata of the dataset for a specified variable, and returns the format of the variable if aformat has been applied. If no format has been applied, a character missing value is returned.
Return type: Character
dataset-id
Type: Numeric
variable-index
Type: Numeric
The value returned will, where applicable, be one of the formats specified in WPS, such as BESTX or F.
Reference for language elementsVersion 3.3
436
ExampleIn the following example, the function is used to return the formats of the variables in a dataset, wherethose variables have formats applied. The result is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); num=attrn(id,"nvars"); do i=1 to num; name = varname(id,i); format=varfmt(id,i); if format="" then put name $10. " has no format"; else put name $10. " has the format " format; end; rc=close(id);run;
This produces the following output:
ZIP has the format Z5.Y has the format 11.6X has the format 11.6ZIP_CLASS has no formatCITY has no formatSTATE has no formatSTATECODE has no formatSTATENAME has no formatCOUNTY has no formatCOUNTYNM has no formatMSA has no formatAREACODE has no formatTIMEZONE has no formatGMTOFFSET has no formatDST has no format
In this DATA step, the function is used to return the format for each variable. Only the ZIP, X and Yvariables have formats applied.
VARINFMTGet the informat of a specified variable.
VARINFMT ( dataset-id , variable-index )
Examines the metadata of the dataset for a specified variable, and returns the informat of the variable ifan informat has been applied. If no informat has been applied, a character missing value is returned.
Return type: Character
dataset-id
Type: Numeric
Reference for language elementsVersion 3.3
437
The identifier of the dataset containing the variable. The identifier is returned by the OPENfunction, which should be called before this function is used.
variable-index
Type: Numeric
The ordinal (that is, the index) position of the variable in the observation. For example, if theobservations in the dataset consist of the variables Author, Title and Type, in that order, thenspecifying 3 for this argument would return Type.
The value returned will, where applicable, be one of the informats available in WPS, such as INDEXC orANYDTDTE.
ExampleIn the following example, the function is used to return the formats of the variables in a dataset, wherethose variables have formats applied. The result is written to the log and to the example dataset.
data example; id = open('sashelp.vcatalg'); num=attrn(id,"nvars"); do i=1 to num; name = varname(id,i); format=varinfmt(id,i); if format="" then put name $10. " has no informat"; else put name $10. " has the informat " format; end; rc=close(id);run;
This produces the following output:
libname has no informatmemname has no informatmemtype has no informatobjname has no informatobjtype has no informatobjdesc has no informatcreated has the informat datetime13.modified has the informat datetime13.alias has no informat
VARLABELGet a the label for a variable.
VARLABEL ( dataset-id , variable-index )
Returns the label associated with the specified variable. The variable is specified by its ordinal positionin an observation. A variable only has a label if one has been specified for it. If there is no label, acharacter missing value is returned.
Reference for language elementsVersion 3.3
438
Return type: Character
dataset-id
Type: Numeric
The identifier of the dataset containing the variable. The identifier is returned by the OPENfunction, which should be called before this function is used.
variable-index
Type: Numeric
The ordinal (that is, the index) position of the variable in the observation. For example, if theobservations in the dataset consist of the variables Author, Title and Type, in that order, thenspecifying 3 for this argument would return the label for the variable Type.
ExampleIn the following example, the function gets the labels of the first and third variables in the specifieddataset. The result is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); vl = varlabel(id, 1); put "The Label is: " vl; vl = varlabel(id, 3); put "The Label is: " vl;run;
This produces the following output:
The Label is: The zip codeThe Label is: The longitude in degrees of the ZIP code centroid
In the following example, the example dataset created previously is examined for labels; no labelshave been specified, so no information is returned:
data _null_; id = open('work.example'); vn = varlabel(id, 1); put "Variable label is: " vn; vn = varlabel(id, 2); put "Variable label is: " vn;run;
This produces the following output:
Variable label is: Variable label is:
Reference for language elementsVersion 3.3
439
VARLENGet the length of a variable.
VARLEN ( dataset-id , variable-index )
Returns the length of the variable at the specified ordinal position in an observation.
Return type: Numeric
dataset-id
Type: Numeric
The identifier of the dataset containing the variable. The identifier is returned by the OPENfunction, which should be called before this function is used.
variable-index
Type: Numeric
The ordinal (that is, the index) position of the variable in the observation. For example, if theobservations in the dataset consist of the variables Author, Title and Type, in that order, thenspecifying 3 for this argument would return the length of the Type variable.
ExampleIn the following example, the function gets the length of the variables that comprise observations in thespecified dataset. The result is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); num=attrn(id,"nvars"); do i=1 to num; length=varlen(id,i); vn = varname(id,i); put vn $10. " is " length 3. " characters long" ; end; rc=close(id);run;
Reference for language elementsVersion 3.3
440
This produces the following output:
ZIP is 8 characters longY is 8 characters longX is 8 characters longZIP_CLASS is 1 characters longCITY is 64 characters longSTATE is 8 characters longSTATECODE is 2 characters longSTATENAME is 64 characters longCOUNTY is 8 characters longCOUNTYNM is 64 characters longMSA is 8 characters longAREACODE is 16 characters longTIMEZONE is 16 characters longGMTOFFSET is 8 characters longDST is 1 characters long
VARNAMEGet the name of a specified variable.
VARNAME ( dataset-id , variable-index )
Returns the name of the variable at the specified ordinal position in an observation. The name is thatdefined for the variable in the dataset.
Return type: Character
dataset-id
Type: Numeric
The identifier of the dataset containing the variable. The identifier is returned by the OPENfunction, which should be called before this function is used.
variable-index
Type: Numeric
The ordinal (that is, the index) position of the variable in the observation. For example, if theobservations in the dataset consist of the variables Author, Title and Type, in that order, thenspecifying 3 for this argument would return Type.
Reference for language elementsVersion 3.3
441
ExampleIn the following example, the function gets the name of the third variable in the specified dataset. Theresult is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); vn = varname(id, 5); put "Variable name is " vn;run;
This produces the following output:
Variable name is CITY
The function returns city, which is the name of the fifth variable in an observation in the dataset.
VARNUMGet the position of a variable specified by name.
VARNUM ( dataset-id , variable-name )
Returns the ordinal position of a named variable in the observations in a dataset.
Return type: Numeric
dataset-id
Type: Numeric
The identifier of the dataset containing the variable. The identifier is returned by the OPENfunction, which should be called before this function is used.
variable-name
Type: Character
The name of a variable in the dataset.
The variable-name must be defined in the dataset; if it is not, 0 will be returned.
Reference for language elementsVersion 3.3
442
ExampleIn the following example, the function gets the position of the specified variable names. The result iswritten to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); vn = varnum(id, "zip"); put "Variable position is: " vn; vn = varnum(id, "city"); put "Variable position is: " vn; vn = varnum(id, "city1"); put "Variable position is: " vn;run;
This produces the following output:
Variable position is: 1Variable position is: 5Variable position is: 0
The function returns the ordinal position of the CITY and ZIP variables in an observation; CITY1 is nota named variable in the dataset, so the function returns 0.
VARTYPEGet the type of a specified variable.
VARTYPE ( dataset-id , variable-index )
Returns the type of the variable at the specified ordinal position in an observation. A variable can benumeric or character.
Return type: Character
Returns C for chracter, N for numeric.
dataset-id
Type: Numeric
The identifier of the dataset containing the variable. The identifier is returned by the OPENfunction, which should be called before this function is used.
variable-index
Type: Numeric
The ordinal (that is, the index) position of the variable in the observation. The ordinal (that is,the index) position of the variable in the observation. For example, if the observations in thedataset consist of the variables Author, Title and Genre, in that order, then specifying 3 forthis argument would return the type of the Genre variable.
Reference for language elementsVersion 3.3
443
ExampleIn the following example, the function gets the type of the first and fifth variable in the specified dataset.The result is written to the log and to the example dataset.
data example; id = open('sashelp.zipcode'); vt = vartype(id, 1); put "Variable type is: " vt; vt = vartype(id, 5); put "Variable type is: " vt;run;
This produces the following output:
Variable type is: NVariable type is: C
The function first returns N, as the first variable in an observation in the dataset is a zipcode; the seconduse of the function returns C, as the fifth variable of an observation is the name of a city.
Date and time functions and call routinesThe date and time functions and call routine that can be used within a DATA step.
Dates and datetimes are stored in WPS as numeric values, using midnight on 01-January-1960 as areference date (epoch). From this reference point, each increment in a date value represents one dayfrom epoch, and each increment in a datetime value represents one second from midnight of the sameday. Times are stored as a numeric value, using midnight as the reference point, with each incrementrepresenting one second.
WPS can represent dates between 01‑January‑1582 ( date value of -138061) and 31‑December‑9999(date value of 2936547); the equivalent datetime limits are between 01‑January‑1582:00:00:00(datetime value of -11928470400) and 31‑December‑9999:23:59:59 (datetime value of 253717747199).
Time values should be less than 86400 (the number of seconds in a day); any numeric value greaterthan this interpreted as a time value returns the total number of hours, minutes and seconds.
You need to be aware of the type of value you are using as the format applied to the stored numericcan change the output. For example, the following uses a time value (tValue) that represents 12:30:45to which time, date and datetime formats can be applied:
DATA _NULL_; tValue = 45045; PUT "Number as Time: " tValue time.; PUT "Number as Date: " tValue date11.; PUT "Number as DateTime: " tValue datetime.;RUN;
Reference for language elementsVersion 3.3
444
When the time and datetime formats are applied, similar output for the time in the day is generated; thedate value is unlikely to be accurate:
Number as Time: 12:30:45Number as Date: 30-APR-2083Number as DateTime: 01JAN60:12:30:45
Date and time literalsAs an alternative to using the numeric value for a date or datetime, you can append date or timeidentifiers to a string, and the string will be treated as a date, time or datetime value. The modifiersappended to the strings (after any quotes) are:
T
When appended to a string, the content of the string is interpreted as a time value.
DATA _NULL_; tm = "12:30:45"T; PUT "Time value: " tm; PUT "Time formatted: " tm time.;RUN;
Output as the numeric value and a formatted equivalent:
Time value: 45045Time formatted: 12:30:45
D
When appended to a string, the content of the string is interpreted as a date value.
DATA _NULL_; da = "29-SEP-2014"D; PUT "Date value: " da; PUT "Date formatted: " da date11.; RUN;
Output as the numeric value and a formatted equivalent:
Date value: 19995Date formatted: 29-SEP-2014
DT
When appended to a string, the content of the string is interpreted as a datetime value.
DATA _NULL_; dm = "29-SEP-2014:12:30:45"DT; PUT "Datetime value: " dm; PUT "Datetime formatted: " dm datetime.;RUN;
Output as the numeric value and a formatted equivalent:
Datetime value: 1727613045Datetime formatted: 29SEP14:12:30:45
Reference for language elementsVersion 3.3
445
Get date and time values
This group of DATA step functions can be used to generate date and datetime values from epoch;generate the time value within the current day; convert date and time constants to a date, datetime ortime value.
DATE
Returns the count of days since epoch. DATE() is an alias of TODAY()
DATE ( )
This function takes no arguments and returns the count of days from epoch for the local time. Theoutput of this function can be used as an argument to other date and time functions.
Return type: Numeric
ExampleThis example gets the current date and prints the default date format to the log. The same date isreformatted to display in the log as YYYY-MM-DD.
DATA _NULL_; d = date(); put "Today: " d; put "Default format: " d date.; put "YYYY-MM-DD format: " d YYMMDDd10.;RUN;
Which produces the following output in the log:
Today: 20514Default format: 01MAR16YYYY-MM-DD format: 2016-03-01
TODAY
Returns the date value for the current day. TODAY() is an alias of DATE()
TODAY ( )
This function takes no arguments and returns the count of days from epoch for the current day the localtime. The output of this function can be used as an argument to other date and time functions.
Return type: Numeric
Reference for language elementsVersion 3.3
446
ExampleThe following gets the date value for today and prints the default date format to the log. The same dateis reformatted to display as YYYY-MM-DD.
DATA _NULL_; d = today(); put "Today: " d; put "Default format: " d date.; put "YYYY-MM-DD format: " d YYMMDDd10.;RUN;
Which produces the following output in the log:
Today: 20571Default format: 27APR16YYYY-MM-DD format: 2016-04-27
DATETIME
Returns the number of seconds since epoch for the current time.
DATETIME ( )
This function takes no arguments and returns the count of seconds for the local time. The valuereturned can contain up to three decimal places, representing the millisecond count for the currentsecond, and can be used as an argument to other date and time functions.
Return type: Numeric
ExampleThe following example prints the current datetime in the numeric format and the same date time in adatetime format that displays the milliseconds in the datetime value as the fractional part of the decimalnumber of seconds
DATA _NULL_; dt = datetime(); PUT "Time now: " dt; PUT "Default format: " dt datetime24.5;RUN;
Which produces the following output in the log:
Time now: 1781097234.6Default format: 09JUN2016:13:13:54.61000
Reference for language elementsVersion 3.3
447
TIME
Returns the current time as the number of seconds from midnight.
TIME ( )
This function takes no arguments and returns the count of seconds from midnight for the current day.The output of this function can be used as an argument to other date and time functions.
Return type: Numeric
ExampleDATA _NULL_; tM = time(); PUT "Time in seconds " tM; PUT "Current time: " tM time.;RUN;
Which produces the following output in the log:
Time in seconds 35894.681Current time: 9:58:15
MDY
Converts a month–day–year combination into a date value.
MDY ( month , day , year )
Return type: Numeric
The function will only return a date where a combination of month–day–year is valid.
month
Type: Numeric
The numeric representation of the month within the year.
day
Type: Numeric
The numeric representation of the day within the month.
year
Type: Numeric
Reference for language elementsVersion 3.3
448
A two or four digit representation of the year. The two-digit year range begins at the year setin the YEARCUTOFF system option; by default the range of two-digit dates is 01-January-1920through to 31-December-2019.
ExampleDATA _NULL_; hour1 = MDY(8, 17, 2015); put "DATE value: " hour1; put "Formatted date: " hour1 date11.;RUN;
Which produces the following output:
DATE value: 20317Formatted date: 17-AUG-2015
DHMS
Returns a datetime value for a known date and time (hour, minute, second).
DHMS ( date-value , hour , minute , second )
All arguments must be supplied to this function. Each of the numeric hour, minute, and second fieldsdo not have an upper limit allowing you to calculate a future datetime value from midnight of the dateargument as the start point.
Return type: Numeric
date-value
Type: Numeric
The base date value from which the datetime value is calculated. This can be a known datevalue, a date literal, or calculated using other functions that return a date value.
hour
Type: Numeric
The number of hours to be added to the date-value. Typically the number would be in the range0–23.
minute
Type: Numeric
The number of minutes to be added to the hours. Typically the number would be in the range0–59.
Reference for language elementsVersion 3.3
449
second
Type: Numeric
The number of seconds to be added to the minutes. Typically the number would be in the range0–59.
ExampleThis example calculates two datetime values; one representing midnight on the start date, and onerepresenting a datetime value 100 hours, 100 minutes and 100 seconds after the start date value.
DATA _NULL_; datetime1 = DHMS ("17-AUG-2015"d, 0, 0, 0); datetime2 = DHMS ("17-AUG-2015"d, 100, 100, 100); put "Formatted output: " datetime1 datetime.; put "Future date output: " datetime2 datetime.;RUN;
Which produces the following output in the log.
Formatted output: 17AUG15:00:00:00Future date output: 21AUG15:05:41:40
ExampleThe DHMS function can also be used to convert date and time values into a single datetime value, orgenerate a datetime value for the current date and time:
DATA _NULL_; td = TODAY(); tm = TIME(); dtNow = DHMS(td, HOUR(tm), MINUTE(tm), SECOND(tm)); PUT dtNow DATETIME.;RUN;
HMS
Generates a time value for a known time (hour, minute and seconds).
HMS ( hour , minute , second )
All arguments must be supplied to this function. A time value is calculated from the supplied number ofhours, minutes and seconds, and will return the time with reference to midnight on the current day. Thearguments do not have an upper limit allowing you to calculate a future time value as well as time withinthe current day.
Return type: Numeric
Reference for language elementsVersion 3.3
450
hour
Type: Numeric
The number of hours from midnight of the current day. Typically the number would be in therange 0–23.
minute
Type: Numeric
The number of minutes to be added to the hours. Typically the number would be in the range0–59.
second
Type: Numeric
The number of seconds to be added to the minutes. Typically the number would be in the range0–59.
ExampleThe following example returns the time value from a number of hours, minutes and seconds frommidnight of the current day
DATA _NULL_; time1 = HMS (12, 15, 45); time2 = HMS (100, 100, 100); put "Time1 output: " time1 time.; put "Time2 output as time: " time2 time.;RUN;
Which produces the following output in the log
Time1 output: 12:15:45Time2 output as time: 101:41
YYQ
Returns the date value for the first day of a quarter from a supplied year and quarter.
YYQ ( year , quarter )
Return type: Numeric
year
Type: Numeric
A two-digit or four-digit year value. The two-digit year begins at the year set in the YEARCUTOFFsystem option; by default the range of two-digit years is 1920 through to 2019.
Reference for language elementsVersion 3.3
451
quarter
Type: Numeric
The quarter within the year, in the range 1–4.
ExampleThe following example uses a DO loop to find the first day in each quarter of a year.
DATA _NULL_; DO i=1 to 4; Qt = YYQ(2015, i); PUT "First day of quarter " i ": " Qt DATE11.; END;RUN;
Which produces the following output in the log.
First day of quarter 1 : 01-JAN-2015First day of quarter 2 : 01-APR-2015First day of quarter 3 : 01-JUL-2015First day of quarter 4 : 01-OCT-2015
Select date and time values
This group of DATA step functions can be used to select part of a date, datetime, or time value.
DATEPART
Returns the date value from a datetime value.
DATEPART ( datetime-value )
This function can be used to convert a datetime value into a date value.
Return type: Numeric
datetime-value
Type: Numeric
The datetime value from which the date value will be returned. This can be a known datetime,a datetime literal, or calculated using other functions that return a datetime value such asDATETIME().
Reference for language elementsVersion 3.3
452
ExampleThis example converts a datetime value into a date format (DD-MMM-YYYY) for the current datetime.
DATA _NULL_; dpart=DATEPART("17-AUG-2015:12:30:45"dt); PUT "Date from a datetime: " dpart DATE11.;RUN;
Which produces the following output in the log:
Date from a datetime: 17-AUG-2015
TIMEPART
Returns the time section of a datetime value,
TIMEPART ( datetime-value )
Return type: Numeric
datetime-value
Type: Numeric
The datetime value from which the time is returned. This can either be a known datetime value,or calculated using other functions that return a datetime value.
ExampleDATA _NULL_; dtM = TIMEPART ("17-AUG-2015:12:30:45"DT); PUT "Time: " dtM TIME.;RUN;
Which produces the following output in the log:
Time: 12:30:45
YEAR
Returns the year numeric value from a date.
YEAR ( date-value )
Return type: Numeric
Reference for language elementsVersion 3.3
453
date-value
Type: Numeric
The date value from which the year part is returned. This can be a known date value, a dateliteral, or calculated using other functions that return a date value.
ExampleThe following example returns the year value from a date literal.
DATA _NULL_; Hy = "17-AUG-2015"D; Yr = YEAR(Hy); PUT "Year: " Yr;RUN;
Which produces the following output in the log:
Year: 2015
QTR
Returns the quarter in the year a date value falls within.
QTR ( date-value )
Return type: Numeric
date-value
Type: Numeric
The date value for which the quarter is calculated. This can be a known date value, a date literal,or the result of using other functions that return a date value.
ExampleThe following example returns the quarter value from a date literal.
DATA _NULL_; Hy = "17-AUG-2015"D; Qt = QTR(Hy); put "Date is in quarter: " Qt;RUN;
Which produces the following output in the log
Date is in quarter: 3
Reference for language elementsVersion 3.3
454
MONTH
Returns the month numeric value from a date.
MONTH ( date-value )
The returned numeric represents the month in the year, where 1=January, 2=February and so on.
Return type: Numeric
date-value
Type: Numeric
The date value from which the month part is returned. This can either be a known date value, adate literal, or calculated using other functions that return a date value.
ExampleThe following example returns the month as a numeric value; a string representation of the month canbe returned by formatting the date value using MONNAME.
DATA _NULL_; Hy = "17-AUG-2015"D; Mn = MONTH(Hy); PUT "Month from DATE value: " Mn; PUT "Formatted month: " Hy MONNAME.;RUN;
Which produces the following output in the log:
Month from DATE value: 8Formatted month: August
WEEK
Returns the week count in the year within which the date falls.
WEEK ( [ date-value ] [ , algorithm ] )
Where no date value is provided to the function, the week value for TODAY() is returned; if notalgorithm is supplied, the U method is used.
Return type: Numeric
date-valueOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
455
The date value for which the week count is determined. This can be a known date value, a dateliteral, or calculated using other functions that return a date value.
algorithmOptional argument
The method to be used when calculating the week number.
"U"
Treats Sunday as the first day of the week. At the start of the year, any dates that fallbefore the first Sunday of the year have a week count of "0".
"V"
Calculates the week based on the ISO 8601 Data elements and interchange formats –Information interchange – Representation of dates and times standard definition for thenumber of weeks in a year and the first week of the year.
The standard defines the first day of the week as a Monday, and the first week in a yearis that week containing the first Thursday of the year. At the start of the year, any datesfalling before week one will be either week 52 or week 53 (if the year is a long year) of theprevious year.
"W"
Treats Monday as the first day of the week. At the start of the year, any dates that fallbefore the first Monday of the year have a week count of "0"
ExampleThis example returns the week count for the current day, and the week count of a known date. Bothfunctions use the "U" calculation method.
DATA _NULL_; Td = TODAY(); Wk = WEEK(); Hy = "17-AUG-2015"D; HyWK = WEEK(Hy, "U"); PUT "Today's date: " Td DATE11.; PUT "Week count of today: " Wk; PUT "Week count of Hy Date: "HyWk;RUN;
Which produces the following output in the log.
Today's date: 17-AUG-2016Week count of today: 33Week count of Hy Date: 33
Reference for language elementsVersion 3.3
456
WEEKDAY
Returns the weekday number from a date value.
WEEKDAY ( date-value )
The returned numeric represents the day in the week, where 1=Sunday, 2=Monday and so on.
Return type: Numeric
date-value
Type: Numeric
The date value from which the weekday part is returned. This can either be a known date value,a date literal, or calculated using other functions that return a date value.
ExampleThe following example returns the weekday as a numeric value; a string representation of the weekdaycan be returned by formatting the date value using DOWNAME.
DATA _NULL_; Hy = "17-AUG-2015"D; WK = WEEKDAY(Hy); PUT "Weekday number: " WK; PUT "Weekday name:" Hy DOWNAME.;RUN;
Which produces the following output in the log:
Weekday number: 2Weekday name: Monday
DAY
Returns the day number within the month from a date value.
DAY ( date-value )
Return type: Numeric
date-value
Type: Numeric
The date from which the day in the month is returned. This can be a known date value, a dateliteral, or calculated using other functions that return a date value.
Reference for language elementsVersion 3.3
457
ExampleDATA _NULL_; DAY1 = DAY("17-AUG-2015"D); PUT "Day count from DAY1 date: " DAY1;RUN;
Which produces the following output in the log:
Day count from DAY1 date: 17
HOUR
Returns the hour values from a datetime or time value.
HOUR ( datetime-value )
Return type: Numeric
datetime-value
Type: Numeric
The datetime or time value from which the hour is returned. This can either be a known datetimeor time value, or calculated using other functions that return a datetime or time value.
ExampleDATA _NULL_; TIME1 = HOUR("17-AUG-2015:12:30:45"DT); put "Hour part of the time: " TIME1;RUN;
Which produces the following output
Hour part of the time: 12
MINUTE
Returns the number of minutes from a datetime or time value.
MINUTE ( datetime-value )
Return type: Numeric
datetime-value
Type: Numeric
Reference for language elementsVersion 3.3
458
The datetime or time value from which the minute count is extracted. This can either be a knowndatetime or time value, or calculated using other functions that return a datetime or time value.
ExampleDATA _NULL_; Mn=MINUTE("17-AUG-2015:12:30:45"DT); PUT "Number of minutes: " Mn;RUN;
Which produces the following output in the log:
Number of minutes: 30
SECOND
Returns the number of seconds from a datetime or time value.
SECOND ( datetime-value )
Return type: Numeric
datetime-value
Type: Numeric
The datetime or time value from which the count of seconds is returned. This can either be aknown datetime or time value, or calculated using other functions that return a datetime or timevalue
ExampleDATA _NULL_; SEC1 = second ("17-AUG-2015:12:30:45"DT); PUT SEC1;RUN;
Which produces the following output in the log:
Number of seconds: 45
Convert date and time values
This group of DATA step functions can be used to convert between date values and Julian dates, andto create a date or time value conforming to the ISO 8601:2004 standard.
Reference for language elementsVersion 3.3
459
DATEJUL
Converts a five-digit or seven-digit Julian Date into a date value.
DATEJUL ( julian-date )
The two-digit year range in five-digit Julian Dates begins at the year set in the YEARCUTOFF systemoption; by default the range of two-digit dates is 01-January-1920 through to 31-December-2019.
Return type: Numeric
When using Julian Dates in SAS language programs, we recommend using a seven-digit format toensure there is no confusion in date values.
julian-date
Type: Numeric
The five-digit (YYDDD) or seven-digit (YYYYDDD) Julian Date to be converted to a SASlanguage date numeric.
ExampleThe following example converts a five-digit and seven-digit Julian date into a date value. TheYEARCUTOFF is first printed to see whether the returned date value is the same.
PROC OPTIONS OPTION=YEARCUTOFF;RUN;
DATA _NULL_ ; d5 = 21061; d7 = 2021061; jdate1 = datejul(d5); jdate2 = datejul(d7); put "From five-digit date: " jdate1 DATE11.; put "From seven-digit date: " jdate2 DATE11.;RUN;
Which produces the following output in the log:
YEARCUTOFF=1920 Cutoff year used when interpreting or generating 2 digit years in functions and formatsFrom five-digit date: 02-MAR-1921From seven-digit date: 02-MAR-2021
JULDATE
Converts a date value into a Julian Date.
JULDATE ( date-value )
Reference for language elementsVersion 3.3
460
The Julian Date returned consists of either a five-digit date (YYDDD) containing a two-digit year, orseven-digit date (YYYYDDD) number containing a four-digit year. The two-digit year range begins at theyear set in the YEARCUTOFF system option; by default the range of two-digit dates is 01-January-1920through to 31-December-2019. For dates falling in the one hundred years after the 01-January in theYEARCUTOFF, this function returns the Julian Date in five-digit format; for all other dates this functionreturns the Julian Date in seven-digit format.
Return type: Numeric
date-value
Type: Numeric
The date value to be converted to a Julian Date. This can be a known date value, a date literal, orcalculated using other functions that return a date value.
ExampleThe following example returns either a five-digit or seven-digit Julian date value depending uponwhether the date is within 100 years of the DATECUTOFF value.
PROC OPTIONS OPTION=YEARCUTOFF;RUN;
DATA _NULL_; JDATE1 = JULDATE("31-DEC-1919"D); JDATE2 = JULDATE("01-JAN-1920"D); JDATE3 = JULDATE("31-DEC-2019"D); JDATE4 = JULDATE("01-JAN-2020"D); PUT "JDATE1: " JDATE1; PUT "JDATE2: " JDATE2; PUT "JDATE3: " JDATE3; PUT "JDATE4: " JDATE4;RUN;
Which produces the following output in the log:
YEARCUTOFF=1920 Cutoff year used when interpreting or generating 2 digit years in functions and formatsJDATE1: 1919365JDATE2: 20001JDATE3: 19365JDATE4: 2020001
JULDATE7
Converts a date value into a seven-digit (YYYYDDD) Julian Date.
JULDATE7 ( date-value )
Return type: Numeric
Reference for language elementsVersion 3.3
461
date-value
Type: Numeric
The date value to be converted to a Julian Date. This can be a known date value, a date literal, orcalculated using other functions that return a date value.
ExampleDATA _NULL_; JDATE1 = JULDATE7("31-DEC-1919"d); JDATE2 = JULDATE7("01-JAN-1920"d); JDATE3 = JULDATE7("31-DEC-2019"d); JDATE4 = JULDATE7("01-JAN-2020"d); PUT "JDATE1: " JDATE1; PUT "JDATE2: " JDATE2; PUT "JDATE3: " JDATE3; PUT "JDATE4: " JDATE4;RUN;
Which produces the following output in the log:
JDATE1: 1919365JDATE2: 1920001JDATE3: 2019365JDATE4: 2020001
CALL IS8601_CONVERT
Used to convert date and datetime formats to and from ISO 8601 time intervals and durations.
CALL IS8601_CONVERT ( source-format , target-format [ , { variable , … } ] );
The number of input and returned values are determined by the settings used in the source-formatand target-format arguments. These arguments are followed by any input values or return valueplaceholders in the number and order defined in the format arguments.
Time intervals and durations are described in the standard, Data elements and interchange formats– Information interchange – Representation of dates and times standard. An ISO 8601 time intervaldescribes the intervening time between two known time points; this can either be using the start andend points, or one of the known time points and a duration. An ISO 8601 duration describes a period oftime without the context of a start or end date.
When using ISO 8601 dates and times, WPS uses an internal representation for both time intervalsand durations. To present this information in output in a human-readable form, apply one of the formatsdescribed in ISO 8601 date formats
source-format
Specifies the format, or formats, of the source date and time information, one of the followingvalues:
Reference for language elementsVersion 3.3
462
"intvl"
The input argument at position three is an ISO 8601 time interval.
"dt/dt"
Two input arguments are supplied, both are datetime values. The arguments at positionsthree and four are assumed to be datetime values and can be known datetime numericvalues, datetime literals, or calculated using other functions that return a datetime value.
"du/dt"
Two input arguments are provided; the first is an ISO 8601 duration, the second a datetimevalue. The input argument at position three must be a valid ISO 8601 time interval. Theinput argument at position four is assumed to be a datetime value, and can be a knowndatetime numeric value, a datetime literal, or calculated using other functions that returns adatetime value.
"du/d"
Two input arguments are provided; the first is an ISO 8601 duration, the second a datevalue. The input argument at position three must be a valid ISO 8601 time interval. Theinput argument at position four is assumed to be a date value, and can be a known datenumeric value, a date literal, or calculated using other functions that returns a date value.
"dt/du"
Two input arguments are provided; the first is a datetime value, the second an ISO 8601duration. The input argument at position three is assumed to be a datetime value, and canbe a known datetime numeric value, a datetime literal, or calculated using other functionsthat returns a datetime value. The input argument at position four must be a valid ISO 8601time interval.
"d/du"
Two input arguments are provided; the first is a date value, the second an ISO 8601duration. The input argument at position three is assumed to be a date value, and can be aknown date numeric value, a string literal, or calculated using other functions that returns adate value. The input argument at position four must be a valid ISO 8601 time interval.
"d/d"
Two input arguments are supplied, both are date values. The arguments at positions threeand four are assumed to be date values and can be known date numeric values, dateliterals, or calculated using other functions that return a date value.
"dt"
The input argument supplied is a datetime value. The argument at position three isassumed to be a datetime value and can be a known datetime numeric value, a datetimeliteral, or calculated using other functions that return a datetime value.
"du"
The input argument at position three is an ISO 8601 duration.
Reference for language elementsVersion 3.3
463
"d"
The input argument supplied is a date value. The argument at position three is assumed tobe a date value and can be a known date numeric value, a date literal, or calculated usingother functions that return a date value.
target-format
Specifies the format, or formats, the resultant date and time information is converted into.target-format contains two options for calculating date and time values: "START" and"END". These options can be used with ISO 8601 intervals, and duration values when used witha date or datetime value.
"intvl"
The output argument is an internal representation of the ISO 8601 interval format. Topresent this information, apply one of the formats described in ISO 8601 date formats
"dt/dt"
Two datetime output arguments are returned.
"du/dt"
Two output arguments are returned in the specified order; the first is an ISO 8601 duration,the second a datetime value.
"du/d"
Two output arguments are returned in the specified order; the first is an ISO 8601 duration,the second a date value.
"dt/du"
Two output arguments are returned in the specified order; the first is a datetime value, thesecond an ISO 8601 duration.
"d/du"
Two output arguments are returned in the specified order; the first is a date value, thesecond an ISO 8601 duration.
"d/d"
Two date output arguments are returned.
"dt"
The output argument is a datetime value.
"du"
The output argument is an internal representation of the ISO 8601 duration format. Topresent this information, apply one of the formats described in ISO 8601 date formats
"d"
The output argument is a date value.
Reference for language elementsVersion 3.3
464
"start"
The output is a datetime value marking the start point of either an interval value orduration. The value is calculated from either an ISO 8601 Interval value, or a combinationof duration and end date.
"end"
The output is a datetime value marking the end point of either an interval value or duration.The value is calculated from either an ISO 8601 Interval value, or a combination ofduration and start date.
variableOptional argument
Type: Character or numeric value
Arguments containing the input and output values. The number and order of the arguments isdefined in the source-format and target-format.
Example – Create ISO 8601 intervalsThis example shows hot to create ISO 8601 standard intervals from date or datetime values. The formatof the output intervals follows the structure defined in the standard; in the case of date values the timeelement is set to midnight (00:00:00):
DATA _NULL_; startDT = "17-AUG-2015:12:30:45"DT; startD = "17-AUG-2015"D; endDT = "18-SEP-2016:15:45:00"DT; endD = "18-SEP-2016"D; FORMAT IntOutDT IntOutD $N8601EA.; CALL IS8601_CONVERT("DT/DT", "INTVL", startDT, endDT, IntOutDT); CALL IS8601_CONVERT("D/D", "INTVL", startD, endD, IntOutD); PUT "Interval from date: " IntOutD; PUT "Interval from datetime: " IntOutDT;RUN;
Which produces the following output in the log:
Interval from date: 2015-08-17T00:00:00/2016-09-18T00:00:00Interval from datetime: 2015-08-17T12:30:45/2016-09-18T15:45:00
Reference for language elementsVersion 3.3
465
Example – Convert datetime to date valuesIn addition to converting to ISO8601 formats, the call routine can be used to convert between datetimeand date values. The following mimics using the DATEPART() function to return dates from datetimevalues:
DATA _NULL_; startDT = "17-AUG-2015:12:30:45"DT; endDT = "18-SEP-2016:15:45:00"DT; FORMAT outD1 outD2 DATE11.; CALL IS8601_CONVERT("DT/DT", "D/D", startDT, endDT, outD1, outD2); PUT "Date from startDT: " outD1; PUT "Date from endDT: " outD2;RUN;
Which produces the following output in the log:
Date from startDT: 17-AUG-2015Date from endDT: 18-SEP-2016
Example – Finding start or end datesThis example shows how to use the routine to calculate dates, in this case how to find the end datetimewhere a start date and duration is known, and a start datetime where a duration and end date is known.
DATA _NULL_; startDT = "17-AUG-2015:12:30:45"DT; endDT = "18-SEP-2016:15:45:00"DT; duStartEnd = 33794055; CALL IS8601_CONVERT("DU/DT", "START", duStartEnd, endDT, StartDate); CALL IS8601_CONVERT("DT/DU", "END", startDT, duStartEnd, EndDate); PUT "Start Date: " StartDate DATETIME.; PUT "End Date: " EndDate DATETIME.;RUN;
Which produces the following output in the log:
Start Date: 17AUG15:12:30:45End Date: 18SEP16:15:45:00
Calculate date and time values
This group of DATA step functions can be used to calculate differences between date and datetimevalues; or increment date and datetime values to create new date/datetime values.
Reference for language elementsVersion 3.3
466
INTCK
Returns a count of completed intervals between the supplied start-date and end-date.
INTCK ( interval , start-date , end-date [ , method ] )
Date, datetime, and time values can be used with this function. The accuracy of the count returnedreflects the combination of interval label and date, datetime or time value:
• If working with date formats, intervals covering year to day will return correct results. Do not attemptto use HOUR, MINUTE, or SECOND intervals with date values.
• If working with datetime formats, use increment names starting with DT. All values from DTYEARto DTSECOND can be used. In addition, HOUR, MINUTE and SECOND intervals can be used withdatetime values.
• If working with time formats, use the HOUR, MINUTE and SECOND intervals.
Return type: Numeric
interval
"YEAR"
This interval counts the number of years between the start and end dates. To use the yearinterval with a date value, specify either YEAR or YR; to use this interval with a datetimevalue, specify either DTYEAR or DTYR.
Using the DTYEAR interval with a date value results in an incorrect count.
"SEMIYEAR"
This interval counts the number of semi-years (six-month periods) between the start andend dates. To use the semiyear interval with a date value, specify either SEMIYEAR orSEMI; to use this interval with a datetime value, specify either DTSEMIYEAR or DTSEMIYR.
Using the DTSEMIYEAR interval with a date value results in an incorrect count.
"QUARTER"
This interval counts the number of quarters (three-month periods) between the start andend dates. To use the quarter interval with a date value, specify either QUARTER or QTR; touse this interval with a datetime value, specify either DTQUARTER or DTQTR.
Using the DTQUARTER interval with a date value results in an incorrect count.
"MONTH"
This interval counts the number of months between the start and end dates. To use themonth interval with a date value, specify either MONTH or MON; to use this interval with adatetime value, specify either DTMONTH or DTMON.
Using the DTMONTH interval with a date value results in an incorrect count.
Reference for language elementsVersion 3.3
467
"SEMIMONTH"
This interval counts the number of semi-months (two-week periods) between the start andend dates. To use the semimonth interval with a date value, specify either SEMIMONTHor SEMIMON; to use this interval with a datetime value, specify either DTSEMIMONTH orDTSEMIMON.
Using the DTSEMIMONTH interval with a date value results in an incorrect count.
"TENDAY"
This interval counts the number of tenday periods between the start and end dates. To usethis interval with a date value, specify TENDAY; to use this interval with a datetime value,specify DTTENDAY.
Using the DTTENDAY interval with a date value results in an incorrect count.
"WEEK"
This interval counts the number of weeks between the start and end dates. To use thisinterval with a date value, specify WEEK; to use this interval with a datetime value, specifyDTWEEK. When using a discrete method, the default first day of a week is Sunday.
Using the DTWEEK interval with a date value results in an incorrect count.
"WEEKDAY"
This interval counts the number of weekdays (that is, ignoring Saturdays and Sundays)between the start and end dates. To use this interval with a date value, specify WEEKDAY;to use this interval with a datetime value, specify DTWEEKDAY.
"DAY"
This interval counts the number of days between the start and end dates. To use thisinterval with a date value, specify TENDAY; to use this interval with a datetime value,specify DTTENDAY.
Using the DTTENDAY interval with a date value results in an incorrect count.
"HOUR"
This interval can only be used with datetime or time values.
This interval counts the number of hours between the start and end datetimes or times. Touse this interval specify either HOUR or DTHOUR.
"MINUTE"
This interval can only be used with datetime or time values.
This interval counts the number of minutes between the start and end datetimes or times.To use this interval specify one of MINUTE, MIN, DTMINUTE, or DTMIN. The calculatedoutput is the same whichever alias is selected.
"SECOND"
This interval can only be used with datetime or time values.
Reference for language elementsVersion 3.3
468
This interval counts the number of seconds between the start and end datetimes or times.To use this interval specify one of SECOND, SEC, DTSECOND, or DTSEC. The calculatedoutput is the same whichever alias is selected.
start-date
Type: Numeric
The start date or datetime from which the number of increments is counted. This can be a knownvalue, a literal, or calculated using other functions that return a date or datetime value. The start-date is not included in the final calculation.
end-date
Type: Numeric
The end date or datetime to which the number of increments is counted. This can be a knownvalue, a literal, or calculated using other functions that return a date or datetime value.
methodOptional argument
"DISCRETE"
Counts the number of natural boundaries for the interval type between the start-dateand end-date. Counting natural boundaries is the default behaviour, and can lead tounexpected results, For example:
DATA _NULL_; V = INTCK("YEAR", "31-DEC-2015"D, "01-JAN-2017"D); PUT V;RUN;
Returns a count of two years, as there are two natural year boundaries between ten dates,even though the dates are one year and one day apart.
"DISC"
An alias of "DISCRETE".
"D"
An alias of "DISCRETE".
"CONTINUOUS"
Counts the completed number of increments between the start-date and end-date, withoutreference to the natural boundary of the increment type.
"CONT"
An alias of "CONTINUOUS".
"C"
An alias of "CONTINUOUS".
Reference for language elementsVersion 3.3
469
ExampleThe following uses INTCK with a continuous method to find the current age in years, assuming a birthdate of January 09 1982.
DATA _NULL_; birthDate = "09-JAN-1982"D; currentDate = TODAY(); cAge = INTCK("YEAR", birthDate, currentDate, "CONTINUOUS"); PUT "Current age: "cAge;RUN;
Which produces the following output in the log:
Current age: 34
INTNX
Counts the occurrence of "increments" from the start-date in "interval" times.
INTNX ( interval , start-date , increment [ , interval-point ] )
Returns a numeric time, date or datetime value calculated as an increment number of intervals, addedto the start-date. The calculated value takes account of the interval-point before the value is returned.The format of the value you require (date or datetime) from the function determines the interval labelyou should use to have correct data.
• If working with date values, increments covering year to day will return correct results. Do notattempt to use HOUR, MINUTE, or SECOND increments with date values.
• If working with datetime values, use increment names starting with DT. All values from DTYEARto DTSECOND can be used. In addition, HOUR, MINUTE and SECOND increments can be used withdatetime values.
• If working with time values, use the HOUR, MINUTE and SECOND increments.
Return type: Numeric
interval
The "units" by which the start-date is incremented. Once the date has been calculated, the returnvalue is determined by the interval-point selected, and varies dependent on the interval typeselected.
"YEAR"
This interval increments a date or datetime by one year at a time. To use the year intervalwith a date value, specify either YEAR or YR; to use this interval with a datetime value,specify either DTYEAR or DTYR.
Reference for language elementsVersion 3.3
470
The interval-point selected may have a notable effect on the accuracy of the result. Oncethe calculation is complete, the result is rounded to return January 1 of the year for aninterval-point of BEGINNING; July 1 or July 2 in leap years for an interval-point of MIDDLE;and December 31 for an interval-point of END. An interval-point of SAME preserves theoffset from the date or datetime within the resultant interval period.
Using the DTYEAR interval with a date value results in an innacurate result.
"SEMIYEAR"
This interval increments a date or datetime by six months at a time. To use the semiyearinterval with a date value, specify either SEMIYEAR or SEMIYR; to use this interval with adatetime value, specify either DTSEMIYEAR or DTSEMIYR.
The interval-point selected may have a noteable effect on the accuracy of the result. Aninterval-point of SAME preserves the offset from the date or datetime within the resultantinterval period; for other interval-points once the calculation is complete the result isrounded and, depending on which half of the year, the date or datetime value:
• For the first half of the year: January 1 for an interval-point of BEGINNING; April 1 for aninterval-point of MIDDLE; and June 30 for an interval-point of END.
• For the second half of the year: July 1 of the year for an interval-point of BEGINNING;September 30 for an interval-point of MIDDLE; and December 31 for an interval-point ofEND.
"QUARTER"
This interval increments a date or datetime by 3 months at a time. To use the quarterinterval with a date value, specify either QUARTER or QTR; to use this interval with adatetime value, specify either DTQUARTER or DTQTR.
The interval-point selected may have an effect on the result. An interval-point of SAMEpreserves the offset from the date or datetime within the resultant interval period; for otherinterval-points once the calculation is complete the result is rounded and, depending onwhich quarter of the year, the date or datetime value:
• For the first quarter of the year: January 1 for an interval-point of BEGINNING; February14 (February 15 in leap years) for an interval-point of MIDDLE; and March 31 for aninterval-point of END.
• For the second quarter of the year: April 1 for an interval-point of BEGINNING; May 16for an interval-point of MIDDLE; and June 30 for an interval-point of END.
• For the third quarter of the year: July 1 for an interval-point of BEGINNING; August 15for an interval-point of MIDDLE; and September 30 for an interval-point of END.
• For the fourth quarter of the year: October 1 for an interval-point of BEGINNING;November 15 for an interval-point of MIDDLE; and December 31 for an interval-point ofEND.
Reference for language elementsVersion 3.3
471
"MONTH"
This interval increments a date or datetime by one month at a time. To use the monthinterval with a date value, specify either MONTH or MON; to use this interval with a datetimevalue, specify either DTMONTH or DTMON.
The interval-point selected may have an effect on the result. An interval-point of SAMEpreserves the offset from the date or datetime within the resultant interval period; forother interval-points once the calculation is complete the result is rounded, and the resultreturned depends on the interval-point selected:
• With an interval-point of BEGINNING, using date values, returns the first day ofthe month containing the unrounded result; for datetime values, returns a valuecorresponding to midnight for the the first day of the month containing the unroundedresult.
• With an interval-point of MIDDLE, using date values, returns the middle day ofthe month containing the unrounded result; for datetime values, returns a valuecorresponding to 11:59:59 of the middle day of the month containing the unroundedresult.
• With an interval-point of END, using date values, returns the last day of the monthcontaining the unrounded result; for datetime values, returns a value corresponding to23:59:59 of the last day of the month containing the unrounded result.
"SEMIMONTH"
This interval increments a date or datetime by half a month at a time. A semimonth isfixed in the SAS language to: the first if the month to the fifteenth being the first half; thesixteenth of the month to the final day as the second half. To use the semimonth intervalwith a date value, specify either SEMIMONTH or SEMIMON; to use this interval with adatetime value, specify either DTSEMIMONTH or DTSEMIMON.
The interval-point selected may have an effect on the result. An interval-point of SAMEpreserves the offset from the date or datetime within the resultant interval period; for otherinterval-points once the calculation is complete the result is rounded depending on theinterval-point selected:
• With an interval-point of BEGINNING. For the first half of the month, returns the first ofthe month for date values, and midnight on the first of the month for datetime values.For the second half of the month returns the sixteenth for date values, and midnight onthe sixteenth of the month for datetime values.
• With an interval-point of MIDDLE. For the first half of the month, returns the eighth ofthe month for date values, and 11:59:59 on the eighth of the month for datetime values.For the second half of the month returns the middle-day between the sixteenth and themonth end for date values, and 23:59:59 on the same day for datetime values.
• With an interval-point of END. For the first half of the month, returns the fifteenth ofthe month for date values, and 11:59:59 on the fifteenth for datetime values. For thesecond half of the month returns the last day of the month for date values, and 23:59:59on the last day of the month for datetime values.
Reference for language elementsVersion 3.3
472
"TENDAY"
The tenday interval splits a month into ten day intervals, starting on the first, eleventhand twenty-first days of the month. Where a month has 31 days, the third tenday intervalincludes the thrity-first of the month.
This interval increments a date or datetime by one tenday period at a time. To use thisinterval with a date value, specify TENDAY; to use this interval with a datetime value,specify DTTENDAY.
Using an interval-point of SAME, the offset is maintined within the resultant interval,including the time portion of a datetime value. When using any other interval-point, oncethe calculation is complete the result is rounded depending on the interval-point selected:
• With an interval-point of BEGINNING. For date values the first interval in a monthreturns the first of the month; the second interval returms the eleventh of the month; thethird interval returns the twenty-first of the month. Datetime values return midnight onthe same days in the intervals.
• With an interval-point of MIDDLE. For date values the first interval in a month returnsthe fifth of the month; the second interval returms the fifteenth of the month; the thirdinterval returns either the twenty-fifth if the month has thirty day, or the twenty-sixth ifthe month has thirty-one days. Datetime values return midnight on the same days in theintervals.
• With an interval-point of END. For the first half of the month, returns the fifteenth ofthe month for date values, and 11:59:59 on the fifteenth for datetime values. For thesecond half of the month returns the last day of the month for date values, and 23:59:59on the last day of the month for datetime values.
"WEEK"
This interval increments a date or datetime by one week at a time. When using a weekincrement, the default first day of a week is Sunday.
Using an interval-point of SAME, the offset is maintined within the resultant interval,including the time portion of a datetime value. When using any other interval-point, oncethe calculation is complete the result is rounded depending on the interval-point selected:
• With an interval-point of BEGINNING. The default first day of a week, date values withtherefore return the date for the Sunday of the resultant interval, datetime values returnmidnight on Sunday of the resultant interval.
• With an interval-point of MIDDLE. Date values return the date for the Wednesday of theresulting interval, datetime values return 11:59:59 on the Wednesday of the resultantinterval.
• With an interval-point of END. Date values return the date for the Saturday of theresulting interval, datetime values return 23:59:59 on the Saturday of the resultantinterval.
Reference for language elementsVersion 3.3
473
"WEEKDAY"
This interval increments a date or datetime by one day at a time. This interval ignoresSaturdays and Sundays, meaning adding one weekday to a Friday returns the date for thefollowing Monday, adding two days returns the date for the following Tuesday.
To use this interval with a date value, specify WEEKDAY; to use this interval with a datetimevalue, specify DTWEEKDAY. Using the DTWEEKDAY interval with a date format results in aninnacurate date, as the calculated result is rounded to the entered interval-point in secondsbefore being returned from the function. Using the WEEKDAY interval with a datetime formatresults in a missing value.
"DAY"
This interval increments a date or datetime by one day at a time. To use this interval with adate value, specify DAY; to use this interval with a datetime value, specify DTDAY.
Using the DTDAY interval with a date format results in an innacurate date, as the calculatedresult is rounded to the entered interval-point in seconds before being returned from thefunction. Using the DAY interval with a datetime format results in a missing value.
"HOUR"
This interval can only be used with datetime or time values.
To use the hour interval, specify one of the following as the interval: HOUR, HR, DTHOUR, orDTHR. The calculated output is the same whichever alias is selected.
If you apply an hour interval to a date value the initial date is treated as the numberof seconds in a datetime value to which increment x 3600 seconds is added. Thecalculated value is rounded to increment-point, and the output treated as a day countresulting in an inaccurate date.
The following example shows the output when using datetime and date formats with aninterval denominated in hours:
DATA _NULL_; DATE1 = 1727568000; DATE2 = "29-SEP-2014"d; DOUT1 = INTNX ("HOUR", DATE1, 11); DOUT2 = INTNX ("HOUR", DATE2, 11); PUT "Stating DATETIME: " DATE1; PUT "INTNX DATETIME raw data: " DOUT1; PUT "DATETIME format with hours: " DOUT1 DATETIME.; PUT "Starting DATE: " DATE2; PUT "INTNX DATE raw data: " DOUT2; PUT "DATE format with hours: " DOUT2 DATE11.;RUN;
Reference for language elementsVersion 3.3
474
Which produces the following output in the log. The INTNX DATE raw data has beenrounded to the beginning of the interval, and must therefore be divisible by 3600.
Stating DATETIME: 1727568000INTNX DATETIME raw data: 1727607600DATETIME format with hours: 29SEP14:11:00:00Starting DATE: 19995INTNX DATE raw data: 57600DATE format with hours: 14-SEP-2117
"MINUTE"
This interval should only be used with datetime or time values.
To use the minute interval, specify one of the following as the interval: MINUTE, MIN,DTMINUTE, or DTMIN. The calculated output is the same whichever alias is selected.
If you apply a minute interval to a date value, the initial date is treated as the numberof seconds in a datetime value, to which increment x 60 seconds is added. Thecalculated value is rounded to increment-point, and the output treated as a day countresulting in an inaccurate date.
The following example shows the output when using datetime and date formats with aninterval denominated in minutes:
DATA _NULL_; DATE1 = 1727568000; DATE2 = "29-SEP-2014"d; DOUT1 = INTNX ("MINUTE", DATE1, 1001); DOUT2 = INTNX ("MINUTE", DATE2, 1001); PUT "Stating DATETIME: " DATE1; PUT "INTNX DATETIME raw data: " DOUT1; PUT "DATETIME format with minutes: " DOUT1 DATETIME.; PUT "Starting DATE: " DATE2; PUT "INTNX DATE raw data: " DOUT2; PUT "DATE format with minutes: " DOUT2 DATE11.;RUN;
Which produces the following output. The INTNX DATE raw data has been rounded tothe beginning of the interval, and must therefore be divisible by 60.
Stating DATETIME: 1727568000INTNX DATETIME raw data: 1727628060DATETIME format with minutes: 29SEP14:16:41:00Starting DATE: 19995INTNX DATE raw data: 80040DATE format with minutes: 21-FEB-2179
"SECOND"
This interval should only be used with datetime or time values.
To use the second interval, specify one of the following as the interval: SECOND, SEC,DTSECOND, or DTSEC. The caclulated output is the same whichever alias is selected.
Reference for language elementsVersion 3.3
475
If you apply this interval to a date value, the date is treated as the number of seconds ina datetime value, to which the increment number of seconds is added and the resultconveted to an inaccurate date.
The following example shows the output when using datetime and formats with an intervaldate denominated in seconds:
DATA _NULL_; DATE1 = 1727568000; DATE2 = "29-SEP-2014"d; DOUT1 = INTNX ("SECOND", DATE1, 10001); DOUT2 = INTNX ("SECOND", DATE2, 10001); PUT "Stating DATETIME: " DATE1; PUT "INTNX DATETIME raw data: " DOUT1; PUT "DATETIME format with seconds: " DOUT1 DATETIME.; PUT "Starting DATE: " DATE2; PUT "INTNX DATE raw data: " DOUT2; PUT "DATE format with seconds: " DOUT2 DATE11.;RUN;
Which produces the following output. Setting the interval to seconds means the calculatedresult is not rounded.
Stating DATETIME: 1727568000INTNX DATETIME raw data: 1727578001DATETIME format with seconds: 29SEP14:02:46:41Starting DATE: 19995INTNX DATE raw data: 29996DATE format with seconds: 15-FEB-2042
start-date
Type: Numeric
The start date, time or datetime to which an increment number of intervals is added. This can bea known value, a literal, or calculated using other functions that return a date, time or datetimevalue.
increment
Type: Numeric
The number of the selected interval to be added to the start-date.
interval-pointOptional argument
Determines the return point within the interval. When not entered, the default is the start of theselected interval. The calculated value is rounded to the interval-point selected before beingreturned by INTNX.
"BEGINNING"
Rounds the output to the start point of the current interval period.
Reference for language elementsVersion 3.3
476
"MIDDLE"
Rounds the output to the mid-point of the current interval period.
"END"
Rounds the output to the end-point of the current interval period.
"SAME"
Preserves the offset within the interval period. Alternatively, you can specify the alias"SAMEDAY".
DATDIF
Returns the number of days difference between two dates as a numeric value.
DATDIF ( start-date , end-date , basis )
The returned value is resolved using the basis, which determines how month and years are calculatedbetween the start-date and end-date. This function can only be used with date values; datetime valuescan be passed in to the function, but differences cannot be calculated between datetime values.
Return type: Numeric
start-date
Type: Numeric
The date value from which to begin counting, inclusive. This can be a known date value, a dateliteral, or calculated using other functions that return a date value.
end-date
Type: Numeric
The date value at which to stop counting. This date is excluded from the count. This can be aknown date value, a date literal, or calculated using other functions that return a date value.
basisThe basis determines how the days in the month and days in the year are calculated.
"30/360"
Each month is treated as containing 30 days, and the year 360 days. Differences withina month return the actual value; where a difference crosses the month boundary thereturned value is rounded to a 30 day month. Where the difference is greater than a year,the count is rounded assuming a 360 day year.
Reference for language elementsVersion 3.3
477
For example:
DATA _NULL_; startDate = "01-JAN-2015"D; endDate1 = "10-MAR-2015"D; endDate2 = "20-APR-2016"D; outDate1 = DATDIF(startDate, endDate1, "30/360"); outDate2 = DATDIF(startDate, endDate2, "30/360"); PUT "count between startDate and"; PUT "endDate1: " outDate1; PUT "endDate2: " outDate2;RUN;
Returns the following counts. Counting to endDate1 is two months and nine daysdifference, giving a total count of 69 days; endDate2 is greater than one year indifference, and can be calculated as one year (360 days), three months (90 days) and 19days for a total of 469 days.
count between startDate andendDate1: 69endDate2: 469
"360"
An alias of "30/360".
"ACT/ACT"
Returns the actual count of days between the start-date and end-date.
"ACTUAL"
An alias of "ACT/ACT", returning the actual count of days between the start-date and end-date.
"ACT/360"
Returns the actual count of days between the start-date and end-date, but assume 360days in the year when the difference is greater than a year.
"ACT/365"
Returns the actual count of days between the start-date and end-date, but assume 365days in the year when the difference is greater than a year.
YRDIF
Returns the number of years difference between two dates as a numeric value.
YRDIF ( start-date , end-date [ , basis ] )
Return type: Numeric
Reference for language elementsVersion 3.3
478
start-date
Type: Numeric
The date value from which to begin counting, inclusive. This can be a known date value, a dateliteral, or calculated using other functions that return a date value.
end-date
Type: Numeric
The date value at which to stop counting. This date is excluded from the count. This can be aknown date value, a date literal, or calculated using other functions that return a date value.
basisOptional argument
The basis determines how the days in the year are calculated, and consequently the difference inyears between two dates.
"AGE"
An alias of "ACTUAL".
"30/360"Returns the number of years' difference between the start-date and end-date, assumingthat each year contains 360 days. Where the result contains a fraction of a year, the actualdays within a month are returned, where the count crosses a month boundary, a 30 daymonth is assumed, and the count is rounded before being returned as the fractional part ofthe result.
"ACT/ACT"
An alias of "ACTUAL".
"ACTUAL"
Returns the number of years' difference between the start-date and end-date, taking intoaccount the actual number of days in each year.
"ACT/360"
Returns the number of years' difference between the start-date and end-date, assumingthat each year contains 360 days. Where the result contains a fraction of a year, the actualdays elapsed within the year is returned as the fractional part of the result.
Reference for language elementsVersion 3.3
479
"360"
Returns the number of years' difference between the start-date and end-date, assumingthat each year contains 360 days. The start-date and end-date are converted to dateformats and the difference is calculated as the number of elapsed days divided by 360.This calculation does not take into account the extra five days in each year, and maygenerate some unexpected results, for example:
DATA _NULL_; start="01-JAN-2000"D; current = "01-JAN-2016"D; C_360 = YRDIF(start, CURRENT, "360"); PUT C_360;RUN;
Where C_360 returns a value of 16.233333, rather than a value of 16 that might havebeen expected as both dates are January 1.
"ACT/365"
Returns the number of years' difference between the start-date and end-date, assumingthat each year contains 365 days. The start-date and end-date are converted to dateformats and the difference is calculated as the number of elapsed days divided by 365.Where the result contains a fraction of a year, the actual days elapsed within the year isreturned as the fractional part of the result.
"365"
Returns the number of years' difference between the start-date and end-date, assumingthat each year contains 365 days. The start-date and end-date are converted to dateformats and the difference is calculated as the number of elapsed days divided by 365.
Double-Byte functions and call routinesFunctions that enable you to manipulate strings consisting of DBCS characters.
The DBCS functions and CALL routines enable you to manipulate strings containing characters fromdouble-byte character sets. You can find and replace characters and strings, find the length of strings,and so on.
A double-byte character consists of a lead byte and a trail byte and requires two consecutive storagebytes; it must be treated as a single unit in any operation involving characters and strings. With thesefunctions you can manipulate strings that include DBCS characters on a character basis.
Reference for language elementsVersion 3.3
480
KCOMPARECompare two strings containing characters from a DBCS and indicate whether they differ.
KCOMPARE ( string1 , position , [ count ] [ , string2 ] )
Compares two strings containing characters from a double-byte character set (DBCS), and returns avalue that indicates whether they differ. You can compare the entire strings, or a substring to a string.
Return type: Numeric
string1
Type: Character
The source string to be compared.
position
Type: Character or numeric value
The position in source at which to start the comparison. This parameter is optional. If it isspecified, count must also be specified.
countOptional argument
Type: Character or numeric value
The number of characters to be compared. This parameter is optional. If it is specified, positionmust also be specified.
string2Optional argument
Type: Character
The string to be compared against source.
If position and count are not specified, the entire string in source is compared to the entire string incompare. If the two strings do not differ, 0 (zero) is returned.
If position and count are specified, the substring in source is compared to the string in compare. If thetwo strings do not differ, 0 (zero) is returned.
If the strings or the substrings do differ, the following values are returned:
-1 The first character that differs is lower in the collating sequence in source than it is in compare. For example,kcompare('r','s') will return -1.
1 The first character that differs is higher in the collating sequence in source than it is in compare. For example,kcompare('s','r') will return 1.
See the examples below for more information.
Reference for language elementsVersion 3.3
481
Example With No ParametersIn the following example, the function is used to compare two strings. The result is written to the log andto the example dataset.
data example; result = kcompare("熨斗目花色","熨斗目花色"); put result;run;
This produces the following output:
0
Both strings are exactly the same. As position and count are not specified, the entire strings arecompared.
Example — Showing Affect of Collation SequenceIn the following example, the function is used to compare two strings. The result is written to the log andto the example dataset.
data example; result = kcompare("熨斗目花色","熨目目花色"); put result;run;
This produces the following output:
-1
The value will be negative because 斗 is lower in the collating sequence than 目.
Example — Specifying SubstringsIn the following example, the function is used to compare a substring of the source to another string.The result is written to the log and to the example dataset.
data example; result = kcompare("熨斗目花色",3,2,"目花"); put result;run;
This produces the following output:
0
The specified substring of the source string matches the string being compared.
In the following example, the function is again used to compare a substring of the source to anotherstring. The result is written to the log and to the example dataset.
data example; result = kcompare("熨斗目花色",3,2,"目色"); put result;run;
Reference for language elementsVersion 3.3
482
This produces the following output:
1
The specified substring of the source does not match the string being compared, and the first characterthat does not match in the source is higher in the collating sequence.
KCOMPRESSRemove specified characters from a string consisting of DBCS characters.
KCOMPRESS ( string1 [ , rem-chars ] )
Removes occurrences of specified characters from a string consisting of characters from a double-byte character set, and returns the modified string. This function can be used to remove one or morecharacters you specify.
Return type: Character
string1
Type: Character
The string to be examined.
rem-charsOptional argument
Type: Character
A list of characters or a variable containing a list of characters to be removed from source. Forexample, setting this parameter to '青柳鼠' would remove all occurrences of those charactersfrom source. If you omit this parameter, all spaces and tabs are removed. If you set it to null (''),all spaces are removed, but tabs are retained.
Removing SpacesIn the following example, the function is used to compress spaces to nulls. The result is written to thelog and to the example dataset. In this example there is a tab between 猩々緋 and 青柳鼠.
data example; result = kcompress('青碧 熨斗目花色 ときがら茶 猩々緋 青柳鼠'); put result;run;
This produces the following output:
青碧熨斗目花色ときがら茶猩々緋青柳鼠
Spaces and tabs have been removed.
Reference for language elementsVersion 3.3
483
Removing Spaces While Retaining TabsIn the following example, the function is used to compress multiple spaces, excluding tabs. The result iswritten to the log and to the example dataset. In this example there is a tab between 猩々緋 and 青柳鼠.
data example; result = kcompress('青碧 熨斗目花色 ときがら茶 猩々緋 青柳鼠', ''); put result;run;
This produces the following output:
青碧熨斗目花色ときがら茶猩々緋 青柳鼠
All spaces have been removed, excluding tabs.
Removing Other CharactersIn the following example, the function is used to remove other characters. The result is written to the logand to the example dataset.
data example; result = kcompress('青碧、熨斗目花色、ときがら茶:とうきん煤竹 空五倍子色', '、:'); put result;run;
This produces the following output:
青碧熨斗目花色ときがら茶とうきん煤竹 空五倍子色
The commas and colon have been removed, but the space retained.
KCOUNTCount number of characters in a string requiring more than one byte to represent them in the currentcharacter set.
KCOUNT ( string )
Counts the number of characters in a string that require more than one byte to represent them in thecharacter set used during the current session, and returns that count.
Return type: Numeric
string
Type: Character
The string to be examined for DBCS characters.
Reference for language elementsVersion 3.3
484
ExampleIn the following example, the function is used to count the characters requiring more than one byteto represent them in a string containing both Latin and Japanese characters. The locale of WPSWorkbench would need to be set to Japanese_Japan to enable the example to work correctly.
data example; result = kcount('sin(x) の冪級数展開.その2: 奇数{1,3,5,7}'); put result;run;
This produces the following output:
11
KCVTConvert a string from one character set to another.
KCVT ( string , from-charset , to-charset )
Return type: Character
Converts a source string from one character set to another character set, and returns the resultingstring. You must specify both the character set to be converted from and converted to.
string
Type: Character
The string to be converted.
from-charset
Type: Character
The character set of the source string.
to-charset
Type: Character
The character set to which the string will be converted.
You will need to know the character set of the source string to convert it. If you specify an unrecognisedcharacter set for from-charset or to-charset, the function fails and an error message is written tothe log. If a character in the string cannot be mapped to another character in the to-charset, themessage WARNING: An unmappable character was encountered during charactertranscoding is written to the log.
Reference for language elementsVersion 3.3
485
ExampleIn the following example, the function is used to convert a string from the windows-1252 dataset toUTF-8. The result is written to the log and to the example dataset.
data example; result = quote(kcvt('†‡€','windows-1252','UTF-8')); put result;run;
This produces the following output:
"†‡€"
The quotation marks are added by the QUOTE function. The UTF-8 conversion cannot be renderedcorrectly in WPS on Windows using the default character set.
KINDEXGet the starting position of a string within another string consisting of DBCS characters.
KINDEX ( string , substring )
Finds the starting point of a substring within a source string that consists of characters from a double-byte character set (DBCS). If the substring is not found, zero (0) is returned.
Return type: Numeric
string
Type: Character
A string to be examined for a substring.
substring
Type: Character
The substring to be found in source.
ExampleIn the following example, the function is used to find the substring ときがら茶 in a source string. Theposition at which it is first found is written to the log and to the example dataset.
data example; search='ときがら茶'; result = kindex('青碧 熨斗目花色 ときがら茶 猩々緋 青柳鼠', search); put result;run;
Reference for language elementsVersion 3.3
486
This produces the following output:
10
which is the first position at which the string was found.
KINDEXCReturn the first position at which specified characters occur in a string comprising DBCS characters.
KINDEXC ( string , { chars , … } )
Finds a specified character or string (an excerpt) within a string consisting of characters from double-byte character set (DBCS), and returns the position at which the excerpt is first found. If the excerpt isnot found, 0 (zero) is returned.
Return type: Numeric
string
Type: Character
A string be examined for an excerpt.
chars
Type: Character
A character or string to be searched for in source.
ExampleIn the following example, the function is used to find one of the characters と斗 in a source string. Theposition at which one of these characters is first found is written to the log and to the example dataset.
data example; search='と斗'; result = kindexc('青碧 熨斗目花色 ときがら茶 猩々緋 青柳鼠', search); put result;run;
This produces the following output:
5
This is the position at which 斗 is first found.
Reference for language elementsVersion 3.3
487
KLEFTRemove leading (left-hand) spaces from string consisting of DBCS characters.
KLEFT ( string )
Removes any leading spaces at the left-hand of a source string consisting of characters from a double-byte character set (DBCS). The spaces will be appended to the right of the source; whether theappended spaces are returned with the string depends on subsequent functions and actions; see thesection below for examples.
Return type: Character
string
Type: Character
A string from which leading spaces will be removed.
ExampleIn the following example, the function is used to remove the leading spaces from a source string. Theresult is written to the log and to the example dataset. The QUOTE function is used to apply quotationmarks to the returned string, enabling you to see that spaces have been moved to the trailing (right-hand) position. The PUT statements add the string 熨斗目花色; the second PUT shows how in thisinstance the appended spaces are lost. The third PUT statement shows the result of concatenating theLEFT result with the string 熨斗目花色; again, this demonstrates that the leading spaces have beenremoved and appended as trailing spaces.
data example; text=' 熨斗目花色'; result = quote(kleft(text)); result2 = kleft(text); result3 = cat(kleft(text),'熨斗目花色'); put result '熨斗目花色'; put result2 '熨斗目花色'; put result3;run;
This produces the following output:
"熨斗目花色 " 熨斗目花色熨斗目花色 熨斗目花色熨斗目花色 熨斗目花色
In the first result, quoting the returned string (using the QUOTE function) has retained the appendedspaces. In the second result, concatenating the strings using the PUT function has removed theappended spaces. In the third result, concatenating strings using the CAT function has retained theappended spaces.
Reference for language elementsVersion 3.3
488
KLENGTHReturn the length of a non-blank character string consisting of DBCS characters.
KLENGTH ( string )
Returns the length of a non-blank character string consisting of characters from a double-byte characterset (DBCS), excluding any trailing blanks. If the string is blank (null, or composed entirely of spaces),the functions returns the value 1. If a number is specified as an argument, a value of 12 is returned,and a message written to the log noting that numeric values have been converted to character values.
Return type: Numeric
string
Type: Character
The string to be examined.
ExampleIn the following example, the function is used to find the length of various strings. The results are writtento the log and to the example dataset.
data example; number=123456789012345678; result1=klength('青碧 熨斗目花色 ときがら茶 猩々緋 青柳鼠 '); result2=klength(' '); result3=klength(number); put result1; put result2; put result3;run;
This produces the following output:
22 0 12
In this example:
• The first use of the function returns the value 22, which is the length of the string without trailingblanks.
• The second use of the function returns the value 0, as the string contains only blanks.• The third use of the function returns the value 12, because the string contains a numeric value. A
message is written to the log noting that numeric values have been converted to character values.
Reference for language elementsVersion 3.3
489
KLOWCASEConvert all uppercase characters in a string of DBCS characters to lowercase.
KLOWCASE ( string )
Converts all uppercase alphabetic characters in a string consisting of characters from a double-byte character set (DBCS) to corresponding lowercase characters, and returns the result. Strings inlanguages that have no equivalent lowercase characters are returned unmodified.
Return type: Character
string
Type: Character
A string in which uppercase characters are to be converted.
ExampleIn the following example, the function is used to find upper case characters in the source strings; theseare then converted to lowercase characters. The result is written to the log and to the example dataset.
data example; result = klowcase('ΙΑΝΟΥΆΡΙΣ ΦΕΒΡΟΥΆΡΙΟΣ'); put result;run;
This produces the following output:
ιανουάρις φεβρουάριος
KPROPCASEConvert characters from a DBCS between into another form, such as half-katakana to full-katakana oruppercase to lowercase.
KPROPCASE ( string [ , options ] )
Converts characters from a double-byte character set from one form to another, such as a half-widthkatakana character to a full-width katakana, or a lowercase character to an uppercase character, andreturns the results.
Return type: Character
string
Type: Character
The string to be converted.
Reference for language elementsVersion 3.3
490
optionsOptional argument
Type: Character
Options that define the type of conversion. The following are available:
HALF-KATAKANA, FULL-KATAKANA Convert half-width katakana to full-width katakana.FULL-KATAKANA, HALF-KATAKANA Convert full-width katakana to half-width katakana.KATAKANA, ROMAJI Convert katakana characters to romaji characters.ROMAJI, KATAKANA Convert romaji characters to katakana characters.HALF-ALPHABET, FULL-ALPHABET Convert half-width characters (as used to display
Korean or Chinese characters, for example) into full-width characters.
FULL-ALPHABET, HALF-ALPHABET Convert full-width characters (as used to displayKorean or Chinese. for example,) into half-widthcharacters.
LOWERCASE, UPPERCASE Convert lowercase characters to uppercasecharacters.
UPPERCASE, LOWERCASE Convert uppercase characters to lowercasecharacters.
Convert Full-width Katakana to Half-widthThe following example changes Japanese katakana characters to half-katakana characters and backagain.
data example; result1 = kpropcase('テレビ コンピューター', 'FULL-KATAKANA, HALF-KATAKANA'); result2 = kpropcase(result1, 'HALF-KATAKANA, FULL-KATAKANA'); put result1; put result2;run;
This produces the following output:
Reference for language elementsVersion 3.3
491
Example – Katakana Characters to Romaji and BackThe following example changes Japanese characters to romaji characters and back again.
data example; text='猩々緋 '; result = quote(kright(text)); result2 = cat('熨斗目花色', kright(text)); put result; put '熨斗目花色 ' result; put result2;run;
This produces the following output:
TEREBI KONPYŪTĀテレビ コンピューター
Convert Uppercase Characters to Lowercase and BackThe following example changes uppercase Greek characters to lowercase characters and back again.
data example; result1 = kpropcase('ΙΑΝΟΥΆΡΙΣ ΦΕΒΡΟΥΆΡΙΟΣ','uppercase, lowercase'); result2 = kpropcase(result1,'lowercase, uppercase'); put result1; put result2;run;
This produces the following output:
ιανουάρις φεβρουάριοςΙΑΝΟΥΆΡΙΣ ΦΕΒΡΟΥΆΡΙΟΣ
KREVERSEReverse a string consisting of DBCS characters.
KREVERSE ( string )
Reverses a string containing characters from a double-byte character set (DBCS), and returns theresult.
Return type: Character
string
Type: Character
The string to be reversed.
Reference for language elementsVersion 3.3
492
ExampleIn the following example a string is reversed. The result is written to the log and to the exampledataset.
data example; sentence='熨斗目花色'; result=kreverse(sentence); put 'The word reversed is: result;run;
This produces the following output:
色花目斗熨
KRIGHTRemove trailing (right-hand) spaces from DBCS string.
KRIGHT ( string )
Removes any trailing spaces at the right-hand of a source string consisting of characters from a double-byte character set (DBCS).
The spaces will be prepended at the left-hand side of the source, becoming leading spaces. Whetherthe prepended spaces are retained depends on subsequent functions and actions; see the sectionbelow for examples.
Return type: Character
string
Type: Character
The string from which trailing spaces are to be removed.
Reference for language elementsVersion 3.3
493
ExampleIn the following example, the function is used to remove the trailing spaces from a source string. Theresults are written to the log and to the example dataset. The second PUT statement adds the wordMetal; this second example shows how the appended spaces are lost. The third PUT statement showsthe result of concatenating the RIGHT result with the string Metal; this demonstrates that the trailingspaces have been removed and appended as leading spaces.
data example; text='猩々緋 '; result = kright(text); result1 = quote(kright(text)); result2 = cat('熨斗目花色', kright(text)); put result; put result1; put '熨斗目花色 ' result; put result2;run;
This produces the following output:
猩々緋" 猩々緋"熨斗目花色 猩々緋熨斗目花色 猩々緋
In the first result, the PUT has removed the prepended spaces. In the second result, quoting thereturned string (using the QUOTE function) has retained the prepended spaces. In the third and fourthresults, the concatenation of the strings has also retained the prepended spaces.
KSCANFind the word at a specified index position in a string consisting of DBCS characters.
KSCAN ( string , n [ , delimiters ] )
Finds and returns a specified index position in a source string containing characters from a double-bytecharacter set (DBCS).
The source string is treated as a list of words delimited by spaces (by default) or any other characteryou specify. Each word occupies a position in the list from 1-n and can be accessed using this function.
Return type: Character
string
Type: Character
The string to be examined. This parameter is mandatory.
Reference for language elementsVersion 3.3
494
n
Type: Numeric
The position of the word in the string you want to examine. This parameter is mandatory.
delimitersOptional argument
Type: Character
A delimiter used to separate words. This parameter is optional. You can specify more than onedelimiter.
If you do not specify a delimiter, spaces (but not tabs) are recognised as delimiters. If you specifydelimiters, spaces are still recognised as delimiters. Tabs are not recognised as spaces, so if thesource includes tab delimiters you must enter a tab in delimiter.
Basic ExampleIn the following example, the function is used to find the fourth word in a string. The result is written tothe log and to the example dataset. No delimiter is specified, so spaces are used as delimiters.
data example; result = kscan('青碧 熨斗目花色 ときがら茶 猩々緋 青柳鼠',4); put "The fourth word is: " result;run;
This produces the following output:
The fourth word is: 猩々緋
Example — Source Using Specified DelimitersIn the following example, the function is used to find the fourth word in a string. The result is written tothe log and to the example dataset.
data example; word1 = kscan('青碧 熨斗目花色 、 猩々緋 青柳鼠 ときがら茶',1,'、 '); word2 = kscan('青碧 熨斗目花色 、 猩々緋 青柳鼠 ときがら茶',2,'、 '); word3 = kscan('青碧 熨斗目花色 、 猩々緋 青柳鼠 ときがら茶',3,'、 '); put "The first word is: " word1; put "The second word is: " word2; put "The third word is: " word3;run;
This produces the following output:
The first word is: 青碧 熨斗目花色The second word is: 猩々緋 青柳鼠The third word is: ときがら茶
The first delimiter found is 、 so the first two strings are seen as one word. The second delimiter foundis a tab (the space in 猩々緋 青柳鼠 is ignored), so the third and fourth strings are seen as one word.The third word ときがら茶 appears after the second delimiter, the tab.
Reference for language elementsVersion 3.3
495
KSTRCATConcatenate DBCS characters or strings to create another DBCS string.
KSTRCAT ( { item , … } )
Concatenates a comma-separated list of double-byte character set (DBCS) characters, or stringsconsisting of such characters, to create another string. Any spaces in the strings are preserved andincluded in the concatenated string. Otherwise, the strings are concatenated without spaces.
Return type: Character
item
Type: Character
A character or string.
ExampleIn this example, the function concatenates the comma-separated list of strings to form a new string. Theresult is written to the log.
data _null_; result1 = kstrcat("青碧","熨斗目花色","青柳鼠"); result2 = kstrcat(" 青碧"," 熨斗目花色 "," 青柳鼠"); put "The concatenated string is: " result1; put "The concatenated string is: " result2;run;
This produces the following output:
The concatenated string is: 青碧熨斗目花色青柳鼠The concatenated string is: 青碧 熨斗目花色 青柳鼠
In the first result, the strings have been concatenated. No separators have been inserted betweenstrings.
In the second result, the strings have been concatenated and their spaces retained (except for thefirst string where leading spaces have been stripped by the PUT). No separators have been insertedbetween strings. The only spaces are those associated with the original strings.
KSUBSTRReturn a substring from a source string consisting of DBCS characters, starting at a specified character.
KSUBSTR ( string , position [ , length ] )
Finds and returns the substring that starts at a specified position in a source string consisting of double-byte character set (DBCS) characters. You can also optionally specify the length of string to return.
Reference for language elementsVersion 3.3
496
Return type: Character
string
Type: Character
The source string.
position
Type: Numeric
The position in the source string at which to return the substring of length.
lengthOptional argument
Type: Numeric
The number of characters of the source string to be read.
If you do not specify length, the substring found starting at position through to the end of the sourcestring is returned. If length would result in an attempt to read over the end of string, the length isassumed to be through to the end of the string. If length is set to 0 (zero), no substring is returned.
Basic ExampleIn the following example, the function is used to find and return the string that begins at position 18 andis six characters long. The result is written to the log and to the example dataset.
data example; result=quote(ksubstr("青碧 熨斗目花色 、 猩々緋 青柳鼠 ときがら茶", 18,6)); put "The substring found is: " result;run;
This produces the following output:
The substring found is: 柳鼠 ときが
Example Reading Over the End of StringIn the following example, the function is used to find and return the string that begins at positioneighteen and is fifteen characters long. The result is written to the log and to the example dataset.
data example; result=ksubstr("青碧 熨斗目花色 、 猩々緋 青柳鼠 ときがら茶", 18,15); put "The substring found is: " result;run;
This produces the following output:
The substring found is: 柳鼠 ときがら茶
In this example, there are fewer than fifteen characters after character position eighteen, so thesubstring from position eighteen through to the end of the string is returned.
Reference for language elementsVersion 3.3
497
KSUBSTRBReturn a substring from a source string consisting of DBCS characters, starting at a specified byte.
KSUBSTRB ( string , position [ , length ] )
Finds and returns the substring that starts at a specified byte in a source string comprised of double-byte character set characters. You can also optionally specify the length of string to return.
Return type: Character
string
Type: Character
The source string.
position
Type: Numeric
The byte position in the source string at which to return the substring.
lengthOptional argument
Type: Numeric
The number of bytes of the source string to be read.
If you do not specify length, the substring found starting at position through to the end of the sourcestring is returned. If length would result in an attempt to read over the end of the string, an errormessage is returned with the result; the result is the substring from the starting position specifiedthrough to the end of the string. If length is set to 0 (zero), no substring is returned.
Basic ExampleIn the following example, the function is used to find and return the string that begins at byte eighteenand is 24 bytes long. The result is written to the log and to the example dataset.
data example; result=ksubstrb("青碧 熨斗目花色 、 猩々緋 青柳鼠 ときがら茶", 18,24); put "The substring found is: " result;run;
This produces the following output:
The substring found is: 花色 、 猩々緋 青
Note:If you had specified 19 as that start byte, no string would have been returned as that start positionwould have split the byte representing a character.
Reference for language elementsVersion 3.3
498
Example — Returning an ErrorIn the following example, the function is used to find and return the string that begins at byte 38 and is28 bytes long. The result is written to the log and to the example dataset.
data example; result=ksubstrb("青碧 熨斗目花色 、 猩々緋 青柳鼠 ときがら茶", 38,28); put "The substring found is: " result;run;
This produces the following output:
NOTE: Argument 3 to function KSUBSTRB at line 3669 column 11 is invalidThe substring found is: 青柳鼠 ときがら茶
KTRANSLATEChange a character in a DBCS string to another character.
KTRANSLATE ( string , from , { to , … } )
Finds all instance of a specified character in a string consisting of double-byte character set (DBCS)characters, changes (translates) them to another specified character, and returns the modified string.You can change more than one character.
Return type: Character
string
Type: Character
The string to be modified.
from
Type: Character
The character to convert (translate) to.
to
Type: Character
The character to convert (translate) from.
Note:You can also specify multiple characters to change as groups of to/from parameters; for example:
ktranslate(orig, '鼠青', '柳斗')
Reference for language elementsVersion 3.3
499
ExampleIn the following example, the function is used to convert the characters 柳 and 斗 into 鼠 and 青. Theresult is written to the log and to the example dataset.
data example; orig = "青碧 熨斗目花色 猩々緋 青柳鼠 ときがら茶"; result1 = ktranslate(orig, '鼠', '青', '柳', '斗'); result2 = ktranslate(orig, '鼠柳', '青斗'); put "Original string is: " orig; put "Transformed string is: " result1; put "Transformed string is: " result2;run;
This produces the following output:Original string is:
青碧 熨斗目花色 猩々緋 青柳鼠 ときがら茶Transformed string is: 鼠碧 熨柳目花色 猩々緋 鼠柳鼠 ときがら茶Transformed string is: 鼠碧 熨柳目花色 猩々緋 鼠柳鼠 ときがら茶
In the first translation, multiple characters to be translated have been grouped in the to and fromparameters. In the second translation, each character to translate to and from have been specified inseparate to and from parameters. The results are, however, the same.
KTRIMTrim trailing spaces from a string consisting of DBCS characters.
KTRIM ( string )
Removes trailing spaces from a source string consisting of characters from a double-byte characterset (DBCS), and returns the modified string. No other spaces are stripped. A trailing horizontal tab isrecognised as a space, and so will also be removed.
Return type: Character
string
Type: Character
The string to be stripped of trailing spaces.
ExampleIn the following example, the function is used to strip spaces from a string. The trailing spaces consist ofa tab and two spaces. The result is written to the log and to the example dataset.
data example; result= quote(ktrim(" 青碧 熨斗目花色 、 猩々緋 青柳鼠 ")); put result;run;
Reference for language elementsVersion 3.3
500
This produces the following output:
" 青碧 熨斗目花色 、 猩々緋 青柳鼠"
KTRIM has removed all trailing spaces, including tabs, while retaining leading spaces. QUOTE haswrapped the string in double quotation marks, enabling the retained spaces to be seen.
KTRUNCATETruncate a DBCS string at a specified position.
KTRUNCATE ( string , length )
Truncates a string consisting of characters from a double-byte character set (DBCS) at a specifiedposition, and returns the truncated string.
Return type: Character
string
Type: Character
The string to be truncated.
length
Type: Numeric
The number of bytes of the string in argument, starting from the first character, to be retained.
ExampleIn the following example, the function is used to truncate a string. The result is written to the log and tothe example dataset.
data example; result1 = ktruncate('青碧 熨斗目花色 猩々緋 青柳鼠', 12); put "The truncated string is: " result1;run;
This produces the following output:
The truncated string is: 青碧 熨
The resulting string retains the first four characters (including the space), which is the first twelve bytesof the source string.
Reference for language elementsVersion 3.3
501
KUPCASEConvert all lowercase characters in a DBCS string to uppercase.
KUPCASE ( string )
Converts all lowercase alphabetic characters in a string consisting of characters from a double-bytecharacter set (DBCS) to corresponding uppercase characters, and returns the modified string. Strings inlanguages that have no equivalent uppercase characters are returned unmodified.
Return type: Character
string
Type: Character
A character or string of characters to be converted from lowercase to uppercase.
ExampleIn the following example, the function is used to convert lowercase characters to uppercase. The resultis written to the log and to the example dataset.
data example; result = kupcase('ιανουάρις φεβρουάριος'); put result;run;
This produces the following output:
ΙΑΝΟΥΆΡΙΣ ΦΕΒΡΟΥΆΡΙΟΣ
KUPDATEReplace a substring at a specified position in a DBCS string.
KUPDATE ( string , position , n [ , replacement ] )
Replaces a substring in a string consisting of characters from a double-byte character set (DBCS),with another string. The replacement starts at a specified point in the string, and replaces a specifiednumber of characters. The number of characters replaced do not have to match the length of thereplacement string.
Return type: Character
string
Type: Character
The source string.
Reference for language elementsVersion 3.3
502
position
Type: Numeric
The character position in source at which insert replacement. If this is beyond the end of source,replacement is appended to source.
n
Type: Character or numeric value
The number of characters in source to be replaced.
replacementOptional argument
Type: Character
The string to be inserted into source.
ExamplesIn the following example, the function is used to insert the string テレビ starting at the fourteenthcharacter in the source string. The result is written to the log and to the example dataset.
data example; result= kupdate("青碧 熨斗目花色 猩々緋 青柳鼠 ときがら茶", 14, 3, 'テレビ'); put "Modified output: " result;run;
This produces the following output:
Modified output: 青碧 熨斗目花色 猩々緋 テレビ ときがら茶
KUPDATEBReplace a substring at a specified byte position in a DBCS string.
KUPDATEB ( string , position , n [ , replacement ] )
Replaces a substring in a string consisting of characters from a double-byte character set with anotherstring. The replacement starts at a specified byte in the string, and optionally replaces a specifiednumber of characters. The number of characters replaced do not have to match the length of thereplacement string.
Return type: Character
string
Type: Character
The source string.
Reference for language elementsVersion 3.3
503
position
Type: Numeric
The byte in source at which to insert replacement. If this is beyond the end of source,replacement is appended to source.
n
Type: Character or numeric value
The number of bytes in source to be replaced.
replacementOptional argument
Type: Character
The string to be inserted into source.
ExampleIn the following example, the function is used to insert the string テレビ starting at the 34th byte in thestring. The result is written to the log and to the example dataset.
data example; result= kupdateb("青碧 熨斗目花色 猩々緋 青柳鼠 ときがら茶", 34, 10, 'テレビ'); put "Modified output: " result;run;
This produces the following output:
Modified output: 青碧 熨斗目花色 猩々緋 テレビ ときがら茶
KVERIFYVerifies that a character or string exists in another DBCS string.
KVERIFY ( string , { excerpt , … } )
Searches a source string, consisting of characters from a double-byte character set, and verifieswhether one or more substrings (excerpts) exist or not in that string. The function returns the positionof the first character in the source string that does not match the excerpt. If the source string containsnone of the specified excerpts 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be searched for specified substrings.
Reference for language elementsVersion 3.3
504
excerpt
Type: Character
A character or substring to be found in source.
Example — Verifying Strings Contains Single CharactersIn the following example, the function searches for the character 青. The result is written to the log andto the example dataset.
data example; result = kverify('青碧 熨斗目花色 猩々緋 青柳鼠 ときがら茶', '青'); put 'The character is first NOT found at position: ' result;run;
This produces the following output:
The character is first NOT found at position: 2
In the following example, the function searches for the character 碧. The result is written to the log andto the example dataset.
data example; result = kverify('青青青青青青青青碧碧碧碧碧碧', '碧'); put 'The character is first NOT found at position: ' result;run;
This produces the following output:
The character is first NOT found at position: 1
In the following example, the function searches for the characters 碧 and 青. The result is written to thelog and to the example dataset.
data example; result = kverify('青青青青青青青青碧碧碧碧碧碧', '碧','青'); put 'The character is first NOT found at position: ' result;run;
This produces the following output:
The character is first NOT found at position: 0
The function returns 0 (zero) in this instance as there is nowhere in the string where one of thecharacters does not exist.
Example — Verifying that Strings Contains SubstringsIn the following example, the function searches for the string 熨斗目花色. The result is written to the logand to the example dataset.
data example; result = kverify('青碧 熨斗目花色 猩々緋 青柳鼠 ときがら茶', '熨斗目花色'); put 'The string is first NOT found at position: ' result;run;
Reference for language elementsVersion 3.3
505
This produces the following output:
The string is first NOT found at position: 1
In the following example, the function searches for the strings 青碧 and 熨斗目花色. The result is writtento the log and to the example dataset.
data example; result = kverify('青碧 熨斗目花色 猩々緋 青柳鼠 ときがら茶', '青碧', '熨斗目花色'); put 'The strings are first NOT found at position: ' result;run;
This produces the following output:
The strings are first NOT found at position: 15
UNICODEConvert a string to its Unicode equivalent.
UNICODE ( string [ , encoding-type ] )
Converts a string to a specified Unicode encoding type.
Return type: Character
string
Type: Character
The string to be converted.
encoding-typeOptional argument
Type: Character
The Unicode encoding to which source is to be converted. This can be:
UTF8 Convert source to UTF-8.UCS2 Convert source to UTF-16.UTF16 Convert source to UTF-16.UCS2B Convert source to UTF-16BE.UTF16B Convert source to UTF-16BE.UCS2L Convert source to UTF-16LE.UTF16L Convert source to UTF-16LE.UCS4 Convert source to UTF-32LE.UCS4B Convert source to UTF-32BE.
Reference for language elementsVersion 3.3
506
UCS4L Convert source to UTF-3LBE.ESC Convert Unicode codepoints specified with the escape (\) character to the
equivalent character in the project character set; for example, \u5927 isconverted to the letter a.
NCR Convert Unicode codepoints specified using numeric character reference formatto the equivalent character in the project character set; for example: 大 is converted to the letter a.
PAREN Convert Unicode codepoints specified using parentheses (<>) to the equivalentcharacter in the project character set; for example: <u5927> is converted to theletter a.
If a codepoint is specified, it will only be converted to a character if the current character set for theproject contains that codepoint.
ExampleIn the following example, the function is used to convert hexadecimal strings to UTF-8 and UTF-16encodings. The result is written to the log.
data _null_; result1 = unicode('004C006F006F006B0021203A'x, 'UTF16'); result2 = unicode('004C006F006F006B0021203A'x, 'UTF8'); result3 = unicode('\u004C\u006F\u006F\u006B\u0021\u203A', 'ESC'); put 'Conversion to UTF-16: ' result1; put 'Conversion to UTF-8: ' result2; put 'Conversion from escaped Unicode: ' result3; run;
In WPS on Windows 10 with the default character set (CP1252), this produces the following output:
Conversion to UTF-16: Look!›Conversion to UTF-8: L o o k ! :Conversion from escaped Unicode: Look!›
The UTF-8 encoding has alternate unprintable characters (determined by the hexadecimal values'00'x and '20'x), because in UTF-8 a character might be represented by one, two or more bytes.For example, the string begins with '004C'x, and in UTF-8, '00'x is the NUL character, and '4C'xis the L character. In UTF-16, however, a character is represented by two two-byte groups; therefore,the same '004C'x is the L character. Similarly the string ends with the hexadecimal number '203A'x.In UTF-8, this represents two characters, '20'x, the space character, and '3A'x, the colon (:). InUTF-16, the hexadecimal number'203A'x is the single right-pointing angle quotation mark.
In the third example of the function, the characters are Unicode codepoints indentified by the \ucombination, and these are returned as characters from the character set of Workbench.
Reference for language elementsVersion 3.3
507
UNICODECRepresent characters in a Unicode format.
UNICODEC ( string [ , encoding-type ] )
Returns characters in a string in a specified Unicode format.
Return type: Character
string
Type: Character
The string to be converted.
encoding-typeOptional argument
Type: Character
The Unicode format in which DBCS characters in source will be returned. The following optionsare available:
UTF8 Convert source to UTF-8.UCS2 Convert source to UTF-16.UTF16 Convert source to UTF-16.UCS2B Convert source to UTF-16BE.UTF16B Convert source to UTF-16BE.UCS2L Convert source to UTF-16LE.UTF16L Convert source to UTF-16LE.UCS4 Convert source to UTF-32LE.UCS4B Convert source to UTF-32BE.UCS4L Convert source to UTF-3LBE.ESC Convert Unicode codepoints specified with the escape (\) character to the
equivalent character in the project character set; for example, \u5927 isconverted to the letter a.
NCR Convert Unicode codepoints specified using numeric character reference formatto the equivalent character in the project character set; for example: 大 isconverted to the letter a.
PAREN Convert Unicode codepoints specified using parentheses (<>) to the equivalentcharacter in the project character set; for example: <u5927> is converted to theletter a.
If a codepoint is specified, it will only be converted to a character if the current character set for theproject contains that codepoint.
Reference for language elementsVersion 3.3
508
ExampleThe following example returns encoded strings in the specified format. The UNICODE function is firstused to translate a string from escaped Unicode format. The result is written to the log and to theexample dataset.
data _null_; x = unicode('\u0061\u5927'); result1 = unicodec(x, "ESC"); result2 = unicodec(x, "NCR"); result3 = unicodec(x, "PAREN"); result4 = unicodec(x, "UTF8"); put x; put "ESC formats as: " result1; put "NCR formats as: " result2; put "PAREN formats as: " result3; put "UTF8 formats as: " result4;run;
This produces the following output:
a大ESC formats as: a\u5927NCR formats as: a大PAREN formats as: a<u5927>UTF8 formats as: a大
UNICODELENFind the length of a string in selected Unicode encoding.
UNICODELEN ( string [ , encoding-type ] )
Find the length of a string in a specified Unicode encoding, and return the result. You can specify eitherUTF-8 or UTF-16 encoding.
Return type: Numeric
string
Type: Character
The string whose length is to be found.
encoding-typeOptional argument
Type: Character
The Unicode encoding for source. This can be:
UTF8 UTF-8.UCS2 UTF-16.
Reference for language elementsVersion 3.3
509
UTF16 UTF-16.UCS2B UTF-16BE.UTF16B UTF-16BE.UCS2L UTF-16LE.UTF16L UTF-16LE.UCS4 UTF-32LE.UCS4B UTF-32BE.UCS4L UTF-3LBE.ESC Unicode codepoints specified with the escape (\) character; example, \u5927
(the letter a).NCR Unicode codepoints specified a numeric character references; for example:
大 (the letter a).PAREN Unicode codepoints specified using parentheses (<>); for example: <u5927>
(the letter a).
ExampleIn the following example, the function finds the length of a string in UTF-8 and UTF-16 encoding. Theresult is written to the log.
data _null_; result1 = unicodelen('004C006F006F006B0021203A'x, 'UTF8'); result2 = unicodelen('004C006F006F006B0021203A'x, 'UCS2B'); result3 = unicodelen('\u004C\u006F\u006F\u006B\u0021\u203A', 'ESC'); put result1; put result2; put result3;run;
In WPS on Windows 10 with the default character set (CP1252), this produces the following output:
1266
The UTF-8 encoding has alternate unprintable characters (determined by the hexadecimal values'00'x and '20'x), because in UTF-8 a character might be represented by one, two or more bytes.For example, the string begins with '004C'x, and in UTF-8, '00'x is the NUL character, and '4C'xis the L character. In UTF-8, the string is L o o k ! : and is therefore twelve characters long. InUTF-16, however, a character is represented by two two-byte groups; therefore, the same '004C'x isthe L character. Similarly at the end of the string the hexadecimal number '1203'x represents space('20'x), and colon (:) in UTF-8. In UTF-16, the hexadecimal number '1203'x represents the singleright-pointing angle quotation mark (›). In UTF-16, the string is Look!›, and is six characters long.
In the third result, the number of Unicode characters identified by the escape character (\) are counted;the string is therefore six characters long, and 6 is returned as the length of the string by the function.
Reference for language elementsVersion 3.3
510
Decision forest functions and call routinesA decision forest takes an ensemble approach to a a collection of decision trees to create anapproximation to the underlying data.
The prediction produced by a decision forest combines the predictions made by each individual tree.For classification trees the prediction of the forest is the class that gains the most votes from eachtree. For a regression tree the prediction of the forest is the mean average of the prediction from eachtree. There are multiple ways in which decision forests can be trained, WPS uses the R randomForestpackage and the algorithms of Leo Breiman and Adele Cutler (https://www.stat.berkeley.edu/~breiman/RandomForests/). This package must be installed in R before attempting to use the decision forestfunctionality.
Note:The term RandomForest is a registered trademark of Leo Breiman and Adele Cutler.
Currently only classification trees are supported, and only continuous input variables, that is categoricalinput variables are not supported. The exportToWps within PROC R will produce an error if an attemptis made to export a randomForest object that is not compatible with the DF_OPEN function.
DF_OPENThe function returns an ID that can be used with other decision forest functions and routines.
DF_OPEN ( filename )
Opens a decision forest file that was previously generated by the exportToWps function within PROCR. The exportToWps function takes a randomForest object produced by the randomForest R package(https://www.stat.berkeley.edu/~breiman/RandomForests/) and exports the parts necessary forperforming prediction. This consists of the definitions of all of the decision trees.
Return type: Numeric
filename
Type: Character
The decision forest file to open.
The function returns an opaque numeric ID. If the forest cannot be opened, then 0 is returned. Aspecific error code and error text can be retrieved using the SYSRC and SYSMSG functions.
Reference for language elementsVersion 3.3
511
DF_PREDICTProduces predictions from a decision forest.
DF_PREDICT ( df-id , { input-variable , … } )
For the prediction to be correct, input values must be passed in in the same order as was used duringtraining. The DF_VARNAMES call routine can be used to print this list of variables out.
For a classification tree, this returns the predicted class number, where 1 is the first class. The returnedclass will be the class that received the most votes after evaluating all of the trees in the forest.
For a regression tree, this returns the mean average of the outcome variable.
Return type: Numeric
df-id
Type: Numeric
The ID of a decision forest previously opened using DF_OPEN.
input-variable
Type: Numeric
A list of expressions giving the values of the input variables.
Reference for language elementsVersion 3.3
512
ExamplePROC R; SUBMIT; data(iris) rf = randomForest(iris[,-5], iris[,5], ntree=10) exportToWps(rf, "df.dat") ENDSUBMIT; import r=iris; PROC FORMAT; value species 1='setosa' 2='versicolor' 3='virginica'; DATA predict; SET iris; RETAIN df; IF _n_=1 THEN DO; df = DF_OPEN("df.dat"); END; prediction = DF_PREDICT(df, Sepal_Length, Sepal_Width, Petal_Length, Petal_Width); FORMAT prediction species.; KEEP prediction;RUN; PROC PRINT data=predict; RUN;
CALL DF_CLOSECloses a decision forest previously opened by DF_OPEN.
CALL DF_CLOSE ( df-id );
Note:It is not necessary to explicitly close decision forests in a DATA step, they are closed automaticallywhen the DATA step ends.
df-id
Type: Numeric
The ID of a decision forest previously opened using DF_OPEN.
Reference for language elementsVersion 3.3
513
CALL DF_DESCRIBEPrints information to the log about the specified decision forest.
CALL DF_DESCRIBE ( df-id );
df-id
Type: Numeric
The ID of a decision forest previously opened using DF_OPEN
Exampleproc r; submit; data(iris) rf = randomForest(iris[,-5], iris[,5], ntree=10) exportToWps(rf, "df.dat") endsubmit; data _null_; df = df_open("df.dat"); call df_describe(df); run;
Which produces the following output in the log:
NOTE: Decision tree description: Number of trees : 10 Number of output classes : 3 Input variables : Sepal.Length, Sepal.Width,Petal.Length, Petal.Width
CALL DF_PREDICTProduces predictions from a decision forest, returning multiple result values.
CALL DF_PREDICT ( df-id , option-string , { variable , … } );
As with the DF_PREDICT function the order of the input variables is very important to the accuracy ofthe output.
df-id
Type: Numeric
The ID of a decision forest previously opened using DF_OPEN
option-stringA character string controlling the form of the output. The contents of this string is only read once,so using a string literal is the most appropriate way to pass the value.
Reference for language elementsVersion 3.3
514
For a classification tree, the option string can take the following values. There values are mutuallyexclusive, and whichever is specified last is used.
"P"Returns the probabilities for each output class.
"V"Returns the number of votes cast for each output class.
variable
Type: Numeric
A list of expressions giving the values of the input variables and into which the results of theprediction will be returned.
ExamplePROC R; SUBMIT; data(iris) rf = randomForest(iris[,-5], iris[,5], ntree=10) exportToWps(rf, "df.dat") ENDSUBMIT; import r=iris;
DATA predict; SET iris; RETAIN df; IF _n_=1 THEN DO; df = df_open("df.dat"); CALL DF_DESCRIBE(df); END; CALL DF_PREDICT(df, 'V',Sepal_Length, Sepal_Width, Petal_Length, Petal_Width,votes_setosa, votes_versicolor, votes_virginica); KEEP votes:;RUN; PROC PRINT data=predict; RUN;
External file functions and call routines
DCLOSE
DCLOSE ( directory-id )
Return type: Numeric
Reference for language elementsVersion 3.3
515
directory-id
Type: Numeric
DCREATE
DCREATE ( directory-name [ , parent-directory ] )
Return type: Character
directory-name
Type: Character
parent-directoryOptional argument
Type: Character
DINFO
DINFO ( directory-id , property )
Return type: Character
directory-id
Type: Numeric
property
Type: Character
DNUM
DNUM ( directory-id )
Reference for language elementsVersion 3.3
516
Return type: Numeric
directory-id
Type: Numeric
DOPEN
DOPEN ( fileref )
Return type: Numeric
fileref
Type: Character
DOPTNAME
DOPTNAME ( directory-id , index )
Return type: Character
directory-id
Type: Numeric
index
Type: Numeric
DOPTNUM
DOPTNUM ( directory-id )
Return type: Numeric
Reference for language elementsVersion 3.3
517
directory-id
Type: Numeric
DREAD
DREAD ( directory-id , index )
Return type: Character
directory-id
Type: Numeric
index
Type: Numeric
DROPNOTE
DROPNOTE ( file-id , note-id )
Return type: Numeric
file-id
Type: Numeric
note-id
Type: Numeric
DSNCATLGD
DSNCATLGD ( dataset-name )
Return type: Numeric
Reference for language elementsVersion 3.3
518
dataset-name
Type: Character
FCLOSE
FCLOSE ( file-id )
Return type: Numeric
file-id
Type: Numeric
FCOL
FCOL ( file-id )
Return type: Numeric
file-id
Type: Numeric
FDELETE
FDELETE ( fileref-or-directory )
Return type: Numeric
fileref-or-directory
Type: Character
Reference for language elementsVersion 3.3
519
FEXIST
FEXIST ( fileref )
Return type: Numeric
fileref
Type: Character
FGET
FGET ( file-id , variable [ , ulength ] )
Return type: Numeric
file-id
Type: Numeric
variable
Type: Character
ulengthOptional argument
Type: Numeric
FILEEXIST
FILEEXIST ( physical-location )
Return type: Numeric
physical-location
Type: Character
Reference for language elementsVersion 3.3
520
FILENAME
FILENAME ( fileref , [ location ] , [ device-type ] [ , options ] )
Return type: Numeric
fileref
Type: Character
locationOptional argument
Type: Character
device-typeOptional argument
Type: Character
optionsOptional argument
Type: Character
FILEREF
FILEREF ( fileref )
Return type: Numeric
fileref
Type: Character
FINFO
FINFO ( file-id , property )
Return type: Character
Reference for language elementsVersion 3.3
521
file-id
Type: Numeric
property
Type: Character
FNOTE
FNOTE ( file-id )
Return type: Numeric
file-id
Type: Numeric
FOPEN
FOPEN ( fileref , [ open-mode ] , [ record-length ] [ , record-format ] )
Return type: Numeric
fileref
Type: Character
open-modeOptional argument
Type: Character
record-lengthOptional argument
Type: Numeric
record-formatOptional argument
Type: Character
Reference for language elementsVersion 3.3
522
FOPTNAME
FOPTNAME ( file-id , index )
Return type: Character
file-id
Type: Numeric
index
Type: Numeric
FOPTNUM
FOPTNUM ( file-id )
Return type: Numeric
file-id
Type: Numeric
FPOINT
FPOINT ( file-id , note-id )
Return type: Numeric
file-id
Type: Numeric
note-id
Type: Numeric
Reference for language elementsVersion 3.3
523
FPOS
FPOS ( file-id , position )
Return type: Numeric
file-id
Type: Numeric
position
Type: Numeric
FPUT
FPUT ( file-id , value )
Return type: Numeric
file-id
Type: Numeric
value
Type: Character
FREAD
FREAD ( file-id )
Return type: Numeric
file-id
Type: Numeric
Reference for language elementsVersion 3.3
524
FRECCNT
FRECCNT ( file-id )
Return type: Numeric
file-id
Type: Numeric
FREWIND
FREWIND ( file-id )
Return type: Numeric
file-id
Type: Numeric
FRLEN
FRLEN ( file-id )
Return type: Numeric
file-id
Type: Numeric
Reference for language elementsVersion 3.3
525
FSEP
FSEP ( file-id , characters [ , X ] )
Return type: Numeric
file-id
Type: Numeric
characters
Type: Character
XOptional argument
"X"
FWRITE
FWRITE ( file-id [ , cc ] )
Return type: Numeric
file-id
Type: Numeric
ccOptional argument
Type: Character
MOPEN
MOPEN ( directory-id , member , [ open-mode ] , [ record-length ] [ , record-format ] )
Return type: Numeric
Reference for language elementsVersion 3.3
526
directory-id
Type: Numeric
member
Type: Character
open-modeOptional argument
Type: Character
record-lengthOptional argument
Type: Numeric
record-formatOptional argument
Type: Character
PATHNAME
PATHNAME ( fileref-or-libref [ , type ] )
Return type: Character
fileref-or-libref
Type: Character
typeOptional argument
Type: Character
SYSMSG
SYSMSG ( )
Reference for language elementsVersion 3.3
527
Return type: Character
SYSRC
SYSRC ( )
Return type: Numeric
External routine functions and call routines
MODULEN
MODULEN ( option-string , function_identifier [ , { function_argument , … } ] )
MODULEN ( function_identifier [ , { function_argument , … } ] )
Return type: Numeric
option-string
Type: Character
function_identifier
Type: Character
function_argumentOptional argument
Type: Character or numeric value
MODULEC
MODULEC ( option-string , function_identifier [ , { function_argument , … } ] )
MODULEC ( function_identifier [ , { function_argument , … } ] )
Reference for language elementsVersion 3.3
528
Return type: Character
option-string
Type: Character
function_identifier
Type: Character
function_argumentOptional argument
Type: Character or numeric value
CALL MODULE
CALL MODULE ( option-string , function_identifier [ , { function_argument , … } ] );
CALL MODULE ( function_identifier [ , { function_argument , … } ] );
option-string
Type: Character
function_identifier
Type: Character
function_argumentOptional argument
Type: Character or numeric value
Financial functions and call routines
BLACKCLPRC
BLACKCLPRC ( exercise-price , time , future-price , rate , volatility )
Reference for language elementsVersion 3.3
529
Return type: Numeric
exercise-price
Type: Numeric
time
Type: Numeric
future-price
Type: Numeric
rate
Type: Numeric
volatility
Type: Numeric
BLACKPTPRC
BLACKPTPRC ( exercise-price , time , future-price , rate , volatility )
Return type: Numeric
exercise-price
Type: Numeric
time
Type: Numeric
future-price
Type: Numeric
rate
Type: Numeric
volatility
Type: Numeric
Reference for language elementsVersion 3.3
530
BLKSHCLPRC
BLKSHCLPRC ( exercise-price , time , share-price , rate , volatility )
Return type: Numeric
exercise-price
Type: Numeric
time
Type: Numeric
share-price
Type: Numeric
rate
Type: Numeric
volatility
Type: Numeric
BLKSHPTPRC
BLKSHPTPRC ( exercise-price , time , share-price , rate , volatility )
Return type: Numeric
exercise-price
Type: Numeric
time
Type: Numeric
share-price
Type: Numeric
Reference for language elementsVersion 3.3
531
rate
Type: Numeric
volatility
Type: Numeric
COMPOUND
COMPOUND ( p , f , i , n )
Return type: Numeric
p
Type: Numeric
f
Type: Numeric
i
Type: Numeric
n
Type: Numeric
CONVX
CONVX ( yield , freq , { cash-flow , … } )
Return type: Numeric
yield
Type: Numeric
freq
Type: Numeric
Reference for language elementsVersion 3.3
532
cash-flow
Type: Numeric
CONVXP
CONVXP ( par-value , rate , numeric , K , k0 , yield )
Return type: Numeric
par-value
Type: Numeric
rate
Type: Numeric
numeric
Type: Numeric
K
Type: Numeric
k0
Type: Numeric
yield
Type: Numeric
CUMIPMT
CUMIPMT ( rate , number-payments , present-value , [ start-period ] , [ final-period ] [ ,type ] )
Return type: Numeric
Reference for language elementsVersion 3.3
533
rate
Type: Numeric
number-payments
Type: Numeric
present-value
Type: Numeric
start-periodOptional argument
Type: Numeric
final-periodOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
CUMPRINC
CUMPRINC ( rate , number-payments , present-value , [ start-period ] , [ final-period ] [ ,type ] )
Return type: Numeric
rate
Type: Numeric
number-payments
Type: Numeric
present-value
Type: Numeric
Reference for language elementsVersion 3.3
534
start-periodOptional argument
Type: Numeric
final-periodOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
DACCDB
DACCDB ( period , balance , lifetime , rate )
Return type: Numeric
period
Type: Numeric
balance
Type: Numeric
lifetime
Type: Numeric
rate
Type: Numeric
DACCDBSL
DACCDBSL ( period , balance , lifetime , rate )
Return type: Numeric
Reference for language elementsVersion 3.3
535
period
Type: Numeric
balance
Type: Numeric
lifetime
Type: Numeric
rate
Type: Numeric
DACCSL
DACCSL ( period , balance , lifetime )
Return type: Numeric
period
Type: Numeric
balance
Type: Numeric
lifetime
Type: Numeric
DACCSYD
DACCSYD ( period , balance , lifetime )
Return type: Numeric
period
Type: Numeric
Reference for language elementsVersion 3.3
536
balance
Type: Numeric
lifetime
Type: Numeric
DACCTAB
DACCTAB ( period , balance , { rate , … } )
Return type: Numeric
period
Type: Numeric
balance
Type: Numeric
rate
Type: Numeric
DEPDB
DEPDB ( period , balance , lifetime , rate )
Return type: Numeric
period
Type: Numeric
balance
Type: Numeric
Reference for language elementsVersion 3.3
537
lifetime
Type: Numeric
rate
Type: Numeric
DEPDBSL
DEPDBSL ( period , balance , lifetime , rate )
Return type: Numeric
period
Type: Numeric
balance
Type: Numeric
lifetime
Type: Numeric
rate
Type: Numeric
DEPSL
DEPSL ( period , balance , lifetime )
Return type: Numeric
period
Type: Numeric
balance
Type: Numeric
Reference for language elementsVersion 3.3
538
lifetime
Type: Numeric
DEPSYD
DEPSYD ( period , balance , lifetime )
Return type: Numeric
period
Type: Numeric
balance
Type: Numeric
lifetime
Type: Numeric
DEPTAB
DEPTAB ( period , balance , { rate , … } )
Return type: Numeric
period
Type: Numeric
balance
Type: Numeric
rate
Type: Numeric
Reference for language elementsVersion 3.3
539
DUR
DUR ( yield , freq , { cash-flows , … } )
Return type: Numeric
yield
Type: Numeric
freq
Type: Numeric
cash-flows
Type: Numeric
DURP
DURP ( par-value , rate , numeric , K , k0 , yield )
Return type: Numeric
par-value
Type: Numeric
rate
Type: Numeric
numeric
Type: Numeric
K
Type: Numeric
k0
Type: Numeric
Reference for language elementsVersion 3.3
540
yield
Type: Numeric
EFFRATE
EFFRATE ( period , rate )
Return type: Numeric
period
"CONTINUOUS"
"DAY"
"SEMIMONTH"
"MONTH"
"QUARTER"
"SEMIYEAR"
"YEAR"
rate
Type: Numeric
FINANCEFINANCE functions
ACCRINT Calculation
FINANCE ( "ACCRINT" , issue , first_interest , settlement , rate , par , frequency [ , basis ])
Return type: Numeric
Reference for language elementsVersion 3.3
541
issue
Type: Numeric
first_interest
Type: Numeric
settlement
Type: Numeric
rate
Type: Numeric
par
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
ACCRINTM Calculation
FINANCE ( "ACCRINTM" , issue , settlement , rate , par [ , basis ] )
Return type: Numeric
issue
Type: Numeric
settlement
Type: Numeric
rate
Type: Numeric
Reference for language elementsVersion 3.3
542
par
Type: Numeric
basisOptional argument
Type: Numeric
AMORDEGRC Calculation
FINANCE ( "AMORDEGRC" , cost , date_purchased , first_period , salvage , period , rate [ ,basis ] )
Return type: Numeric
cost
Type: Numeric
date_purchased
Type: Numeric
first_period
Type: Numeric
salvage
Type: Numeric
period
Type: Numeric
rate
Type: Numeric
basisOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
543
AMORLINC Calculation
FINANCE ( "AMORLINC" , cost , date_purchased , first_period , salvage , period , rate [ ,basis ] )
Return type: Numeric
cost
Type: Numeric
date_purchased
Type: Numeric
first_period
Type: Numeric
salvage
Type: Numeric
period
Type: Numeric
rate
Type: Numeric
basisOptional argument
Type: Numeric
COUPDAYBS Calculation
FINANCE ( "COUPDAYBS" , settlement , maturity , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
Reference for language elementsVersion 3.3
544
maturity
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
COUPDAYS Calculation
FINANCE ( "COUPDAYS" , settlement , maturity , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
COUPDAYSNC Calculation
FINANCE ( "COUPDAYSNC" , settlement , maturity , frequency [ , basis ] )
Return type: Numeric
Reference for language elementsVersion 3.3
545
settlement
Type: Numeric
maturity
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
COUPNCD Calculation
FINANCE ( "COUPNCD" , settlement , maturity , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
COUPNUM Calculation
FINANCE ( "COUPNUM" , settlement , maturity , frequency [ , basis ] )
Reference for language elementsVersion 3.3
546
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
COUPPCD Calculation
FINANCE ( "COUPPCD" , settlement , maturity , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
547
CUMIPMT Calculation
FINANCE ( "CUMIPMT" , rate , nper , pv , start_period , end_period [ , type ] )
Return type: Numeric
rate
Type: Numeric
nper
Type: Numeric
pv
Type: Numeric
start_period
Type: Numeric
end_period
Type: Numeric
typeOptional argument
Type: Numeric
CUMPRINC Calculation
FINANCE ( "CUMPRINC" , rate , nper , pv , start_period , end_period [ , type ] )
Return type: Numeric
rate
Type: Numeric
nper
Type: Numeric
Reference for language elementsVersion 3.3
548
pv
Type: Numeric
start_period
Type: Numeric
end_period
Type: Numeric
typeOptional argument
Type: Numeric
DB Calculation
FINANCE ( "DB" , cost , salvage , life , period [ , month ] )
Return type: Numeric
cost
Type: Numeric
salvage
Type: Numeric
life
Type: Numeric
period
Type: Numeric
monthOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
549
DDB Calculation
FINANCE ( "DDB" , cost , salvage , life , period [ , factor ] )
Return type: Numeric
cost
Type: Numeric
salvage
Type: Numeric
life
Type: Numeric
period
Type: Numeric
factorOptional argument
Type: Numeric
DISC Calculation
FINANCE ( "DISC" , settlement , maturity , pr , redemption [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
pr
Type: Numeric
Reference for language elementsVersion 3.3
550
redemption
Type: Numeric
basisOptional argument
Type: Numeric
DOLLARDE Calculation
FINANCE ( "DOLLARDE" , fractional_dollar , fraction )
Return type: Numeric
fractional_dollar
Type: Numeric
fraction
Type: Numeric
DOLLARFR Calculation
FINANCE ( "DOLLARFR" , decimal_dollar , fraction )
Return type: Numeric
decimal_dollar
Type: Numeric
fraction
Type: Numeric
Reference for language elementsVersion 3.3
551
DURATION Calculation
FINANCE ( "DURATION" , settlement , maturity , coupon , yld , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
coupon
Type: Numeric
yld
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
EFFECT Calculation
FINANCE ( "EFFECT" , nominal_rate , npery )
Return type: Numeric
nominal_rate
Type: Numeric
npery
Type: Numeric
Reference for language elementsVersion 3.3
552
FV Calculation
FINANCE ( "FV" , rate , nper , [ pmt ] , [ pv ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
nper
Type: Numeric
pmtOptional argument
Type: Numeric
pvOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
FVSCHEDULE Calculation
FINANCE ( "FVSCHEDULE" , principal , { schedule-n , … } )
Return type: Numeric
principal
Type: Numeric
schedule-n
Type: Numeric
Reference for language elementsVersion 3.3
553
INTRATE Calculation
FINANCE ( "INTRATE" , settlement , maturity , investment , redemption [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
investment
Type: Numeric
redemption
Type: Numeric
basisOptional argument
Type: Numeric
IPMT Calculation
FINANCE ( "IPMT" , rate , period , nper , pv , [ fv ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
period
Type: Numeric
nper
Type: Numeric
Reference for language elementsVersion 3.3
554
pv
Type: Numeric
fvOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
IRR Calculation
FINANCE ( "IRR" , { value , … } )
Return type: Numeric
value
Type: Numeric
MDURATION Calculation
FINANCE ( "MDURATION" , settlement , maturity , coupon , yld , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
coupon
Type: Numeric
Reference for language elementsVersion 3.3
555
yld
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
MIRR Calculation
FINANCE ( "MIRR" , { value-n , … } )
Return type: Numeric
value-n
Type: Numeric
NOMINAL Calculation
FINANCE ( "NOMINAL" , effect_rate , npery )
Return type: Numeric
effect_rate
Type: Numeric
npery
Type: Numeric
Reference for language elementsVersion 3.3
556
NPER Calculation
FINANCE ( "NPER" , rate , pmt , pv , [ fv ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
pmt
Type: Numeric
pv
Type: Numeric
fvOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
NPV Calculation
FINANCE ( "NPV" , rate , { value , … } )
Return type: Numeric
rate
Type: Numeric
value
Type: Numeric
Reference for language elementsVersion 3.3
557
ODDFPRICE Calculation
FINANCE ( "ODDFPRICE" , settlement , maturity , issue , first_coupon , rate , yld ,redemption , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
issue
Type: Numeric
first_coupon
Type: Numeric
rate
Type: Numeric
yld
Type: Numeric
redemption
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
558
ODDFYIELD Calculation
FINANCE ( "ODDFYIELD" , settlement , maturity , issue , first_coupon , rate , pr ,redemption , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
issue
Type: Numeric
first_coupon
Type: Numeric
rate
Type: Numeric
pr
Type: Numeric
redemption
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
559
ODDLPRICE Calculation
FINANCE ( "ODDLPRICE" , settlement , maturity , last_interest , rate , yld , redemption ,frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
last_interest
Type: Numeric
rate
Type: Numeric
yld
Type: Numeric
redemption
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
ODDLYIELD Calculation
FINANCE ( "ODDLYIELD" , settlement , maturity , last_interest , rate , pr , redemption ,frequency [ , basis ] )
Reference for language elementsVersion 3.3
560
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
last_interest
Type: Numeric
rate
Type: Numeric
pr
Type: Numeric
redemption
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
PMT Calculation
FINANCE ( "PMT" , rate , nper , pv , [ fv ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
nper
Type: Numeric
Reference for language elementsVersion 3.3
561
pv
Type: Numeric
fvOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
PPMT Calculation
FINANCE ( "PPMT" , rate , per , nper , pv , [ fv ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
per
Type: Numeric
nper
Type: Numeric
pv
Type: Numeric
fvOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
562
PRICE Calculation
FINANCE ( "PRICE" , settlement , maturity , rate , yld , redemption , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
rate
Type: Numeric
yld
Type: Numeric
redemption
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
PRICEDISC Calculation
FINANCE ( "PRICEDISC" , settlement , maturity , discount , redemption [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
Reference for language elementsVersion 3.3
563
maturity
Type: Numeric
discount
Type: Numeric
redemption
Type: Numeric
basisOptional argument
Type: Numeric
PRICEMAT Calculation
FINANCE ( "PRICEMAT" , settlement , maturity , issue , rate , yld [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
issue
Type: Numeric
rate
Type: Numeric
yld
Type: Numeric
basisOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
564
PV Calculation
FINANCE ( "PV" , rate , nper , pmt , [ fv ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
nper
Type: Numeric
pmt
Type: Numeric
fvOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
RATE Calculation
FINANCE ( "RATE" , nper , pmt , pv , [ fv ] [ , type ] )
Return type: Numeric
nper
Type: Numeric
pmt
Type: Numeric
pv
Type: Numeric
Reference for language elementsVersion 3.3
565
fvOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
RECEIVED Calculation
FINANCE ( "RECEIVED" , settlement , maturity , investment , discount [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
investment
Type: Numeric
discount
Type: Numeric
basisOptional argument
Type: Numeric
SLN Calculation
FINANCE ( "SLN" , cost , salvage , life )
Return type: Numeric
Reference for language elementsVersion 3.3
566
cost
Type: Numeric
salvage
Type: Numeric
life
Type: Numeric
SYD Calculation
FINANCE ( "SYD" , cost , salvage , life , period )
Return type: Numeric
cost
Type: Numeric
salvage
Type: Numeric
life
Type: Numeric
period
Type: Numeric
TBILLEQ Calculation
FINANCE ( "TBILLEQ" , settlement , maturity , discount )
Return type: Numeric
settlement
Type: Numeric
Reference for language elementsVersion 3.3
567
maturity
Type: Numeric
discount
Type: Numeric
TBILLPRICE Calculation
FINANCE ( "TBILLPRICE" , settlement , maturity , discount )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
discount
Type: Numeric
TBILLYIELD Calculation
FINANCE ( "TBILLYIELD" , settlement , maturity , pr )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
Reference for language elementsVersion 3.3
568
pr
Type: Numeric
VDB Calculation
FINANCE ( "VDB" , cost , salvage , life , start_period , end_period , [ factor ] [ ,no_switch ] )
Return type: Numeric
cost
Type: Numeric
salvage
Type: Numeric
life
Type: Numeric
start_period
Type: Numeric
end_period
Type: Numeric
factorOptional argument
Type: Numeric
no_switchOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
569
XIRR Calculation
FINANCE ( "XIRR" , { argument-n , … } )
Return type: Numeric
argument-n
Type: Numeric
XNPV Calculation
FINANCE ( "XNPV" , rate , { argument-n , … } )
Return type: Numeric
rate
Type: Numeric
argument-n
Type: Numeric
YIELD Calculation
FINANCE ( "YIELD" , settlement , maturity , rate , pr , redemption , frequency [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
Reference for language elementsVersion 3.3
570
rate
Type: Numeric
pr
Type: Numeric
redemption
Type: Numeric
frequency
Type: Numeric
basisOptional argument
Type: Numeric
YIELDDISC Calculation
FINANCE ( "YIELDDISC" , settlement , maturity , rate , pr , redemption [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
rate
Type: Numeric
pr
Type: Numeric
redemption
Type: Numeric
Reference for language elementsVersion 3.3
571
basisOptional argument
Type: Numeric
YIELDMAT Calculation
FINANCE ( "YIELDMAT" , settlement , maturity , issue , rate , pr [ , basis ] )
Return type: Numeric
settlement
Type: Numeric
maturity
Type: Numeric
issue
Type: Numeric
rate
Type: Numeric
pr
Type: Numeric
basisOptional argument
Type: Numeric
GARKHCLPRC
GARKHCLPRC ( exercise-price , time , spot-price , rate-domestic , rate-foreign , volatility )
Return type: Numeric
Reference for language elementsVersion 3.3
572
exercise-price
Type: Numeric
time
Type: Numeric
spot-price
Type: Numeric
rate-domestic
Type: Numeric
rate-foreign
Type: Numeric
volatility
Type: Numeric
GARKHPTPRC
GARKHPTPRC ( exercise-price , time , spot-price , rate-domestic , rate-foreign , volatility )
Return type: Numeric
exercise-price
Type: Numeric
time
Type: Numeric
spot-price
Type: Numeric
rate-domestic
Type: Numeric
Reference for language elementsVersion 3.3
573
rate-foreign
Type: Numeric
volatility
Type: Numeric
INTRR
INTRR ( freq , { cash-flow-n , … } )
Return type: Numeric
freq
Type: Numeric
cash-flow-n
Type: Numeric
IPMT
IPMT ( rate , period , number-payments , present-value , [ future-value ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
period
Type: Numeric
number-payments
Type: Numeric
present-value
Type: Numeric
Reference for language elementsVersion 3.3
574
future-valueOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
IRR
IRR ( freq , { cash-flow-n , … } )
Return type: Numeric
freq
Type: Numeric
cash-flow-n
Type: Numeric
MARGRCLPRC
MARGRCLPRC ( s1 , time , s2 , sigma1 , sigma2 , rho )
Return type: Numeric
s1
Type: Numeric
time
Type: Numeric
s2
Type: Numeric
Reference for language elementsVersion 3.3
575
sigma1
Type: Numeric
sigma2
Type: Numeric
rho
Type: Numeric
MARGRPTPRC
MARGRPTPRC ( s1 , time , s2 , sigma1 , sigma2 , rho )
Return type: Numeric
s1
Type: Numeric
time
Type: Numeric
s2
Type: Numeric
sigma1
Type: Numeric
sigma2
Type: Numeric
rho
Type: Numeric
Reference for language elementsVersion 3.3
576
MORT
MORT ( p , a , i , n )
Return type: Numeric
p
Type: Numeric
a
Type: Numeric
i
Type: Numeric
n
Type: Numeric
NETPV
NETPV ( rate , freq , c0 , { c-n , … } )
Return type: Numeric
rate
Type: Numeric
freq
Type: Numeric
c0
Type: Numeric
c-n
Type: Numeric
Reference for language elementsVersion 3.3
577
NOMRATE
NOMRATE ( period , rate )
Return type: Numeric
period
"CONTINUOUS"
"DAY"
"SEMIMONTH"
"MONTH"
"QUARTER"
"SEMIYEAR"
"YEAR"
rate
Type: Numeric
NPV
NPV ( rate , freq , c0 , { c-n , … } )
Return type: Numeric
rate
Type: Numeric
freq
Type: Numeric
c0
Type: Numeric
c-n
Type: Numeric
Reference for language elementsVersion 3.3
578
PMT
PMT ( rate , period , present-value , [ furture-value ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
period
Type: Numeric
present-value
Type: Numeric
furture-valueOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
PPMT
PPMT ( rate , period , number-payments , present-value , [ future-value ] [ , type ] )
Return type: Numeric
rate
Type: Numeric
period
Type: Numeric
Reference for language elementsVersion 3.3
579
number-payments
Type: Numeric
present-value
Type: Numeric
future-valueOptional argument
Type: Numeric
typeOptional argument
Type: Numeric
PVP
PVP ( par-value , rate , numeric , K , k0 , yield )
Return type: Numeric
par-value
Type: Numeric
rate
Type: Numeric
numeric
Type: Numeric
K
Type: Numeric
k0
Type: Numeric
yield
Type: Numeric
Reference for language elementsVersion 3.3
580
SAVING
SAVING ( value , payment , rate , term )
Return type: Numeric
value
Type: Numeric
payment
Type: Numeric
rate
Type: Numeric
term
Type: Numeric
SAVINGS
SAVINGS ( base_date , initial_deposit_date , deposit_amount , deposit_number ,deposit_interval , compounding_interval , date-1 , rate-1 [ , { date-or-rate-n , … } ] )
Return type: Numeric
base_date
Type: Numeric
initial_deposit_date
Type: Numeric
deposit_amount
Type: Numeric
deposit_number
Type: Numeric
Reference for language elementsVersion 3.3
581
deposit_interval
Type: Character
compounding_interval
Type: Character
date-1
Type: Numeric
rate-1
Type: Numeric
date-or-rate-nOptional argument
Type: Numeric
TIMEVALUE
TIMEVALUE ( base_date , reference_date , reference_amount , compounding_interval , date-1, rate-1 [ , { date-or-rate-n , … } ] )
Return type: Numeric
base_date
Type: Numeric
reference_date
Type: Numeric
reference_amount
Type: Numeric
compounding_interval
Type: Character
date-1
Type: Numeric
Reference for language elementsVersion 3.3
582
rate-1
Type: Numeric
date-or-rate-nOptional argument
Type: Numeric
YIELDP
YIELDP ( par-value , coupon-rate , numeric , K , k0 , price )
Return type: Numeric
par-value
Type: Numeric
coupon-rate
Type: Numeric
numeric
Type: Numeric
K
Type: Numeric
k0
Type: Numeric
price
Type: Numeric
Reference for language elementsVersion 3.3
583
Internet functions and call routines
APPSRVGETC
APPSRVGETC ( option-name )
Return type: Character
option-name
Type: Character
APPSRVGETN
APPSRVGETN ( option-name )
Return type: Numeric
option-name
Type: Character
APPSRV_AUTHCLS
APPSRV_AUTHCLS ( type )
Return type: Character
type
Type: Character
Reference for language elementsVersion 3.3
584
APPSRV_AUTHDS
APPSRV_AUTHDS ( dataset )
Return type: Numeric
dataset
Type: Character
APPSRV_AUTHLIB
APPSRV_AUTHLIB ( [ libname ] , [ memname ] , [ memtype ] , [ objname ] [ , objtype ] )
Return type: Numeric
libnameOptional argument
Type: Character
memnameOptional argument
Type: Character
memtypeOptional argument
Type: Character
objnameOptional argument
Type: Character
objtypeOptional argument
Type: Character
Reference for language elementsVersion 3.3
585
APPSRV_HEADER
APPSRV_HEADER ( name , value )
Return type: Character
name
Type: Character
value
Type: Character
APPSRV_SESSION
CREATE Command
APPSRV_SESSION ( "create" [ , session-timeout ] )
Return type: Numeric
session-timeoutOptional argument
Type: Numeric
DELETE Command
APPSRV_SESSION ( "delete" )
Return type: Numeric
Reference for language elementsVersion 3.3
586
APPSRV_SET
[ APPSRV_SET | APPSRVSET ] ( name [ , value ] )
Return type: Numeric
name
Type: Character
valueOptional argument
Type: Numeric
APPSRV_UNSAFE
APPSRV_UNSAFE ( paramname )
Return type: Character
paramname
Type: Character
ISPF call routines
CALL ISPEXEC
CALL ISPEXEC ( buflen [ , buffer ] );
buflen
Type: Character or numeric value
bufferOptional argument
Reference for language elementsVersion 3.3
587
Type: Character
CALL ISPLINK
CALL ISPLINK ( service-name [ , { argument , … } ] );
service-name
Type: Character
argumentOptional argument
Type: Character or numeric value
Macro functions and call routines
SYMEXIST
SYMEXIST ( symbol-name )
Return type: Numeric
symbol-name
Type: Character
SYMGET
SYMGET ( symbol-name )
Return type: Character
Reference for language elementsVersion 3.3
588
symbol-name
Type: Character
SYMGETN
SYMGETN ( macro-variable )
Return type: Numeric
macro-variable
Type: Character
SYMGLOBL
SYMGLOBL ( symbol-name )
Return type: Numeric
symbol-name
Type: Character
SYMLOCAL
SYMLOCAL ( symbol-name )
Return type: Numeric
symbol-name
Type: Character
Reference for language elementsVersion 3.3
589
CALL SYMDEL
CALL SYMDEL ( macro-variable [ , type ] );
macro-variable
Type: Character
typeOptional argument
"NOWARN"
CALL SYMPUT
CALL SYMPUT ( argument1 , argument2 );
argument1
Type: Character
argument2
Type: Character
CALL SYMPUTX
CALL SYMPUTX ( variable-name , value [ , type ] );
variable-name
Type: Character
value
Type: Character or numeric value
typeOptional argument
Reference for language elementsVersion 3.3
590
"G"
"F"
"L"
Mathematical functions and call routines
Constant functionsFunctions that define various mathematical constants.
Mathematical constantsE Constant e≈2.718281828459 Returns the mathematical constant e.
EULER Constant γ≈0.577215664902 Returns the Euler constant γ.
PI Constant π≈3.141592653690 Returns the mathematical constant π.
Numerical limitsBIG Constant Returns the largest number available on the current computer
platform.LOGBIG Constant Returns a logarithm of the largest number available on the current
computer platform.SQRTBIG Constant Returns the square root of the largest number available on the
current computer platform.MACEPS Constant Returns the smallest floating increment value available on the
current computer platform.LOGMACEPS Constant Returns a logarithm of the smallest floating increment value
available on the current computer platform.SQRTMACEPS Constant Returns the square root of the smallest floating increment value
available on the current computer platform.SMALL Constant Returns the smallest positive number available on the current
computer platform.LOGSMALL Constant Returns a logarithm of the smallest positive number available on the
current computer platform.SQRTSMALL Constant Returns the square root of the smallest positive number available on
the current computer platform.EXACTINT Constant Returns a platform-specific integer value for a given number of
bytes.
Reference for language elementsVersion 3.3
591
E Constant
Returns the mathematical constant e.
CONSTANT ( "E" )
This function is defined by a constant expression and does not take any variable arguments.
Return type: Numeric
The return value is: e≈2.718281828459.
EULER Constant
Returns the Euler constant γ.
CONSTANT ( "EULER" )
This function is defined by a constant expression and does not take any variable arguments.
Return type: Numeric
The return value is: γ≈0.577215664902.
PI Constant
Returns the mathematical constant π.
CONSTANT ( "PI" )
This function is defined by a constant expression and does not take any variable arguments.
Return type: Numeric
The return value is: π≈3.141592653690.
BIG Constant
Returns the largest number available on the current computer platform.
CONSTANT ( "BIG" )
This function is defined by a constant expression and does not take any variable arguments.
Return type: Numeric
Reference for language elementsVersion 3.3
592
ExampleOn a Windows 64-bit computer, the largest number returned is 1.797693⋅10308.
LOGBIG Constant
Returns a logarithm of the largest number available on the current computer platform.
CONSTANT ( "LOGBIG" [ , base ] )
This function is defined for numeric values only, greater than one. It takes one argument.
This function determines the largest number available on the current computer platform (see alsosection BIG Constant), and returns its logarithm with the specified base. If the base is omitted, thenatural logarithm is returned.
Return type: Numeric
The return value is greater than one.
If the argument contains a missing value, a missing value is returned.
baseOptional argument
Type: Numeric
The base of the logarithm.
Restriction: base > 1
Default: base = e
If the argument is out of range or contains a missing value, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = constant("logbig","4"); g2 = constant("logbig","four"); g3 = constant("logbig",1.0000003); g4 = constant("logbig",1e308); g5 = constant("logbig",constant("big"));run;
g1 = 512g2 = .g3 = 2365942731.6g4 = 1.0008269986g5 = 1
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
These examples are for a Windows 64-bit computer. Notice the rounding of the return value in the lastexample.
Reference for language elementsVersion 3.3
593
Note:Other platforms may have different boundary values as determined by their architecture.
data example; m1 = constant("logbig",-1); m2 = constant("logbig", 1);run;
The above examples return a missing value because the argument is out of range.
SQRTBIG Constant
Returns the square root of the largest number available on the current computer platform.
CONSTANT ( "SQRTBIG" )
This function is defined by a constant expression and does not take any variable arguments.
See also section BIG Constant.
Return type: Numeric
ExampleOn a Windows 64-bit computer, it returns 1.340781⋅10154.
MACEPS Constant
Returns the smallest floating increment value available on the current computer platform.
CONSTANT ( "MACEPS" )
This function is defined by a constant expression and does not take any variable arguments.
The smallest floating increment value, also known as the machine epsilon, is the difference between 1.0and the next floating point number representable on the current computer platform.
Return type: Numeric
ExampleOn a Windows 64-bit computer, the machine epsilon returned is 2.220446⋅10-16.
Reference for language elementsVersion 3.3
594
LOGMACEPS Constant
Returns a logarithm of the smallest floating increment value available on the current computer platform.
CONSTANT ( "LOGMACEPS" [ , base ] )
This function is defined for numeric values only, greater than one. It takes one argument.
This function determines the smallest floating increment value available on the current computerplatform (see also section MACEPS Constant), and returns its logarithm with the specified base. If thebase is omitted, the natural logarithm is returned.
Return type: Numeric
The return value is negative.
If the argument contains a missing value, a missing value is returned.
baseOptional argument
Type: Numeric
The base of the logarithm.
Restriction: base > 1
Default: base = e
If the argument is out of range or contains a missing value, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = constant("logmaceps","4"); g2 = constant("logmaceps","four"); g3 = constant("logmaceps",1.0000003); g4 = constant("logmaceps",constant("big"));run;
g1 = -26g2 = .g3 = -120145529.3g4 = -0.05078125
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
These examples are for a Windows 64-bit computer.
data example; m1 = constant("logmaceps",-1); m2 = constant("logmaceps", 1);run;
The above examples return a missing value because the argument is out of range.
Reference for language elementsVersion 3.3
595
SQRTMACEPS Constant
Returns the square root of the smallest floating increment value available on the current computerplatform.
CONSTANT ( "SQRTMACEPS" )
This function is defined by a constant expression and does not take any variable arguments.
See also section MACEPS Constant.
Return type: Numeric
ExampleOn a Windows 64-bit computer, it returns 1.4901161⋅10-8.
SMALL Constant
Returns the smallest positive number available on the current computer platform.
CONSTANT ( "SMALL" )
This function is defined by a constant expression and does not take any variable arguments.
Return type: Numeric
ExampleOn a Windows 64-bit computer, it returns 2.22507⋅10-308.
LOGSMALL Constant
Returns a logarithm of the smallest positive number available on the current computer platform.
CONSTANT ( "LOGSMALL" [ , base ] )
This function is defined for numeric values only, greater than one. It takes one argument.
This function determines the smallest positive number available on the current computer platform (seealso section SMALL Constant), and returns its logarithm with the specified base. If the base is omitted,the natural logarithm is returned.
Return type: Numeric
The return value is negative.
Reference for language elementsVersion 3.3
596
If the argument contains a missing value, a missing value is returned.
baseOptional argument
Type: Numeric
The base of the logarithm.
Restriction: base > 1
Default: base = e
If the argument is out of range or contains a missing value, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = constant("logmaceps","4"); g2 = constant("logmaceps","four"); g3 = constant("logmaceps",1.0000003); g4 = constant("logmaceps",constant("big"));run;
g1 = -511g2 = .g3 = -2361321750g4 = -0.998046875
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
These examples are for a Windows 64-bit computer.
data example; m1 = constant("logmaceps",-1); m2 = constant("logmaceps", 1);run;
The above examples return a missing value because the argument is out of range.
SQRTSMALL Constant
Returns the square root of the smallest positive number available on the current computer platform.
CONSTANT ( "SQRTSMALL" )
This function is defined by a constant expression and does not take any variable arguments.
See also section SMALL Constant.
Return type: Numeric
Reference for language elementsVersion 3.3
597
ExampleOn a Windows 64-bit computer, it returns 1.49167⋅10-154.
EXACTINT Constant
Returns a platform-specific integer value for a given number of bytes.
CONSTANT ( "EXACTINT" [ , num-bytes ] )
This function is defined for numeric values only and takes one argument which is expected to be aninteger between 2 and 8, inclusive.
Note:The argument value is rounded down to the nearest integer which must fall within the [2,8] interval. Theresulting integer is then used for computation.
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
num-bytesOptional argument
Type: Numeric
The length of the integer in bytes.
Restriction: 2 ≤ num-bytes ≤ 8
Default: num-bytes = 8
If the argument is out of range or contains a missing value, a missing value is returned.
ExampleConsider the following code and its output:
data example; s1 = constant("exactint","4"); s2 = constant("exactint","four"); s3 = constant("exactint",0);run;
s1 = 2097152s2 = .s3 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
The third example returns a missing value because the argument is out of range.
Reference for language elementsVersion 3.3
598
Arithmetic functionsFunctions that perform arithmetic operations on the data.
ABS Returns the absolute value of a numeric argument.SIGN Identifies the sign of a numeric argument.MODZ Returns the modulo of two numeric arguments.MOD Returns the modulo of two numeric arguments corrected for rounding errors.DIVIDE Returns the ratio of two numeric arguments.GCD Returns the greatest common divisor for a list of numeric values.LCM Returns the least common multiple of a list of numeric values.
ABS
Returns the absolute value of a numeric argument.
ABS ( x )
This function is defined for numeric values only and takes one argument. It returns the absolute value ofthe argument.
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; a1 = abs(-2); a2 = abs("4"); a3 = abs("four");run;
a1 = 2a2 = 4a3 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Reference for language elementsVersion 3.3
599
SIGN
Identifies the sign of a numeric argument.
SIGN ( x )
This function is defined for numeric values only and takes one argument. It returns one of the following:
• If the argument is zero, zero is returned.• If the argument is positive, 1 is returned.• If the argument is negative, -1 is returned.
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; s1 = sign(0); s2 = sign(-2); s3 = sign("4"); s4 = sign("four");run;
s1 = 0s2 = -1s3 = 1s4 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
MODZ
Returns the modulo of two numeric arguments.
MODZ ( dividend , divisor )
This function is defined for numeric values only and takes two arguments. It returns the remainder afterdivision of the first argument (the dividend) by the second (the divisor). The sign of the result is thesame as the sign of the dividend.
Return type: Numeric
If any of the arguments contains a missing value, a missing value is returned.
Reference for language elementsVersion 3.3
600
dividend
Type: Numeric
The dividend of the fraction.
divisor
Type: Numeric
The divisor of the fraction.
Restriction: divisor ≠ 0
If the divisor is zero, a missing value is returned.
ExampleConsider the following code and its output:
data example; m1 = modz( 4 , 2.2); m2 = modz("4", 2.2); m3 = modz("four",2.2);run;
m1 = 1.8m2 = 1.8m3 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m4 = modz(-4 , 2.2); m5 = modz( 4 ,-2.2);run;
m4 = -1.8m5 = 1.8
Note that the result takes on the sign of the dividend regardless of the sign of the divisor.
MOD
Returns the modulo of two numeric arguments corrected for rounding errors.
MOD ( dividend , divisor )
This function is defined for numeric values only and takes two arguments. It returns the remainder afterdivision of the first argument (the dividend) by the second (the divisor). The sign of the result is thesame as the sign of the dividend.
This basic computation is the same as in MODZ function (see section MODZ), but the result is checkedfor rounding errors and corrected as follows:
• If the result is nearing zero or the dividor by less than 10-12, zero is returned.
Reference for language elementsVersion 3.3
601
• If the fractional part of the result is nearing 1 by less than 10-12, the result is rounded up to thenearest integer value.
• If the fractional part of the result is nearing 0 by less than 10-12, the result is rounded down to thenearest integer value.
Return type: Numeric
If any of the arguments contains a missing value, a missing value is returned.
dividend
Type: Numeric
The dividend of the fraction.
divisor
Type: Numeric
The divisor of the fraction.
Restriction: divisor ≠ 0
If the divisor is zero, a missing value is returned.
ExampleConsider the following code and its output:
data example; mz = modz(4.00000000000001,2); m = mod (4.00000000000001,2);run;
mz = 9.769963⋅10-15
m = 0
Function MODZ returns an uncorrected modulo result that is very close to zero. Function MOD corrects itand returns zero instead.
DIVIDE
Returns the ratio of two numeric arguments.
DIVIDE ( dividend , divisor )
This function is defined for numeric values only and takes two arguments. It returns the result of divisionof the first argument (the dividend) by the second (the divisor).
Return type: Numeric
dividend
Type: Numeric
Reference for language elementsVersion 3.3
602
The dividend of the fraction.
divisor
Type: Numeric
The divisor of the fraction.
Restriction: divisor ≠ 0
If the divisor is zero, a missing value is returned.
This function implements platform-dependent overflow and underflow tests before attemptingcomputation:
• If the dividend underflows or the divisor overflows, zero is returned.• If the divisor underflows, positive or negative infinity is returned where the sign is determined
according to the standard rules of arithmetic.
Missing values and division by zero are processed as shown in the table below. The following missingvalue notations are recognised by the DIVIDE function:
._ : blank
.I : positive infinity
.M : negative infinity
All other missing value notations are treated as a default missing value.
Dividend Divisor Result
._ any ._
non-missing non-zero .I or .M 0
.I or .M .I or .M .
.I negative .M
.I non-negative .I
.M negative .I
.M non-negative .M
0 0 .
0 non-zero 0
positive 0 .I
negative 0 .M
other missing any dividend
any other missing divisor
Reference for language elementsVersion 3.3
603
ExampleConsider the following code and its output:
data example; d1 = divide( 4 ,1.25); d2 = divide("4" ,1.25); d3 = divide("four",1.25); d4 = divide(-4, 0); d5 = divide(.I, 2); d6 = divide( 2,.I); d7 = divide(.I,.M); d8 = divide(.I,._); d9 = divide(.M,.Z); d10 = divide(.A, 2);run;
d1 = 3.2d2 = 3.2d3 = .d4 = .Md5 = .I
d6 = 0d7 = .d8 = ._d9 = .Zd10 = .A
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
GCD
Returns the greatest common divisor for a list of numeric values.
GCD ( v1 , { value , … } )
This function is defined for integer values only, at least two values are required.
Return type: Numeric
The return value is a positive integer or zero.
If an overflow occurs as a result of the operation, or if any of the arguments contains a missing value ora non-integer, a missing value is returned.
v1
Type: Numeric
The first value in the list.
Restriction: the argument must be integer
If the argument is not an integer, a missing value is returned.
value
Type: Numeric
Further value(s) to be evaluated.
Restriction: the argument must be integer
If one of the values is not an integer, a missing value is returned.
Reference for language elementsVersion 3.3
604
ExampleConsider the following code and its output:
data example; g1 = gcd("4",2,8); g2 = gcd("four",2,8); g3 = gcd(3.3,2,5); g4 = gcd(-4,-8,-24); g5 = gcd(18,0);run;
g1 = 2g2 = .g3 = .g4 = 4g5 = 18
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. The third example returns a missing value because it has a non-integer argument.
Notice that the GCD is always positive, even when all arguments are negative, as in the fourth example.If one of the arguments is zero, it does not contribute to the calculation, as is shown in the fifth example.
LCM
Returns the least common multiple of a list of numeric values.
LCM ( v1 , { value , … } )
This function is defined for non-zero integer values only, at least two values are required.
The least common multiple of a list of numeric values is the smallest positive integer that is divisible byeach of the values in the argument list.
Return type: Numeric
The return value is a positive integer.
If an overflow occurs as a result of the operation, or if any of the arguments contains a missing value,zero or a non-integer, a missing value is returned.
v1
Type: Numeric
The first value in the list.
Restriction: the argument must be a non-zero integer
If the argument is not an integer or equals zero, a missing value is returned.
value
Type: Numeric
Further value(s) to be evaluated.
Restriction: the argument must be a non-zero integer
If one of the values is not an integer or equals zero, a missing value is returned.
Reference for language elementsVersion 3.3
605
ExampleConsider the following code and its output:
data example; g1 = lcm("4",2,8); g2 = lcm("four",2,8); g3 = lcm(3.3,2,5); g4 = lcm(-4,-8,-24);run;
g1 = 8g2 = .g3 = .g4 = 24
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. The third example returns a missing value because it has a non-integer argument.
Notice that the LCM is always positive, even when all arguments are negative, as in the fourth example.
Power and exponent functionsFunctions that perform exponential operations on the data.
SQRT Returns the square root of a numeric argument.
EXP exp(x) = ex Returns the exponential of a numeric argument.
POW xy Returns the power function of two numeric arguments.
CALL LOGISTIC (e−x + 1)−1 Calculates the standard logistic function for each numericvariable in a list.
SQRT
Returns the square root of a numeric argument.
SQRT ( x )
This function is defined for non-negative numeric valuesonly and takes one argument. It returns the square root ofthe argument:
sqrt(x) =
1
2
30 1 2 4x
x
Return type: Numeric
The return value is greater or equal zero.
If the argument contains a missing value, a missing value is returned.
Reference for language elementsVersion 3.3
606
x
Type: Numeric
The argument of the function.
Restriction: x ≥ 0
If the argument is negative, a missing value is returned.
ExampleConsider the following code and its output:
data example; s1 = sqrt(0); s2 = sqrt("4"); s3 = sqrt("four");run;
s1 = 0s2 = 2s3 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
EXP
Returns the exponential of a numeric argument.
EXP ( x )
This function is defined for numeric values only andtakes one argument. It raises the mathematical constante≈2.718281828459 to the power of the argument:
exp(x) = ex
1
2
3
4
- 2 - 1 0 1
x
ex
Return type: Numeric
The return value is greater than zero.
If the argument contains a missing value or if an overflow occurs as a result of the operation, a missingvalue is returned.
x
Type: Numeric
Reference for language elementsVersion 3.3
607
The argument of the function.
ExampleConsider the following code and its output:
data example; p1 = exp(0); p2 = exp("4"); p3 = exp("four");run;
p1 = 1p2 = 54.598150033p3 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
POW
Returns the power function of two numeric arguments.
POW ( base , exponent )
This function is defined for numeric values only and takes two arguments. It raises the first argument(the base) to the power of the second (the exponent):
pow (x, y) = xy
where x is the base and y is the exponent.
Reference for language elementsVersion 3.3
608
1
- 2 - 1 0 1 2 x
y = 0.4
232.5
- 2y = - 1- 1.5
y = 0
y = 1xy
Straight lines:y= 0 and y= 1
Parabola:y> 1
Hyperbola:y< 0
Radical:0< y< 1
Hyperbola:y< 0 odd
Hyperbola:y< 0 even
Parabola:y> 1 odd
Parabola:y> 1 even
- 1
The profile of this function depends on the value of the exponent.
• For y=0 and y=1, the function is a straight line:
pow(x, 0) = 1
pow(x, 1) = x
• For 0<y<1, the function is defined for x≥0 only and has the shape of a radical or a root curve.
• For y<0 the curve is a hyperbola. It is defined for all x>0 and is always positive on this domain. Inaddition, for integer y it is also defined for x<0 and is positive for even values of y and negative forodd values of y.
• For y>1 the curve is a parabola. It is defined for all x≥0 and is always positive on this domain. Inaddition, similarly to the hyperbola, for integer y it is also defined for x<0 and is positive for evenvalues of y and negative for odd values of y.
Return type: Numeric
A missing value is returned in the following situations:
• The base is negative and the exponent is not an integer.• The base is zero and the exponent is negative.• Any of the arguments contains a missing value.• An overflow occurs as a result of the operation.
On some platforms a missing value may also be returned if both the base and the exponent are zero.
Reference for language elementsVersion 3.3
609
base
Type: Numeric
The base of the power function.
Restrictions:
• base > 0 if exponent is not an integer• base ≠ 0 if exponent < 0
exponent
Type: Numeric
The exponent of the power function.
ExamplesConsider the following code and its output:
data example; p1 = pow( 4 , 2); p2 = pow("4",2); p3 = pow("four",2);run;
p1 = 16p2 = 16p3 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; h1 = pow( 2.9,-1 ); h2 = pow( 2.9,-1.5); h3 = pow( 2.9,-2 ); h4 = pow(-2.9,-1 ); h5 = pow(-2.9,-1.5); h6 = pow(-2.9,-2 );
p1 = pow( 2.9, 2 ); p2 = pow( 2.9, 2.5); p3 = pow( 2.9, 3 ); p4 = pow(-2.9, 2 ); p5 = pow(-2.9, 2.5); p6 = pow(-2.9, 3 );run;
h1 = 0.3448275862h2 = 0.2024897309h3 = 0.1189060642h4 = -h1 = -0.344827586h5 = .h6 = h3 = 0.1189060642
p1 = 8.41p2 = 14.321713934p3 = 24.389p4 = p1 = 8.41p5 = .p6 = -p3 = -24.389
The above examples illustrate hyperbolic and parabolic profiles of this function. The fifth example inboth series returns a missing value because the function is not defined for negative bases and fractionalexponents.
Reference for language elementsVersion 3.3
610
CALL LOGISTIC
Calculates the standard logistic function for each numeric variable in a list.
CALL LOGISTIC ( { x , … } );
This call routine is defined for numeric valuesonly. It calculates the standard logistic functionfor each variable in an argument list replacingthe input values in the variables with the resultof the calculation.
f(x) = (e−x + 1)−1
0.5
1
- 6 - 4 - 2 0 2 4 6
x
The return values are between 0 and 1, not including the bounds.
If any of the arguments contains a missing value, all values are set to missing.
x
Type: Numeric
ExampleConsider the following code and its output:
data example; s1=0; s2=1.1; s3="4"; s4=-6.6; call logistic (s1,s2,s3,s4); put s1= s2= s3= s4=; output;
m1=0; m2=1.1; m3="four"; m4=-6.6; call logistic (m1,m2,m3,m4); put m1= m2= m3= m4=; output;run;
s1 = 0.5s2 = 0.7502601056s3 = 0.98201379s4 = 0.00135852
m1 = .m2 = .m3 = .m4 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. Therefore all values are set to missing in the second example series.
Logarithmic functionsFunctions that perform logarithmic operations on the data.
LOG log(x) Returns the natural logarithm of a numeric argument.
LOG2 log2(x) Returns base 2 logarithm of a numeric argument.
Reference for language elementsVersion 3.3
611
LOG10 log10(x) Returns the decimal logarithm of a numeric argument.
LOG1PX log(x+1) Returns the natural logarithm of a numeric argument plus one.
LOG
Returns the natural logarithm of a numeric argument.
LOG ( x )
This function is defined for positive numeric values onlyand takes one argument. It calculates the natural logarithmof the argument:
log(x)
0
1
- 1
1 2 3 4
x
log(x )
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x > 0
If the argument is negative or zero, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = log("4"); g2 = log("four"); g3 = log(0.003); g4 = log(1); g5 = log(2.3); g6 = log(1e-307);run;
g1 = 1.3862943611g2 = .g3 = -5.80914299g4 = 0g5 = 0.8329091229g6 = -706.8936235
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Reference for language elementsVersion 3.3
612
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
data example; m1 = log(0); m2 = log(-2.2);run;
The above examples return a missing value because the argument is out of range.
LOG2
Returns base 2 logarithm of a numeric argument.
LOG2 ( x )
This function is defined for positive numeric values onlyand takes one argument. It calculates base 2 logarithm ofthe argument:
log2(x) 0
1
- 1
1 2 3 4
x
log2(x )
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x > 0
If the argument is negative or zero, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = log2("4"); g2 = log2("four"); g3 = log2(0.003); g4 = log2(1); g5 = log2(2.3); g6 = log2(1e-307);run;
g1 = 2g2 = .g3 = -8.380821784g4 = 0g5 = 1.2016338612g6 = -1019.831925
Reference for language elementsVersion 3.3
613
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
data example; m1 = log2(0); m2 = log2(-2.2);run;
The above examples return a missing value because the argument is out of range.
LOG10
Returns the decimal logarithm of a numeric argument.
LOG10 ( x )
This function is defined for positive numeric valuesonly and takes one argument. It calculates the decimallogarithm of the argument:
log10(x)
0
0.5
- 0.5
1 2 3 4
x
log10(x )
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x > 0
If the argument is negative or zero, a missing value is returned.
Reference for language elementsVersion 3.3
614
ExamplesConsider the following code and its output:
data example; g1 = log10("4"); g2 = log10("four"); g3 = log10(0.003); g4 = log10(1); g5 = log10(2.3); g6 = log10(1e-307);run;
g1 = 0.6020599913g2 = .g3 = -2.522878745g4 = 0g5 = 0.361727836g6 = -307
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
data example; m1 = log10(0); m2 = log10(-2.2);run;
The above examples return a missing value because the argument is out of range.
LOG1PX
Returns the natural logarithm of a numeric argument plus one.
LOG1PX ( x )
This function is defined for numeric values greater than -1and takes one argument. It calculates the natural logarithmof the argument plus one:
log(x+1)
0
1
- 1
1 2 3
- 1 x
log(x+ 1)
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x > -1
Reference for language elementsVersion 3.3
615
If the argument is smaller or equal -1, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = log1px("4"); g2 = log1px("four"); g3 = log1px(0.003); g4 = log1px(0); g5 = log1px(-0.3);run;
g1 = 1.6094379124g2 = .g3 = 0.002995509g4 = log (0+1) = 0g5 = -0.356674944
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m1 = log1px(-1); m2 = log1px(-2.2);run;
The above examples return a missing value because the argument is out of range.
Trigonometric functionsFunctions that perform trigonometric operations on the data.
Primary trigonometric functionsSIN sin(x) Returns the sine of a numeric argument.
COS cos(x) Returns the cosine of a numeric argument.
TAN tan(x) Returns the tangent of a numeric argument.
Inverse trigonometric functionsARSIN α = arcsin(x) Returns the principal value of arc sine of a numeric
argument.ARCOS α = arccos(x) Returns the principal value of arc cosine of a numeric
argument.ATAN α = arctan(x) Returns the principal value of arc tangent of a numeric
argument.
ATAN2 Returns the signed angle between the positive x-axisand a vector represented by two numeric arguments.
Hyperbolic functions
SINH Returns the hyperbolic sine of a numeric argument.
Reference for language elementsVersion 3.3
616
COSH Returns the hyperbolic cosine of a numeric argument.
TANH Returns the hyperbolic tangent of a numeric argument.
CALL TANH Calculates the hyperbolic tangent for each numericvariable in a list.
Inverse hyperbolic functions
ARSINH Returns the inverse hyperbolic sine of a numericargument.
ARCOSH Returns the inverse hyperbolic cosine of a numericargument.
ARTANH Returns the inverse hyperbolic tangent of a numericargument.
Many of the functions in this section have special values or poles at multiples or fractions of π, whereπ≈3.141592653690, both positive and negative. However, as π is an irrational number, it cannot berepresented exactly in a computer application. Therefore intervals with fractions of π as bounds arealways open, while poles or asymptotes are never reached.
SIN
Returns the sine of a numeric argument.
SIN ( x )
This function is defined for numeric values onlyand takes one argument. It calculates the sineof the argument:
sin(x) - 1
1
- 4
- 3
- 2 - 1 0 1 2 3 4
x
sin(x )
-
Return type: Numeric
The return value is between -1 and 1, inclusive.
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Reference for language elementsVersion 3.3
617
ExamplesConsider the following code and its output:
data example; s1 = sin("4"); s2 = sin("four"); s3 = sin(-0.5); s4 = sin(1.1);run;
s1 = -0.756802495s2 = .s3 = -0.479425539s4 = 0.8912073601
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; p1 = sin(3.1415926535897); p2 = sin(1.5707963267949); p3 = sin(1.5707963267948); p4 = sin(0);run;
p1 = 9.33812⋅10-14 ≈ 0p2 = 1p3 = 1p4 = 0
The first example uses a value close to π as input and returns a value close to 0. However, examples2 and 3 use similar approxiations of π/2, but return exactly 1 in each case. This behaviour is platform-specific and may depend on the degree of approximation of the input.
COS
Returns the cosine of a numeric argument.
COS ( x )
This function is defined for numeric valuesonly and takes one argument. It calculates thecosine of the argument:
cos(x) - 1
1
- 4 - 3
- 2
- 1 0 1
2
3 4
x
cos(x )
22-
Return type: Numeric
The return value is between -1 and 1, inclusive.
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Reference for language elementsVersion 3.3
618
ExamplesConsider the following code and its output:
data example; s1 = cos("4"); s2 = cos("four"); s3 = cos(-0.5); s4 = cos(1.1);run;
s1 = -0.653643621s2 = .s3 = 0.8775825619s4 = 0.4535961214
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; p1 = cos(3.1415926535897); p2 = cos(1.5707963267949); p3 = cos(1.5707963267948); p4 = cos(0);run;
p1 = -1
p2 = -3.49148⋅10-15 ≈ 0
p3 = 9.665064⋅10-14 ≈ 0p4 = 1
The first example uses a value close to π as input and returns exactly -1. However, examples 2 and 3use similar approxiations of π/2, but return approximations of 0, with the correct sign. This behaviour isplatform-specific and may depend on the degree of approximation of the input.
TAN
Returns the tangent of a numeric argument.
TAN ( x )
This function is defined for numeric valuesonly and takes one argument. It calculates thetangent of the argument:
tan(x)
- 1
1
- 4 - 3 - 2 - 1 0 1 2
3
4 x
tan(x )
2
3
- 2
- 3
22- 23
23- -
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
Reference for language elementsVersion 3.3
619
x
Type: Numeric
The argument of the function.
The mathematical tangent function has poles at multiples of π/2, where π≈3.141592653690, bothpositive and negative. However, as π is an irrational number, it cannot be represented exactly in acomputer application. Therefore, function TAN never hits a pole and remains defined for all numericvalues.
ExamplesConsider the following code and its output:
data example; s1 = tan("4"); s2 = tan("four"); s3 = tan(-0.5); s4 = tan(1.1);run;
s1 = 1.1578212823s2 = .s3 = -0.54630249s4 = 1.9647596572
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; p1 = tan(3.1415926535897); p2 = tan(1.5707963267949); p3 = tan(1.5707963267948); p4 = tan(0);run;
p1 = -9.33812⋅10-14 ≈ 0
p2 = -2.8641138⋅1014 ≈ -∞
p3 = 1.034654⋅1013 ≈ +∞p4 = 0
The first example uses a value close to π as input and returns a value close to 0. Examples 2 and 3 usesimilar approxiations of π/2, and return very large values with the correct sign approximating positiveand negative infinity.
ARSIN
Returns the principal value of arc sine of a numeric argument.
ARSIN ( x )
Reference for language elementsVersion 3.3
620
This function is defined for numeric values only between-1 and 1, inclusive, and takes one argument. It calculatesthe principal value of arc sine of the argument in radians,where the arc sine is defined as a trigonometrical inverseof sine:
α = arcsin(x) is defined such that x = sin(α)0.50 1
- 1 - 0.5
arcsin(x )
x
2
4
4-
2-
Return type: Numeric
The return value is between -π/2 and π/2.
If the argument is out of range or contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: -1 ≤ x ≤ 1
ExampleConsider the following code and its output:
data example; s1 = arsin(".7"); s2 = arsin("point seven"); s3 = arsin(-1); s4 = arsin(0); s5 = arsin(1); s6 = arsin(1.5);run;
s1 = 0.7753974966s2 = .
s3 = -1.570796327 ≈ -π/2s4 = 0
s5 = 1.570796327 ≈ π/2s6 = .
The argument value ".7" has been converted into a number, but the argument value "point seven"is considered missing.
The last example returns a missing value because the input is out of range.
ARCOS
Returns the principal value of arc cosine of a numeric argument.
ARCOS ( x )
Reference for language elementsVersion 3.3
621
This function is defined for numeric values only between-1 and 1, inclusive, and takes one argument. It calculatesthe principal value of arc cosine of the argumentin radians, where the arc cosine is defined as atrigonometrical inverse of cosine:
α = arccos(x) is defined such that x = cos(α)
0.50 1- 1 - 0.5
arccos(x )
x
2
4
43
Return type: Numeric
The return value is between 0 and π, inclusive.
If the argument is out of range or contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: -1 ≤ x ≤ 1
ExampleConsider the following code and its output:
data example; s1 = arcos(".7"); s2 = arcos("point seven"); s3 = arcos(-1); s4 = arcos(0); s5 = arcos(1); s6 = arcos(1.5);run;
s1 = 0.7953988302s2 = .s3 = 3.1415926536 ≈ π
s4 = 1.5707963268 ≈ π/2s5 = 0s6 = .
The argument value ".7" has been converted into a number, but the argument value "point seven"is considered missing.
The last example returns a missing value because the input is out of range.
ATAN
Returns the principal value of arc tangent of a numeric argument.
ATAN ( x )
Reference for language elementsVersion 3.3
622
This function is defined for numeric valuesonly, and takes one argument. It calculates theprincipal value of arc tangent of the argument inradians, where the arc tangent is defined as atrigonometrical inverse of tangent:
α = arctan(x) is defined such that x = tan(α)
10 2
- 2 - 1
arctan(x )
x
2
2-
3
- 3
Return type: Numeric
The return value is between -π/2 and π/2.
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; s1 = atan(".7"); s2 = atan("point seven"); s3 = atan(0); s4 = atan(1e308); s5 = atan(-1e308);run;
s1 = 0.6107259644s2 = .s3 = 0
s4 = 1.5707963268 ≈ π/2s5 = -1.5707963268 ≈ -π/2
The argument value ".7" has been converted into a number, but the argument value "point seven"is considered missing.
For very large values, positive and negative, as shown in examples 4 and 5, function ATAN returns anapproximation of π/2 with the appropriate sign.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
ATAN2
Returns the signed angle between the positive x-axis and a vector represented by two numericarguments.
ATAN2 ( y , x )
Reference for language elementsVersion 3.3
623
9
6
43
- 0.9
2 3
- 1- 2- 3
1
2
- 1
0
x
y
A
B
CD
Quadrant IQuadrant II
Quadrant III Quadrant IV
This function is defined for numeric values only,and takes two arguments. It calculates thesigned angle between the positive x-axis anda vector (x,y) in the range between -π and π.The sign of the angle returned represents thequadrant of the end point of the vector.
For return values between -π/2 and π/2, thiscalculation is equivalent to the arc tangent of theratio of the arguments (see section ATAN):
A = (3.35, 1.22)C = (-2.953, -0.96)
B = (-2, 2)D = (2.77, -1.6)
Attention:The order of the function arguments is the inverse of the order of coordinates of the vector theyrepresent. The argument order is y, x.
Return type: Numeric
The return value is between -π and π.
If both arguments are zero, zero is returned.
If any of the arguments contains a missing value, a missing value is returned.
y
Type: Numeric
The Y coordinate value.
x
Type: Numeric
The X coordinate value.
Function ATAN2 has the following advantages compared to the classic arc tangent function ATAN:
• ATAN2 correctly returns π/2 or -π/2 for points on the y-axis where ATAN is undefined.
• ATAN2 differentiates between diametrally opposite quadrants, which is not possible for ATAN. Thus,ATAN2 returns distinctly signed values for each quadrant where ATAN cannot distinguish betweenpoints in quadrants I and III, and quadrants II and IV.
Reference for language elementsVersion 3.3
624
ExampleConsider the following code and its output:
data example; s1 = atan2("4",1.22); s2 = atan2("four",1.22); a = atan2( 1.22, 3.35 ); b = atan2( 2, -2 ); c = atan2(-0.96,-2.953); d = atan2(-1.6, 2.77 );run;
s1 = 0.2960376145s2 = .
a = 0.3492502751 ≈ π/9b = 2.3561944902 ≈ 3/4πc = -2.827276528 ≈ -0.9πd = -0.523799047 ≈ -π/6
The argument value ".7" has been converted into a number, but the argument value "point seven"is considered missing.
data example; s1 = atan2( 0, 0); s2 = atan2( 1, 0); s3 = atan2(-1, 0); s4 = atan2( 0, 1); s5 = atan2( 0,-1); s6 = atan2( 1e-307, 1); s7 = atan2(-1e-307, 1); s8 = atan2( 1e-307,-1); s9 = atan2(-1e-307,-1);run;
s1 = 0
s2 = 1.5707963268 ≈ π/2s3 = -1.5707963268 ≈ -π/2s4 = 0s5 = 3.1415926536 ≈ π
s6 = 10-307 ≈ +0
s7 = -10-307 ≈ -0s8 = 3.1415926536 ≈ πs9 = -3.1415926536 ≈ -π
The above examples demonstrate calculations for points on the coordinate axes, as well as points nearthe x-axis where the return value changes its sign.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
SINH
Returns the hyperbolic sine of a numeric argument.
SINH ( x )
Reference for language elementsVersion 3.3
625
This function is defined for numeric valuesonly and takes one argument. It calculatesthe hyperbolic sine of the argument:
0 1 2- 1- 2
x
sinh(x )
1
2
3
- 1
- 2
- 3
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; s1 = sinh("4"); s2 = sinh("four"); s3 = sinh(-1.7); s4 = sinh(0); s5 = sinh(100); s6 = sinh(800);run;
s1 = 27.289917197s2 = .s3 = -2.645631934s4 = 0
s5 = 1.3440586⋅1043
s6 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. The last example returns a missing value due to an overflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
COSH
Returns the hyperbolic cosine of a numeric argument.
COSH ( x )
Reference for language elementsVersion 3.3
626
This function is defined for numeric valuesonly and takes one argument. It calculatesthe hyperbolic cosine of the argument:
0 1 2- 1- 2
x
cosh(x )
1
2
3
4
Return type: Numeric
The return value is greater or equal one.
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; s1 = cosh("4"); s2 = cosh("four"); s3 = cosh(-1.7); s4 = cosh(0); s5 = cosh(100); s6 = cosh(800);run;
s1 = 27.308232836s2 = .s3 = 2.8283154579s4 = 1
s5 = 1.3440586⋅1043
s6 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. The last example returns a missing value due to an overflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
TANH
Returns the hyperbolic tangent of a numeric argument.
TANH ( x )
Reference for language elementsVersion 3.3
627
This function is defined for numeric values only and takesone argument. It calculates the hyperbolic tangent of theargument: 0 1 2- 1- 2
x
tanh(x )1
3
- 1
- 3
Return type: Numeric
The return value is between -1 and 1, not including the bounds.
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; s1 = tanh("4"); s2 = tanh("four"); s3 = tanh(-1.7); s4 = tanh(0); s5 = tanh(15);run;
s1 = 0.9993292997s2 = .s3 = -0.935409071s4 = 0s5 = 1
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Note the rounding of the return value in the last example.
CALL TANH
Calculates the hyperbolic tangent for each numeric variable in a list.
CALL TANH ( { x , … } );
This call routine is defined for numeric values only. It calculates the hyperbolic tangent for each variablein an argument list replacing the input values in the variables with the result of the calculation. Seesection TANH for details on the hyperbolic tangent.
The return values are between -1 and 1, not including the bounds.
If any of the arguments contains a missing value, all values are set to missing.
Reference for language elementsVersion 3.3
628
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; s1=0.6; s2=1; s3="4"; call tanh (s1,s2,s3); put s1= s2= s3=; output;
m1=0.6; m2=1; m3="four"; call tanh (m1,m2,m3); put m1= m2= m3=; output;run;
s1 = 0.537049567s2 = 0.761594156s3 = 0.9993292997
m1 = .m2 = .m3 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. Therefore all values are set to missing in the second example series.
ARSINH
Returns the inverse hyperbolic sine of a numeric argument.
ARSINH ( x )
This function is defined for numeric values only and takesone argument. It calculates the inverse hyperbolic sine ofthe argument:
0 1 2- 1- 2
- 1
1
x
arcsinh(x )
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The argument of the function.
Reference for language elementsVersion 3.3
629
ExampleConsider the following code and its output:
data example; s1 = arsinh("4"); s2 = arsinh("four"); s3 = arsinh(-1.7); s4 = arsinh(0); s5 = arsinh(100); s5 = arsinh(1e200);run;
s1 = 2.0947125473s2 = .s3 = -1.300820427s4 = 0s5 = 5.2983423656s6 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. The last example returns a missing value due to an overflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
ARCOSH
Returns the inverse hyperbolic cosine of a numeric argument.
ARCOSH ( x )
This function is defined for numeric values only greater orequal one. It takes one argument. This function calculatesthe inverse hyperbolic cosine of the argument:
0 1 2 3
1
2
x
arccosh(x )
Return type: Numeric
The return value is greater or equal zero.
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The argument of the function.
Restriction: x ≥ 1
Reference for language elementsVersion 3.3
630
ExampleConsider the following code and its output:
data example; s1 = arcosh("4"); s2 = arcosh("four"); s3 = arcosh(1); s4 = arcosh(1.1);run;
s1 = 2.0634370689s2 = .s3 = 0s4 = 0.4435682544
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; c1 = arcosh(-1.7); c2 = arcosh(0); c3 = arcosh(1e200);run;
The above examples return a missing value because the argument is out of range, or because of anoverflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
ARTANH
Returns the inverse hyperbolic tangent of a numeric argument.
ARTANH ( x )
This function is defined for numeric values only between-1 and 1, not including the bounds. It takes one argument.This function calculates the inverse hyperbolic tangent ofthe argument:
0 1- 1
- 1
- 2
1
2
x
arctanh(x )
Reference for language elementsVersion 3.3
631
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: -1 < x < 1
ExampleConsider the following code and its output:
data example; s1 = artanh(".7"); s2 = artanh("point seven"); s3 = artanh(-0.3); s4 = artanh(0); s5 = artanh(0.9999999999); s6 = artanh(1); s7 = artanh(-5.1);run;
s1 = 0.8673005277s2 = .s3 = -0.309519604s4 = 0s5 = 11.859499014s6 = .s7 = .
The argument value ".7" has been converted into a number, but the argument value "point seven"is considered missing. The last two examples return a missing value because the argument is out ofrange.
Factorials and special functionsFunctions that perform factorial operations on the data and calculate special functions: Beta, Gamma,Bessel, Airy, Error and related functions.
FACT n! = 1⋅2⋅3⋅…⋅(n-1)⋅n Returns the factorial of a numeric argument.
LFACT log n! Returns the natural logarithm of the factorialof a numeric argument.
GAMMAReturns the Gamma function of a numericargument, or the Euler integral of thesecond kind.
LGAMMA log Γ (x) Returns the natural logarithm of the Gammafunction of a numeric argument.
DIGAMMA Returns the Digamma function of a numericargument.
TRIGAMMA Returns the Trigamma function of a numericargument.
Reference for language elementsVersion 3.3
632
BETAReturns the Beta function of two numericarguments, or the Euler integral of the firstkind.
LOGBETA log Β (x,y) Returns the natural logarithm of the Betafunction of two numeric arguments.
JBESSEL Returns the Bessel function of the first kindfor two numeric arguments.
IBESSELReturns the modified Bessel function of thefirst kind for two numeric arguments, scaledor unscaled.
AIRY Returns the Airy function of the first kind fora numeric argument.
DAIRY Ai'(x)Returns the first derivative of the Airyfunction of the first kind for a numericargument.
ERF Returns the error function of a numericargument.
ERFC erfc(x) = 1 - erf(x) Returns the complementary error function ofa numeric argument.
The factorial function and two types of Euler integral have the following relationships to each other:
For integer values: For all values:
FACT
Returns the factorial of a numeric argument.
FACT ( x )
This function is defined for non-negative integer values only and takes one argument. It returns itsfactorial, or the product of all integer numbers from 1 and up to and including the value in the argument:
n! = 1⋅2⋅3⋅…⋅(n-1)⋅n
Return type: Numeric
Reference for language elementsVersion 3.3
633
If the argument contains a missing value, or if an overflow occurs as a result of the operation, a missingvalue is returned. Note that the upper limit for the argument is platform-dependent.
x
Type: Numeric
The argument of the function.
Restriction: x ∈ ℤ0, or x is a positive integer or zero.
If the argument is either negative or not an integer, a missing value is returned.
ExampleConsider the following code and its output:
data example; f1 = fact(0); f2 = fact("4"); f3 = fact("four"); f4 = fact(-2); f5 = fact(200);run;
f1 = 1f2 = 1⋅2⋅3⋅4 = 24f3 = .f4 = .f5 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. The argument in the fourth example is negative, whereas the fifth example causesan overflow during multiplication.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
LFACT
Returns the natural logarithm of the factorial of a numeric argument.
LFACT ( x )
This function is defined for non-negative integer values only and takes one argument. It calculates thenatural logarithm of the FACT function (see section FACT):
log n!
Function LFACT inherits the limitation to integer numbers only from function FACT. However, it allowsmuch larger numbers as input due to the use of the logarithm.
Return type: Numeric
If the argument contains a missing value, or if an overflow occurs as a result of the operation, a missingvalue is returned. Note that the upper limit for the argument is platform-dependent.
Reference for language elementsVersion 3.3
634
x
Type: Numeric
The argument of the function.
Restriction: x ∈ ℤ0, or x is a positive integer or zero.
If the argument is either negative or not an integer, a missing value is returned.
ExampleConsider the following code and its output:
data example; f1 = lfact(0); f2 = lfact(1); f3 = lfact("4"); f4 = lfact("four");run;
f1 = 0f2 = 0f3 = log(1⋅2⋅3⋅4) = 3.1780538303f4 = .
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; f5 = lfact(-2); f6 = lfact(2.3); f7 = lfact(2.2e9);run;
The above examples return a missing value because the argument is out of range, or because of anoverflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
GAMMA
Returns the Gamma function of a numeric argument, or the Euler integral of the second kind.
GAMMA ( x )
Reference for language elementsVersion 3.3
635
This function is defined for all realnumeric values except negative integersand zero and takes one argument. Itcalculates the Gamma function definedvia a convergent improper integral asfollows:
For integers, this equals the factorial (seesection FACT) of the argument reducedby one:
- 4
- 2
0
2
- 2 21 3- 3 - 1
1
3
- 3
- 1
(x )
x
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The argument of the function.
Restriction: x cannot contain negative integers or zero.
If the argument is nearing a negative integer or zero by 10-12, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = gamma("4"); g2 = gamma("four"); g3 = gamma(4.2); g4 = gamma(0.003); g5 = gamma(-0.3); g6 = gamma(-1.5); g7 = gamma(-2.7);run;
g1 = 3! = 6g2 = .g3 = 7.7566895358g4 = 332.7590767g5 = -4.326851109g6 = 2.3632718012g7 = -0.931082785
Reference for language elementsVersion 3.3
636
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m1 = gamma(0); m2 = gamma(1e-13); m3 = gamma(-2); m4 = gamma(1e306);run;
The above examples return a missing value because the argument is nearing a function pole, orbecause of an overflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
LGAMMA
Returns the natural logarithm of the Gamma function of a numeric argument.
LGAMMA ( x )
This function is defined for positive numeric valuesonly and takes one argument. It calculates the naturallogarithm of the GAMMA function, see section GAMMA:
log Γ (x)1
2
0 1 2 3 4x
(x )log
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The argument of the function.
Restriction: x > 0
If the argument is negative or zero, a missing value is returned.
Reference for language elementsVersion 3.3
637
ExamplesConsider the following code and its output:
data example; g1 = lgamma("4"); g2 = lgamma("four"); g3 = lgamma(0.003); g4 = lgamma(1); g5 = lgamma(1.3); g6 = lgamma(3.1);run;
g1 = log (3!) = 1.7917594692g2 = .g3 = 5.8074187347g4 = 0g5 = -0.10817481g6 = 0.7873750833
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m1 = lgamma(0); m2 = lgamma(-2.2);run;
The above examples return a missing value because the argument is out of range, or because of anoverflow.
DIGAMMA
Returns the Digamma function of a numeric argument.
DIGAMMA ( x )
This function is defined for positive numeric valuesonly and takes one argument. It calculates theDigamma function, or the logarithmic derivative of theGamma function (see section GAMMA):
x )(
0 2
1x
- 5
5
- 1- 2
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x cannot contain negative integers or zero.
If the argument is nearing a negative integer or zero by 10-12, a missing value is returned.
Reference for language elementsVersion 3.3
638
ExamplesConsider the following code and its output:
data example; g1 = digamma("4"); g2 = digamma("four"); g3 = digamma(1); g4 = digamma(1.461632145); g5 = digamma(0.003); g6 = digamma(-0.3); g7 = digamma(-1.5); g8 = digamma(-2.7);run;
g1 = 1.2561176684g2 = .g3 = -0.577215665
g4 = 3.061493⋅1011
g5 = -333.905625g6 = 2.1133097796g7 = 0.7031566406g8 = -1.115347129
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
The fourth example takes the positive root of the Digamma function as an argument, rounded to ninedecimals. The result is nearly zero, as expected.
data example; m1 = digamma(0); m2 = digamma(1e-13); m3 = digamma(-2);run;
The above examples return a missing value because the argument is nearing a function pole.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
TRIGAMMA
Returns the Trigamma function of a numeric argument.
TRIGAMMA ( x )
This function is defined for all real numeric valuesexcept negative integers and zero and takes oneargument. It calculates the Trigamma function, or thesecond logarithmic derivative of the Gamma function(see section GAMMA):
0 21 x
5
10
- 2 - 1
x )(1
Return type: Numeric
Reference for language elementsVersion 3.3
639
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x cannot contain negative integers or zero.
If the argument is nearing a negative integer or zero by 10-12, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = trigamma("4"); g2 = trigamma("four"); g3 = trigamma(1.3); g4 = trigamma(0.003); g5 = trigamma(-0.3); g6 = trigamma(-1.5); g7 = trigamma(-2.7); g8 = trigamma(1e200);run;
g1 = 0.2838229557g2 = .g3 = 1.134253435g4 = 111112.74886g5 = 13.945160268g6 = 9.3792466451g7 = 14.769375846g8 = 0
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Note that in the last example TRIGAMMA returns zero when a large value in the argument causes anunderflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
data example; m1 = trigamma(0); m2 = trigamma(1e-13); m3 = trigamma(-2);run;
The above examples return a missing value because the argument is nearing a function pole.
BETA
Returns the Beta function of two numeric arguments, or the Euler integral of the first kind.
BETA ( x , y )
Reference for language elementsVersion 3.3
640
This function is defined for positivenumeric values only and takes twoarguments. It calculates the Beta function:
The Beta function is related to theGamma function (see section GAMMA)as follows:
For integers, the Beta function can beexpressed with factorials (see sectionFACT):
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The X coordinate value.
Restriction: x > 0
If the argument is negative or zero, a missing value is returned.
y
Type: Numeric
The Y coordinate value.
Restriction: y > 0
If the argument is negative or zero, a missing value is returned.
Reference for language elementsVersion 3.3
641
ExamplesConsider the following code and its output:
data example; g1 = beta("4",1); g2 = beta("four",1); g3 = beta(0.3,0.5); g4 = beta(6.8,2.2); g5 = beta(701.54,710.3);run;
g1 = 0.25g2 = .g3 = 4.554443088g4 = 0.0135704815g5 = 0
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m1 = beta(0,0); m2 = beta(-2.2,1); m3 = beta(1e306,1);run;
The above examples return a missing value because the argument is out of range, or because of anoverflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
LOGBETA
Returns the natural logarithm of the Beta function of two numeric arguments.
LOGBETA ( x , y )
This function is defined for positive numeric values only and takes two arguments. It calculates thenatural logarithm of Beta function, see section BETA:
log Β (x,y)
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The X coordinate value.
Restriction: x > 0
If the argument is negative or zero, a missing value is returned.
Reference for language elementsVersion 3.3
642
y
Type: Numeric
The Y coordinate value.
Restriction: y > 0
If the argument is negative or zero, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = logbeta("4",1); g2 = logbeta("four",1); g3 = logbeta(0.3,0.5); g4 = logbeta(6.8,2.2); g5 = logbeta(701.54,710.3);run;
g1 = -1.386294361g2 = .g3 = 1.5161032593g4 = -4.299858325g5 = -980.5997813
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m1 = logbeta(0,0); m2 = logbeta(-2.2,1); m3 = logbeta(1e306,1);run;
The above examples return a missing value because the argument is out of range, or because of anoverflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
JBESSEL
Returns the Bessel function of the first kind for two numeric arguments.
JBESSEL ( alpha , x )
This function is defined for positive numeric values only and takes two arguments. It calculates theBessel function of the first kind:
for all integer m, using the factorial m! and the Gamma function Γ(t) described in sections FACT andGAMMA, respectively.
Reference for language elementsVersion 3.3
643
The above equation defines a family of functions parametrised by the value of α known as the order ofthe function. The functions represent a group of solutions of Bessel's differential equation:
The plot below illustrates Jα (x) functions of orders 0, 1 and 2.
1.0
0.8
0.6
0.4
0.2
0.0
- 0.2
- 0.4
5 10 15 20
J (x )0
J (x )1
J (x )2
x
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
alpha
Type: Numeric
The order of the function.
Restriction: alpha ≥ 0
If the argument is negative, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x ≥ 0
If the argument is negative, a missing value is returned.
Reference for language elementsVersion 3.3
644
ExamplesConsider the following code and its output:
data example; g1 = jbessel("4",1); g2 = jbessel("four",1); g3 = jbessel(0.3,0.5); g4 = jbessel(6.8,2.2); g5 = jbessel(0,0);run;
g1 = 0.002476639g2 = .g3 = 0.7002604885g4 = 0.0004841404g5 = 1
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m1 = jbessel(2.2,-1); m2 = jbessel(-2.2,1); m3 = jbessel(200,2.3);run;
The above examples return a missing value because the argument is out of range, or because of anoverflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
IBESSEL
Returns the modified Bessel function of the first kind for two numeric arguments, scaled or unscaled.
IBESSEL ( alpha , x , scale )
This function is defined for positive numericvalues only and takes three arguments. Itcalculates the modified Bessel function of thefirst kind:
for all integer m, using the factorial m! and theGamma function Γ(t) described in sectionsFACT and GAMMA, respectively.
3
2
1
01 2 3 4
I (x )0 I (x )
1 I (x )2 I (x )
3
x
Iα (x) functions of orders 0, 1, 2 and 3
Reference for language elementsVersion 3.3
645
The above equation defines a family of functions parametrised by the value of α known as the order ofthe function. The functions represent a group of solutions of the modified Bessel's differential equation:
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
alpha
Type: Numeric
The order of the function.
Restriction: alpha ≥ 0
If the argument is negative, a missing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x ≥ 0
If the argument is negative, a missing value is returned.
scale
Type: Numeric
The scale of the function.
Restriction: 0 ≤ scale ≤ 1
If the argument is negative or greater than 1, a missing value is returned.
ExamplesConsider the following code and its output:
data example; g1 = ibessel("4",1,0); g2 = ibessel("four",1,0); g3 = ibessel(0.3,0.5,0); g4 = ibessel(0.3,0.5,1); g5 = ibessel(6.3,22.2,0); g6 = ibessel(6.3,22.2,1); g7 = ibessel(0,0,0); g8 = ibessel(0,0,1);run;
g1 = 0.0027371202g2 = .g3 = 0.7709517346g4 = 0.4676058642g5 = 150339241.87g6 = 0.0343348265g7 = 1g8 = 1
Reference for language elementsVersion 3.3
646
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m1 = ibessel(2.2,-1,0); m2 = ibessel(-2.2,1,0); m3 = ibessel(-2.2,1,2); m4 = ibessel(100,1e200,0);run;
The above examples return a missing value because the argument is out of range, or because of anoverflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
AIRY
Returns the Airy function of the first kind for a numeric argument.
AIRY ( x )
This function is defined for numeric values only and takes one argument. It calculates the Airy functiondefined via a convergent improper integral as follows:
Ai(x )0.50
0.25
- 0.25
- 15 - 10 - 5 0 5
x
The Ai(x) function is a solution to the Airy differential equation:
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
Reference for language elementsVersion 3.3
647
x
Type: Numeric
The argument of the function.
ExamplesConsider the following code and its output:
data example; a1 = airy("4"); a2 = airy("four"); a3 = airy(1.3); a4 = airy(0); a5 = airy(104); a6 = airy(105); a7 = airy(-1e205);run;
a1 = 0.0009515639a2 = .a3 = 0.0934746658a4 = 0.3550280539
a5 = 0.74488⋅10-308
a6 = 0
a7 = -2.45245⋅10-52
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
data example; m1 = airy(-1e206); m2 = airy( 1e206);run;
The above examples return a missing value because of an overflow.
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
DAIRY
Returns the first derivative of the Airy function of the first kind for a numeric argument.
DAIRY ( x )
Reference for language elementsVersion 3.3
648
This function is defined for numericvalues only and takes one argument. Itcalculates the first derivative of the Airyfunction described in section AIRY:
Ai'(x)
0
0.5
1
0
- 0.5
- 1
Ai'(x )
x
- 15 5- 10 - 5
Return type: Numeric
If an overflow occurs as a result of the operation, or if the argument contains a missing value, a missingvalue is returned.
x
Type: Numeric
The argument of the function.
ExamplesConsider the following code and its output:
data example; a1 = dairy("4"); a2 = dairy("four"); a3 = dairy(1.3); a4 = dairy(0); a5 = dairy(104); a6 = dairy(105); a7 = dairy(-1e205);run;
a1 = -0.001958641a2 = .a3 = -0.120333866a4 = -0.258819404
a5 = -7.5981⋅10-308
a6 = 0
a7 = -6.365001⋅1050
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Reference for language elementsVersion 3.3
649
Note:These examples were calculated on a Windows 64-bit computer. Other platforms may have differentboundary values as determined by their architecture.
data example; m1 = dairy(-1e206); m2 = dairy( 1e206);run;
The above examples return a missing value because of an overflow.
ERF
Returns the error function of a numeric argument.
ERF ( x )
This function is defined for numeric values onlyand takes one argument. It calculates the errorfunction of the argument:
- 1
- 1 0 1
x
- 2 2
1erf(x )
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; g1 = erf("4"); g2 = erf("four"); g3 = erf(-3.3); g4 = erf(0.003);run;
g1 = 0.9999999846g2 = .g3 = -0.999996942g4 = 0.0033851273
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Reference for language elementsVersion 3.3
650
ERFC
Returns the complementary error function of a numeric argument.
ERFC ( x )
This function is defined for numeric valuesonly and takes one argument. It calculates thecomplementary error function of the argumentbased on the error function described in sectionERF.
erfc(x) = 1 - erf(x)
2
- 1 0 1
x
- 2 2
1
erfc(x )
Return type: Numeric
If the argument contains a missing value, a missing value is returned.
x
Type: Numeric
The argument of the function.
ExampleConsider the following code and its output:
data example; g1 = erfc("4"); g2 = erfc("four"); g3 = erfc(-3.3); g4 = erfc(0.003);run;
g1 = 0.9999999846g2 = .g3 = 1.9999969423g4 = 0.9966148727
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Deviance functionsFunctions that calculate the deviance of various distributions.
Deviance of the Bernoulli distribution
Returns the deviance of the Bernoulli distribution at a given point based on the probability ofsuccess.
Reference for language elementsVersion 3.3
651
Deviance of the Binomial distribution
Returns the deviance of the Binomial distribution at a given point based on the distribution meanand the number of trials.
Deviance of the Gamma distribution
Returns the deviance of the Gamma distribution at a given point based on the distribution mean.
Deviance of the Gaussian distribution
Returns the deviance of the Gaussian distribution at a given point based on the distributionmean.
Deviance of the Normal distribution
Returns the deviance of the Normal distribution at a given point based on the distribution mean.This function is an alias for the Deviance of the Gaussian distribution function.
Deviance of the Inverse Gaussian distribution
Returns the deviance of the Inverse Gaussian distribution at a given point based on thedistribution mean.
Deviance of the the Wald distribution
Returns the deviance of the the Wald distribution at a given point based on the distribution mean.This function is an alias for the Deviance of the Inverse Gaussian distribution function.
Deviance of the Poisson distribution
Returns the deviance of the Poisson distribution at a given point based on the distribution mean.
Deviance of the Bernoulli distribution
Returns the deviance of the Bernoulli distribution at a given point based on the probability of success.
DEVIANCE ( "BERNOULLI" , x , p [ , epsilon ] )
This function is defined for numeric values only and takes four arguments.
Reference for language elementsVersion 3.3
652
It calculates the deviance, or goodness of fit, for the generalised linear model of the Bernoullidistribution at point x based on the probability of success p. An optional range correction parameterε (epsilon) may be specified. If ε > 0.01, it is set equal to 0.01. If it is not specified or if ε < 10-12, thevalue of 10-12 is used for correction. The probability of success is then adjusted so that ε ≤ p ≤ 1-ε.This adjusted value of p is used in the subsequent calculation of the deviance.
Return type: Numeric
If any of the arguments contains a missing value, or if a wrong number of arguments is supplied, amissing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x=0 or x=1
If the argument is out of range or contains a missing value, a missing value is returned.
p
Type: Numeric
The probability of success.
Expected: 0 < p < 1
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
epsilonOptional argument
Type: Numeric
The range correction parameter.
Default: ε = 10-12
Expected: 10-12 < ε < 0.01
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
Reference for language elementsVersion 3.3
653
Example applying correction to the probability of successConsider the following code and its output:
data example; g1 = deviance("bernoulli", 1, 0.99992, 0.00005); g2 = deviance("bernoulli", 1, 0.99992, 0.00010); g3 = deviance("bernoulli", 1, 0.99992, 0.00015); g4 = deviance("bernoulli", 1, 0.99992 );run;
p1 = 0.99992p2 = 0.99990p3 = 0.99985p4 = 0.99992
g1 = 0.0001600064g2 = 0.0002000100g3 = 0.0003000225g4 = 0.0001600064
The value of the probability of success is not corrected in the first example because p < 1-ε. However,this condition does not hold in the second and third example, and correction is applied: p = 1-ε. Thiscorrected value is used for calculation, yielding different results.In the fourth example the ε parameter is omitted, so the default value of ε = 10-12 is used. Here, as inthe first example, p < 1-ε, so no correction is required.
Example of deviance calculationConsider the following code and its output:
data example; g1 = deviance("bernoulli", 0, 0.7); g2 = deviance("bernoulli", 0, 0.5); g3 = deviance("bernoulli", 0, 0.3); g4 = deviance("bernoulli", 1, 0.7); g5 = deviance("bernoulli", 1, 0.5); g6 = deviance("bernoulli", 1, 0.3);run;
g1 = 2.4079456087g2 = 1.3862943611g3 = 0.7133498879g4 = 0.7133498879g5 = 1.3862943611g6 = 2.4079456087
Due to the nature of the Bernoulli distribution, the deviance is symmetrical around p=0.5 for theopposite values of x. Thus, in the above example g1 = g6, g2 = g5, and g3 = g4.
Deviance of the Binomial distribution
Returns the deviance of the Binomial distribution at a given point based on the distribution mean andthe number of trials.
DEVIANCE ( "BINOMIAL" , x , mu , n [ , epsilon ] )
This function is defined for numeric values only and takes five arguments.
Reference for language elementsVersion 3.3
654
It calculates the deviance, or goodness of fit, for the generalised linear model of the Binomialdistribution at point x based on the distribution mean μ (mu) and a the number of trials n, with n > 0 andinteger, and 0 < x ≤ n. An optional range correction parameter ε (epsilon) may be specified. If ε > 0.01,it is set equal to 0.01. If it is not specified or if ε < 10-12, the value of 10-12 is used for correction. Thedistribution mean is then adjusted so that nε ≤ μ ≤ n(1-ε). This adjusted value of μ is used in thesubsequent calculation of the deviance.
Return type: Numeric
If any of the arguments contains a missing value, or if a wrong number of arguments is supplied, amissing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: 0 < x ≤ n
If the argument is out of range or contains a missing value, a missing value is returned.
mu
Type: Numeric
The distribution mean.
Expected: 0 < μ < n
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
n
Type: Numeric
The number of trials.
Restriction: n > 0
If the argument is out of range or contains a missing value, a missing value is returned.
epsilonOptional argument
Type: Numeric
The range correction parameter.
Default: ε = 10-12
Expected: 10-12 < ε < 0.01
Reference for language elementsVersion 3.3
655
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
Example applying correction to the distribution meanConsider the following code and its output:
data example; g1 = deviance("binomial", 0.001, 0.007, 10, 0.0005); g2 = deviance("binomial", 0.001, 0.007, 10, 0.0010); g3 = deviance("binomial", 0.001, 0.007, 10, 0.0015); g4 = deviance("binomial", 0.001, 0.007, 10 );run;
μ1 = 0.007μ2 = 0.01μ3 = 0.015μ4 = 0.007
g1 = 0.0081117815g2 = 0.0134029355g3 = 0.0226035199g4 = 0.0081117815
The value of the distribution mean is not corrected in the first example because μ > ε. However,this condition does not hold in the second and third example, and correction is applied: μ = ε. Thiscorrected value is used for calculation, yielding different results.In the fourth example the ε parameter is omitted, so the default value of ε = 10-12 is used. Here, as inthe first example, μ > ε, so no correction is required.
Deviance of the Gamma distribution
Returns the deviance of the Gamma distribution at a given point based on the distribution mean.
DEVIANCE ( "GAMMA" , x , mu [ , epsilon ] )
This function is defined for numeric values only and takes four arguments.
It calculates the deviance, or goodness of fit, for the generalised linear model of the Gamma distributionat a nonnegative point x based on the distribution mean μ (mu). An optional range correction parameterε (epsilon) may be specified. If ε > 0.01, it is set equal to 0.01. If it is not specified or if ε < 10-12, thevalue of 10-12 is used for correction. The distribution mean is then adjusted so that μ ≥ ε. If x ≥ 0, it isalso adjusted so that x ≥ ε. These adjusted values of p and μ are used in the subsequent calculation ofthe deviance.
Return type: Numeric
If any of the arguments contains a missing value, or if a wrong number of arguments is supplied, amissing value is returned.
Reference for language elementsVersion 3.3
656
x
Type: Numeric
The argument of the function.
Restriction: x ≥ 0
If the argument is out of range or contains a missing value, a missing value is returned.
mu
Type: Numeric
The distribution mean.
Expected: μ > 0
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
epsilonOptional argument
Type: Numeric
The range correction parameter.
Default: ε = 10-12
Expected: 10-12 < ε < 0.01
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
Example applying correction to the distribution meanConsider the following code and its output:
data example; g1 = deviance("gamma", 0.1, 0.0007, 0.0005); g2 = deviance("gamma", 0.1, 0.0007, 0.0010); g3 = deviance("gamma", 0.1, 0.0007, 0.0015); g4 = deviance("gamma", 0.1, 0.0007 );run;
μ1 = 0.0007μ2 = 0.001μ3 = 0.0015μ4 = 0.0007
g1 = 273.79059545g2 = 188.78965963g3 = 122.93392318g4 = 273.79059545
The value of the distribution mean is not corrected in the first example because μ > ε. However,this condition does not hold in the second and third example, and correction is applied: μ = ε. Thiscorrected value is used for calculation, yielding different results.
Reference for language elementsVersion 3.3
657
In the fourth example the ε parameter is omitted, so the default value of ε = 10-12 is used. Here, as inthe first example, μ > ε, so no correction is required.
Example of invariant scalingConsider the following code and its output:
data example; g1 = deviance("gamma", 0.001, 0.007); g2 = deviance("gamma", 0.01 , 0.07 ); g3 = deviance("gamma", 0.1 , 0.7 );run;
g1 = 6.5255619127g2 = 6.5255619127g3 = 6.5255619127
Due to the nature of the Gamma distribution, when both the point of measurement x and the distributionmean μ are scaled with the same factor, the deviance remains the same.
Deviance of the Gaussian distribution
Returns the deviance of the Gaussian distribution at a given point based on the distribution mean.
DEVIANCE ( "GAUSSIAN" , x , mu )
This function is defined for numeric values only and takes three arguments.
It calculates the deviance, or goodness of fit, for the generalised linear model of the Gaussiandistribution at point x based on the distribution mean μ (mu).
Return type: Numeric
If any of the arguments contains a missing value, or if a wrong number of arguments is supplied, amissing value is returned.
x
Type: Numeric
The argument of the function.
mu
Type: Numeric
The distribution mean.
Reference for language elementsVersion 3.3
658
ExampleConsider the following code and its output:
data example; s1 = deviance("gaussian","4",1); s2 = deviance("gaussian","four",1); s3 = deviance("gaussian",-12.3,0); s4 = deviance("gaussian",1.1,1.1);run;
s1 = 9s2 = .s3 = 151.29s4 = 0
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
Note that when the point of measurement equals the distribution mean, the deviance of the Gaussiandistribution is zero, as shown in the last example.
Example of proportional scalingConsider the following code and its output:
data example; g1 = deviance("gaussian", 0.01, 0.07); g2 = deviance("gaussian", 0.1 , 0.7 ); g3 = deviance("gaussian", 1 , 7 );run;
g1 = 0.0036g2 = 0.36g3 = 36
Due to the nature of the Gaussian distribution, when both the point of measurement x and thedistribution mean μ are scaled with the same factor, the deviance is scaled with the square of thatfactor.
Deviance of the Normal distribution
Returns the deviance of the Normal distribution at a given point based on the distribution mean. Thisfunction is an alias for the Deviance of the Gaussian distribution function.
DEVIANCE ( "NORMAL" , x , mu )
Keyword NORMAL is an alias for GAUSSIAN. Refer to section Deviance of the Gaussian distribution forfurther details.
Return type: Numeric
If any of the arguments contains a missing value, or if a wrong number of arguments is supplied, amissing value is returned.
x
Type: Numeric
The argument of the function.
Reference for language elementsVersion 3.3
659
mu
Type: Numeric
The distribution mean.
Deviance of the Inverse Gaussian distribution
Returns the deviance of the Inverse Gaussian distribution at a given point based on the distributionmean.
DEVIANCE ( "IGAUSS" , x , mu [ , epsilon ] )
This function is defined for numeric values only and takes four arguments.
It calculates the deviance, or goodness of fit, for the generalised linear model of the Inverse Gaussiandistribution at a nonnegative point x based on the distribution mean μ (mu). An optional rangecorrection parameter ε (epsilon) may be specified. If ε > 0.01, it is set equal to 0.01. If it is not specifiedor if ε < 10-12, the value of 10-12 is used for correction. The distribution mean is then adjusted sothat μ ≥ ε. If x ≥ 0, it is also adjusted so that x ≥ ε. These adjusted values of p and μ are used in thesubsequent calculation of the deviance.
Return type: Numeric
If any of the arguments contains a missing value, or if a wrong number of arguments is supplied, amissing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x ≥ 0
If the argument is out of range or contains a missing value, a missing value is returned.
mu
Type: Numeric
The distribution mean.
Expected: μ > 0
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
epsilonOptional argument
Reference for language elementsVersion 3.3
660
Type: Numeric
The range correction parameter.
Default: ε = 10-12
Expected: 10-12 < ε < 0.01
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
Example applying correction to the distribution meanConsider the following code and its output:
data example; g1 = deviance("igauss", 0.01, 0.0007, 0.0005); g2 = deviance("igauss", 0.01, 0.0007, 0.0010); g3 = deviance("igauss", 0.01, 0.0007, 0.0015); g4 = deviance("igauss", 0.01, 0.0007 );run;
μ1 = 0.0007μ2 = 0.001μ3 = 0.0015μ4 = 0.0007
g1 = 17651.020408g2 = 8100g3 = 3211.1111111g4 = 17651.020408
The value of the distribution mean is not corrected in the first example because μ > ε. However,this condition does not hold in the second and third example, and correction is applied: μ = ε. Thiscorrected value is used for calculation, yielding different results.In the fourth example the ε parameter is omitted, so the default value of ε = 10-12 is used. Here, as inthe first example, μ > ε, so no correction is required.
Example of inverted scalingConsider the following code and its output:
data example; g1 = deviance("igauss", 0.01, 0.07); g2 = deviance("igauss", 0.1 , 0.7 ); g3 = deviance("igauss", 1 , 7 );run;
g1 = 73.469387755g2 = 7.3469387755g3 = 0.7346938776
Due to the nature of the Inverse Gaussian distribution, when both the point of measurement x andthe distribution mean μ are scaled with the same factor, the deviance is scaled with the inverse of thisfactor.
Reference for language elementsVersion 3.3
661
Deviance of the the Wald distribution
Returns the deviance of the the Wald distribution at a given point based on the distribution mean. Thisfunction is an alias for the Deviance of the Inverse Gaussian distribution function.
DEVIANCE ( "WALD" , x , mu [ , epsilon ] )
Keyword WALD is an alias for IGAUSS. Refer to section Deviance of the Inverse Gaussian distributionfor further details.
Return type: Numeric
If any of the arguments contains a missing value, or if a wrong number of arguments is supplied, amissing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x ≥ 0
If the argument is out of range or contains a missing value, a missing value is returned.
mu
Type: Numeric
The distribution mean.
Expected: μ > 0
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
epsilonOptional argument
Type: Numeric
The range correction parameter.
Default: ε = 10-12
Expected: 10-12 < ε < 0.01
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
Reference for language elementsVersion 3.3
662
Deviance of the Poisson distribution
Returns the deviance of the Poisson distribution at a given point based on the distribution mean.
DEVIANCE ( "POISSON" , x , mu [ , epsilon ] )
This function is defined for numeric values only and takes four arguments.
It calculates the deviance, or goodness of fit, for the generalised linear model of the Poisson distributionat a nonnegative point x based on the distribution mean μ (mu). An optional range correction parameterε (epsilon) may be specified. If ε > 0.01, it is set equal to 0.01. If it is not specified or if ε < 10-12, thevalue of 10-12 is used for correction. The distribution mean is then adjusted so that μ ≥ ε. This adjustedvalue of μ is used in the subsequent calculation of the deviance.
Return type: Numeric
If any of the arguments contains a missing value, or if a wrong number of arguments is supplied, amissing value is returned.
x
Type: Numeric
The argument of the function.
Restriction: x ≥ 0
If the argument is out of range or contains a missing value, a missing value is returned.
mu
Type: Numeric
The distribution mean.
Expected: μ > 0
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
epsilonOptional argument
Type: Numeric
The range correction parameter.
Default: ε = 10-12
Expected: 10-12 < ε < 0.01
Reference for language elementsVersion 3.3
663
Deprecated feature (may be removed in future): All other values are corrected to fall within theexpected range.
Example applying correction to the distribution meanConsider the following code and its output:
data example; g1 = deviance("poisson", 0.1, 0.0007, 0.0005); g2 = deviance("poisson", 0.1, 0.0007, 0.0010); g3 = deviance("poisson", 0.1, 0.0007, 0.0015); g4 = deviance("poisson", 0.1, 0.0007 );run;
μ1 = 0.0007μ2 = 0.001μ3 = 0.0015μ4 = 0.0007
g1 = 0.793769026g2 = 0.7230340372g3 = 0.6429410156g4 = 0.793769026
The value of the distribution mean is not corrected in the first example because μ > ε. However,this condition does not hold in the second and third example, and correction is applied: μ = ε. Thiscorrected value is used for calculation, yielding different results.In the fourth example the ε parameter is omitted, so the default value of ε = 10-12 is used. Here, as inthe first example, μ > ε, so no correction is required.
Example of parallel scalingConsider the following code and its output:
data example; g1 = deviance("poisson", 0.01, 0.07); g2 = deviance("poisson", 0.1 , 0.7 ); g3 = deviance("poisson", 1 , 7 );run;
g1 = 0.081081797g2 = 0.8108179702g3 = 8.1081797019
Due to the nature of the Poisson distribution, when both the point of measurement x and the distributionmean μ are scaled with the same factor, the deviance is scaled with the same factor too.
Argument evaluation functionsFunctions that evaluate argument properties.
COALESCE Returns the first non-missing value in a list of numeric values.IFN Returns a specified result based on a control condition.WHICHN Returns the position of a specified argument in a list of numeric or missing values.CALL SORTN Sorts the values in a list of numeric variables in ascending order.
Reference for language elementsVersion 3.3
664
COALESCE
Returns the first non-missing value in a list of numeric values.
COALESCE ( { value , … } )
This function is defined for numeric values only.
Return type: Numeric
If all values are missing, a missing value is returned.
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; a = coalesce("four",.,"4",1,-2,3,.,"");run;
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. Thus the output is 4.
IFN
Returns a specified result based on a control condition.
IFN ( condition , true-result , false-result [ , missing-result ] )
This function is defined for numeric values only. It evaluates a control variable condition, and returnsone of three specified values: true-result if condition is non-zero, false-result if it is zero, or missing-result if condition contains a missing value. If the argument missing-result is omitted, it is consideredmissing.
Note:The variable condition is numeric, so any logical expressions used to determine its value, have to returna number upon evaluation.
Return type: Numeric
condition
Type: Numeric
The control condition.
Reference for language elementsVersion 3.3
665
true-result
Type: Numeric
The value to return if the control condition evaluates to true.
false-result
Type: Numeric
The value to return if the control condition evaluates to false.
missing-resultOptional argument
Type: Numeric
The value to return if the control condition evaluates to missing.
ExampleConsider the following code and its output:
data example; a1 = ifn("4",1,0,13); a2 = ifn("four",1,0,13); a3 = ifn("four",1,0); a4 = ifn(0,1,0,13);run;
a1 = 1a2 = 13a3 = .a4 = 0
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
WHICHN
Returns the position of a specified argument in a list of numeric or missing values.
WHICHN ( argument , { value , … } )
This function is defined for numeric values only. This function searches for the value of argument inthe list of values that follow it, including missing values. If a value equal to argument is encountered, itsindex in the value list is returned, otherwise 0 is returned.
Return type: Numeric
argument
Type: Numeric
The value to look for in the list that follows.
If the argument contains a missing value, a missing value is returned.
Reference for language elementsVersion 3.3
666
value
Type: Numeric
The value(s) to be evaluated.
Note:Here positions of all values are counted, including missing values.
ExampleConsider the following code and its output:
data example; n1 = whichn("4", 1,2,3,4,5); n2 = whichn("four", 1,2,3,4,5); n3 = whichn(4.1, 1,2,3,4,5); n4 = whichn(4, 1,.,2,3,4,5);run;
n1 = 4n2 = .n3 = 0n4 = 5
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing.
The third example returns 0 because value 4.1 is not found in the value list. Note that the fourthexample returns a different value than the first one because the missing value in the list is countedalong with non-missing values.
CALL SORTN
Sorts the values in a list of numeric variables in ascending order.
CALL SORTN ( [ { x , … } ] );
This call routine is defined for numeric values only. Numeric and missing values in the variables given inthe argument list are sorted in ascending order and re-assigned to these variables. Missing values areconsidered smaller than any non-missing values.
xOptional argument
Type: Numeric
The argument of the function.
Reference for language elementsVersion 3.3
667
ExampleConsider the following code and its output:
data example; s1=0; s2=-1.1; s3=6.5; s4="4"; call sortn (s1,s2,s3,s4); put s1= s2= s3= s4=; output;
m1=0; m2=-1.1; m3=-6.5; m4="four"; call sortn (m1,m2,m3,m4); put m1= m2= m3= m4=; output;run;
s1 = -1.1s2 = 0s3 = 4s4 = 6.5
m1 = .m2 = -1.1m3 = 0m4 = 6.5
The argument value "4" has been converted into a number, but the argument value "four" isconsidered missing. The sort order is adjusted accordingly, starting with the missing value.
NLS functions and call routines
ENCODCOMPAT
ENCODCOMPAT ( encoding-name1 [ , encoding-name2 ] )
Return type: Numeric
encoding-name1
Type: Character
encoding-name2Optional argument
Type: Character
ENCODISVALID
ENCODISVALID ( encoding-name )
Return type: Numeric
Reference for language elementsVersion 3.3
668
encoding-name
Type: Character
GETLOCENV
GETLOCENV ( )
Return type: Character
GETPXLANGUAGE
GETPXLANGUAGE ( )
Return type: Character
GETPXLOCALE
GETPXLOCALE ( [ , locale-name ] )
Return type: Character
locale-nameOptional argument
Type: Character
GETPXREGION
GETPXREGION ( )
Return type: Character
Reference for language elementsVersion 3.3
669
NLDATE
NLDATE ( dt_arg , format_string )
Return type: Character
dt_arg
Type: Numeric
format_string
Type: Character
NLDATM
NLDATM ( dtm_arg , format_string )
Return type: Character
dtm_arg
Type: Numeric
format_string
Type: Character
NLTIME
NLTIME ( dtime_arg , format_string )
Return type: Character
dtime_arg
Type: Numeric
Reference for language elementsVersion 3.3
670
format_string
Type: Character
Probability functions and call routines
BETAINV
BETAINV ( percentile , argument-1 , argument-2 )
Return type: Numeric
percentile
Type: Numeric
argument-1
Type: Numeric
argument-2
Type: Numeric
CDF functionsCDF function, split by distribution type.
BERNOULLI Distribution
CDF ( "BERNOULLI" , x , p )
Return type: Numeric
x
Type: Numeric
Reference for language elementsVersion 3.3
671
p
Type: Numeric
BETA Distribution
CDF ( "BETA" , x , alpha , beta , [ lower ] [ , upper ] )
Return type: Numeric
x
Type: Numeric
alpha
Type: Numeric
beta
Type: Numeric
lowerOptional argument
Type: Numeric
upperOptional argument
Type: Numeric
BINOMIAL Distribution
CDF ( "BINOMIAL" , m , p , beta )
Return type: Numeric
m
Type: Numeric
Reference for language elementsVersion 3.3
672
p
Type: Numeric
beta
Type: Numeric
CAUCHY Distribution
CDF ( "CAUCHY" , x , [ theta ] [ , lambda ] )
Return type: Numeric
x
Type: Numeric
thetaOptional argument
Type: Numeric
lambdaOptional argument
Type: Numeric
CHISQUARED Distribution
CDF ( "CHISQUARED" , x , df )
Return type: Numeric
x
Type: Numeric
df
Type: Numeric
Reference for language elementsVersion 3.3
673
EXPONENTIAL Distribution
CDF ( "EXPONENTIAL" , x [ , lambda ] )
Return type: Numeric
x
Type: Numeric
lambdaOptional argument
Type: Numeric
F Distribution
CDF ( "F" , x , df1 , df2 )
Return type: Numeric
x
Type: Numeric
df1
Type: Numeric
df2
Type: Numeric
GAMMA Distribution
CDF ( "GAMMA" , x , alpha [ , lambda ] )
Return type: Numeric
Reference for language elementsVersion 3.3
674
x
Type: Numeric
alpha
Type: Numeric
lambdaOptional argument
Type: Numeric
GAUSSIAN Distribution
CDF ( "GAUSSIAN" , x , [ mu ] [ , lambda ] )
Return type: Numeric
x
Type: Numeric
muOptional argument
Type: Numeric
lambdaOptional argument
Type: Numeric
GEOMETRIC Distribution
CDF ( "GEOMETRIC" , x , p )
Return type: Numeric
x
Type: Numeric
Reference for language elementsVersion 3.3
675
p
Type: Numeric
GUMBEL Distribution
CDF ( "GUMBEL" , x , [ offset ] [ , scale ] )
Return type: Numeric
x
Type: Numeric
offsetOptional argument
Type: Numeric
scaleOptional argument
Type: Numeric
HYPERGEOMETRIC Distribution
CDF ( "HYPERGEOMETRIC" , x , p , k , n )
Return type: Numeric
x
Type: Numeric
p
Type: Numeric
k
Type: Numeric
Reference for language elementsVersion 3.3
676
n
Type: Numeric
IGAUSS Distribution
CDF ( "IGAUSS" , x , d )
Return type: Numeric
x
Type: Numeric
d
Type: Numeric
JOHNSON SB Distribution
CDF ( "JOHNSON SB" , x , delta , gamma , [ scale ] [ , offset ] )
Return type: Numeric
x
Type: Numeric
delta
Type: Numeric
gamma
Type: Numeric
scaleOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
677
offsetOptional argument
Type: Numeric
JOHNSON SU Distribution
CDF ( "JOHNSON SU" , x , delta , gamma , [ scale ] [ , offset ] )
Return type: Numeric
x
Type: Numeric
delta
Type: Numeric
gamma
Type: Numeric
scaleOptional argument
Type: Numeric
offsetOptional argument
Type: Numeric
LAPLACE Distribution
CDF ( "LAPLACE" , x , [ theta ] [ , lambda ] )
Return type: Numeric
x
Type: Numeric
Reference for language elementsVersion 3.3
678
thetaOptional argument
Type: Numeric
lambdaOptional argument
Type: Numeric
LOGISTIC Distribution
CDF ( "LOGISTIC" , x , [ theta ] [ , lambda ] )
Return type: Numeric
x
Type: Numeric
thetaOptional argument
Type: Numeric
lambdaOptional argument
Type: Numeric
LOGNORMAL Distribution
CDF ( "LOGNORMAL" , x , [ theta ] [ , lambda ] )
Return type: Numeric
x
Type: Numeric
thetaOptional argument
Reference for language elementsVersion 3.3
679
Type: Numeric
lambdaOptional argument
Type: Numeric
NEGBINOMIAL Distribution
CDF ( "NEGBINOMIAL" , m , p , beta )
Return type: Numeric
m
Type: Numeric
p
Type: Numeric
beta
Type: Numeric
NORMAL Distribution
CDF ( "NORMAL" , x , [ mu ] [ , lambda ] )
Return type: Numeric
x
Type: Numeric
muOptional argument
Type: Numeric
lambdaOptional argument
Reference for language elementsVersion 3.3
680
Type: Numeric
NORMALMIX Distribution
CDF ( "NORMALMIX" , x , n , { p-m-x , … } )
Return type: Numeric
x
Type: Numeric
n
Type: Numeric
p-m-x
Type: Numeric
PARETO Distribution
CDF ( "PARETO" , x , alpha [ , lambda ] )
Return type: Numeric
x
Type: Numeric
alpha
Type: Numeric
lambdaOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
681
POISSON Distribution
CDF ( "POISSON" , n , m )
Return type: Numeric
n
Type: Numeric
m
Type: Numeric
POWER Distribution
CDF ( "POWER" , x , alpha [ , scale ] )
Return type: Numeric
x
Type: Numeric
alpha
Type: Numeric
scaleOptional argument
Type: Numeric
T Distribution
CDF ( "T" , x , df )
Return type: Numeric
Reference for language elementsVersion 3.3
682
x
Type: Numeric
df
Type: Numeric
UNIFORM Distribution
CDF ( "UNIFORM" , x , [ lower ] [ , upper ] )
Return type: Numeric
x
Type: Numeric
lowerOptional argument
Type: Numeric
upperOptional argument
Type: Numeric
WALD Distribution
CDF ( "WALD" , x , d )
Return type: Numeric
x
Type: Numeric
d
Type: Numeric
Reference for language elementsVersion 3.3
683
WEIBULL Distribution
CDF ( "WEIBULL" , x , a [ , lambda ] )
Return type: Numeric
x
Type: Numeric
a
Type: Numeric
lambdaOptional argument
Type: Numeric
CINV
CINV ( probability , shape [ , result ] )
Return type: Numeric
probability
Type: Numeric
shape
Type: Numeric
resultOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
684
FINV
FINV ( probability , num-degree-of-freedom , degree-of-freedom [ , non-centrality ] )
Return type: Numeric
probability
Type: Numeric
num-degree-of-freedom
Type: Numeric
degree-of-freedom
Type: Numeric
non-centralityOptional argument
Type: Numeric
GAMINV
GAMINV ( probability , degree-of-freedom )
Return type: Numeric
probability
Type: Numeric
degree-of-freedom
Type: Numeric
LOGCDF
LOGCDF ( dist , quantile [ , { parameter-n , … } ] )
Reference for language elementsVersion 3.3
685
Return type: Numeric
dist
Type: Character
quantile
Type: Numeric
parameter-nOptional argument
Type: Numeric
LOGPDF
LOGPDF ( dist , quantile [ , { parameter-n , … } ] )
Can also be expressed as:
LOGPMF ( dist , quantile [ , { parameter-n , … } ] )
Return type: Numeric
dist
Type: Character
quantile
Type: Numeric
parameter-nOptional argument
Type: Numeric
LOGSDF
LOGSDF ( dist , quantile [ , { parameter-n , … } ] )
Return type: Numeric
Reference for language elementsVersion 3.3
686
dist
Type: Character
quantile
Type: Numeric
parameter-nOptional argument
Type: Numeric
PDF ( distribution , quantile [ , { parameter-n , … } ] )
Can also be expressed as:
PMF ( distribution , quantile [ , { parameter-n , … } ] )
Return type: Numeric
distribution
Type: Character
quantile
Type: Numeric
parameter-nOptional argument
Type: Numeric
POISSON
POISSON ( x , mu )
Return type: Numeric
Reference for language elementsVersion 3.3
687
x
Type: Numeric
mu
Type: Numeric
PROBBETA
PROBBETA ( x , a , b )
Return type: Numeric
x
Type: Numeric
a
Type: Numeric
b
Type: Numeric
PROBBNML
PROBBNML ( p , n , k )
Return type: Numeric
p
Type: Numeric
n
Type: Numeric
k
Type: Numeric
Reference for language elementsVersion 3.3
688
PROBBNRM
PROBBNRM ( x , y , rho )
Return type: Numeric
x
Type: Numeric
y
Type: Numeric
rho
Type: Numeric
PROBCHI
PROBCHI ( x , k [ , nc ] )
Return type: Numeric
x
Type: Numeric
k
Type: Numeric
ncOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
689
PROBF
PROBF ( x , df1 , df2 [ , nc ] )
Return type: Numeric
x
Type: Numeric
df1
Type: Numeric
df2
Type: Numeric
ncOptional argument
Type: Numeric
PROBGAM
PROBGAM ( x , alpha )
Return type: Numeric
x
Type: Numeric
alpha
Type: Numeric
PROBHYPR
PROBHYPR ( Np , m , n , x [ , r ] )
Reference for language elementsVersion 3.3
690
Return type: Numeric
Np
Type: Numeric
m
Type: Numeric
n
Type: Numeric
x
Type: Numeric
rOptional argument
Type: Numeric
PROBIT
PROBIT ( p )
Return type: Numeric
p
Type: Numeric
PROBNEGB
PROBNEGB ( p , k , r )
Return type: Numeric
p
Type: Numeric
Reference for language elementsVersion 3.3
691
k
Type: Numeric
r
Type: Numeric
PROBNORM
PROBNORM ( x )
Return type: Numeric
x
Type: Numeric
PROBT
PROBT ( x , df [ , nc ] )
Return type: Numeric
x
Type: Numeric
df
Type: Numeric
ncOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
692
QUANTILE
QUANTILE ( distribution , p [ , { parameter-n , … } ] )
Return type: Numeric
distribution
Type: Character
p
Type: Numeric
parameter-nOptional argument
Type: Numeric
SDF
SDF ( distribution , quantile [ , { parameter-n , … } ] )
Return type: Numeric
distribution
Type: Character
quantile
Type: Numeric
parameter-nOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
693
TINV
TINV ( probability , degree-of-freedom [ , nc ] )
Return type: Numeric
probability
Type: Numeric
degree-of-freedom
Type: Numeric
ncOptional argument
Type: Numeric
Regular expression functions and call routinesFunctions and call routines that enable the use of regular expressions.
The regular expression functions and CALL routines enable you to find and manipulate strings usingregular expressions. You can find and replace characters and strings using these functions with theflexibility of pattern-matching provided by regular expressions. The regular expression functionalityprovided in these functions and call routines is based on the Perl regular expression syntax.
In many of the functions and CALL routines the regular expression can be specified in two ways:
• Explicity within the function or CALL; for example, prxmatch('/(Limited)|(LTD)|(Ltd)+/',lr)
• As a compiled regular expression selected by an identifier. Regular expressions can be compiledusing the PRXPARSE function, which generates an identifer that can be used in other functions andCALL routines. For example,
rxid=prxparse('/([Oo]range)|([Aa]pple)|([Bb]anana)|([Gg]rapefruit)/');
would compile the regular expression and return an identifier to rxid. The identifier for that regularexpression could then be used in another function or CALL routine. For example:
rxm = prxmatch(rxid,'Banana, Ghana, 3.6, Grapefruit');
Reference for language elementsVersion 3.3
694
If the regular expressions are explicitly specified, the source code is easier to read as you can see thestructure of regular expressions wherever they occur. However, if regular expressions are specified inthis way they will be processed and compiled everything they are encountered. If a regular expressionis commonly used, or used to manipulate multiple observations, explicit specification might lead tounacceptable processing costs as it is compiled many time.
If you use PRXPARSE to compile a regular expression, other functions and CALL routines can refer tothat compiled expression through an identifier. If that regular expression is required, again referencecan be made to the identifier, saving time required for compilation.
PRXCHANGEReplace a substring with another using a regular expression.
PRXCHANGE ( regex-or-id , times , source )
Replaces a substring in a source string with another substring using a regular expressions. Thisfunction returns the modified source string. For example, if your data contains details of companies, the'Limited' in their name might be represented in various ways, such as 'Limited', 'LTD', or 'Ltd.', that youmight prefer to represent simply as 'Ltd'. This function enables you to do this.
Return type: Character
regex-or-id
Type: Character or numeric value
A regular expression, or an identifier generated by the PRXPARSE function (which generates anidentifier for a compiled regular expression).
times
Type: Numeric
The number of matching patterns in the string to be replaced. Use -1 to replace all matchingpatterns. If you specify 0, no matching patterns are replaced.
source
Type: Character
The string to be modified.
Reference for language elementsVersion 3.3
695
ExampleIn the following example, observations are searched for the word Bike. The result is written to the logand to the example dataset.
data example; INFILE DATALINES END=LASTOBS; input a $50.; name = right(a); if _N_ = 1 then do; rxid=prxparse('s/Bike/Bicycle/'); retain rxid; end; xc=prxchange(rxid,-1, name); result=left(xc); put result; if LASTOBS then call prxfree(id); datalines; Magnificent Bike Company Limited London Bike LTD. Old Penny Farthing Ltd Racing Bikes of Reading and London Lmtd. ;
This produces the following output:
Magnificent Bicycle Company (Bicycles) LimitedMagnificent Bicycle Company (Misc.) LimitedLondon Bicycle Limited.Old Penny Farthing LtdRacing Bicycles of Reading and London Lmtd.
PRXMATCHMatch a pattern using a regular expression.
PRXMATCH ( regex-or-id , source )
Performs a pattern-match on source using a regular expression. For example, if your data containsdetails of companies, you might want to find all names with variations on Limited, such as Limited, LTD,or Ltd.
The function returns the position of the first character that matches the search; if no match is found, 0 isreturned.
Return type: Numeric
regex-or-id
Type: Character or numeric value
A regular expression, or an identifier generated by the PRXPARSE function (which generates anidentifier for a compiled regular expression).
Reference for language elementsVersion 3.3
696
source
Type: Character
The source string.
ExampleIn the following example, observations are searched for strings similar to Limited, such as LTD adLtd,and returns the first position in the observation at which it was found. The result is written to the logand to the example dataset.
data example; INFILE DATALINES; input a $45.; if _N_ = 1 then do; put "The positions of the matching strings are:"; end; lr=trim(a); xm=prxmatch('/(Limited)|(LTD)|(Ltd)+/', lr); put xm;datalines;Magnificent Bikes Company Magnificent Bikes (Subs) LimitedLondon Bike LTD.Old Penny Farthing Inc.Racing Bikes of Reading and London Limited.;
This produces the following output:
The positions of the matching strings are:02613036
PRXPARENReturn which string in a list occurs in a specified string.
PRXPAREN ( regex-id )
Searches the source string supplied to the last PRXMATCH for one of a list of parenthesised searchstrings in a regular expression, and returns the position of the first matching parenthesised element .For example, you might want to find which of the strings Sugar, Banana, Wheat, and Coconut occursin a source string; this function enables you to do that. It returns the ordinal position of the first stringin the list that matches text in the source. In this example, if the regular expression listed the searchpatterns in the order shown above, and the string to be searched was Banana, Ghana, 3.6, thefunction would return 2, as the first string to be found is Banana which is at position two in the list.
Reference for language elementsVersion 3.3
697
Return type: Numeric
regex-id
Type: Numeric
A regular expression identifier generated by the PRXPARSE function (which generates anidentifier for a compiled regular expression).
This function must be used with the PRXPARSE function, which generates the identifier for a compiledregular expression, and with the PRXMATCH function.
Note:The regular expression must be a search for parenthesised strings separated by the OR ( | )symbol forthe function to return the correct result; otherwise 0 is returned. Using the example above, the regularexpression would need to be specified as /(Sugar)|(Banana)|(Wheat)|(Coconut)/.
Basic ExampleIn the following example, PRXPARSE is used to generate an identifier for a parsed regular expression,and this is passed to the PRXPAREN function. The result is written to the log and to the exampledataset.
data example; rxid = prxparse('/([Oo]range)|([Aa]pple)|([Bb]anana)|([Gg]rapefruit)/'); result=prxparen(rxid); put "The result is: " result;run;
This produces the following output:
The result is: .
The output contains the missing value (.) as PRXPAREN had no result from a previous PRXMATCH.
Using PXRMATCHIn the following example PRXPARSE is used to generate an identifier for a parsed regular expression,and this is passed to both the PRXMATCH and PRXPAREN functions. The result is written to the log andto the example dataset.
data _null_; rxid = prxparse('/([Oo]range)|([Aa]pple)|([Bb]anana)|([Gg]rapefruit)/'); rxm = prxmatch(rxid,'Banana, Ghana, 3.6, Grapefruit'); result = prxparen(rxid); put "The result of the PRXMATCH is: " rxm; put "The result of the PRXPAREN is: " result;run;
This produces the following output:
The result of the PRXMATCH is: 1The result of the PRXPAREN is: 3
Reference for language elementsVersion 3.3
698
In the PRXMATCH function, the string Banana matches Banana in the source at the first position,so rxm is set to 1. The function has also read the source string into memory, enabling PRXPARENto operate on it using the regular expression. PRXPAREN returns 3, as Banana in the source stringmatches the third search string (counting from the left) in the regular expression. Only the firstoccurrence of a search string is found, so the match with Grapefruit in the source string is ignored.
PRXPARSECompile a regular expression for use with other functions.
PRXPARSE ( regex )
Compiles a regular expression for use by other functions or CALL routines that require regularexpressions. This function returns an identifier that provides the location of the compiled expressionthat can then be supplied in place of a regular expression. The returned identifier can be used as manytimes as required until cleared using CALL PRXFREE.
Each invocation of this function returns a different identifier that is unique to the regular expressioncompiled by the function; typically, this identifier is a number that increases by one for each invocation.
For some of the regular-expression functions, such as PRXPAREN, an identifier must be supplied, ratherthan a regular expression.
Return type: Numeric
regex
Type: Character
The regular expression to be interpeted.
Basic exampleIn the following example, the regular expressions are interpreted and identifiers created for them, whichcan be used in other functions. The result is written to the log and to the example dataset.
data example; rxid1 = prxparse('/(Banana)|(Orange)|(Apple)|(Grapefruit)/'); rxid2 = prxparse('/(Wheat)|(Barley)|(Maize)|(Sorghum)/'); put "The regular expression identifier is: " rxid1; put "The regular expression identifier is: " rxid2;run;
This produces the following output:
The regular expression identifier is: 1The regular expression identifier is: 2
Reference for language elementsVersion 3.3
699
Example – creating identifier for use by another functionIn the following example, an identifier is created for a regular expression, which is then passed to thePRXCHANGE function. The result is written to the log and to the example dataset.
data example; INFILE DATALINES END=LASTOBS; input a $50.; name = right(a); if _N_ = 1 then do; rxid=prxparse('s/Bike/Bicycle/'); retain rxid; end; xc=prxchange(rxid,-1, name); result=left(xc); put result; if LASTOBS then call prxfree(id);datalines;Magnificent Bike Company LimitedLondon Bike LTD.Old Penny Farthing LtdRacing Bikes of Reading and London Lmtd.;
The regular expression searches a source string for the string Bike and then exchanges them forthe text Bicycle. The expression is interpreted by PRXPARSE, and an identifier for it is created. Theidentifier is then used in the PRXCHANGE function; the regular expression is evaluated as if it had beenentered into the function.
This produces the following output:
Magnificent Bicycle Company LimitedLondon Bicycle LTD.Old Penny Farthing LtdRacing Bicycles of Reading and London Lmtd.
PRXPOSNReturn the contents of a Perl-style capture buffer.
PRXPOSN ( regex-id , capture-buffer , source )
Returns the contents of a specified Perl-style capture buffer; the substrings to be found and the capturebuffers are defined using a regular expression. Before you call PRXPOSN to obtain the text contents ofthe capture buffers:
• Compile the regular expression using the PRXPARSE function, which returns an identifier that can beused by this function.
• Call PRXMATCH, using the regular expression identifier supplied by PRPARSE, to obtain the textcontents of the capture buffers, and establish their locations and lengths.
Reference for language elementsVersion 3.3
700
The string source does not have to be the same as the string previously provided to PRXMATCH. ThePRXMATCH parameter could be used to find the locations of keywords in a sample string, and PRXPOSNcould then be used to extract text from the same position in different strings.
Return type: Character
regex-id
Type: Numeric
A regular expression identifier.
capture-buffer
Type: Numeric
The index number of a capture-buffer. Capture buffers are numbered from 1 to however manyhave been defined in the regular expression. Capture buffer 0 (zero) contains all strings in allcapture buffers.
source
Type: Character
The source string to be examined by the regular expression.
Basic exampleIn the following example, the regular expression is interpreted and an identifier created for it usingPRXPARSE. The identifier is used in the PRXPOSN function. The result is written to the log and to theexample dataset.
data example; a="Magnificent Bike Company (Misc) Limited"; id=prxparse('/((Bike) (Company)) (\(Misc\))/'); match = prxmatch(id,a); result0 = prxposn(id,0,a); result1 = prxposn(id,1,a); result2 = prxposn(id,2,a); result3 = prxposn(id,3,a); result4 = prxposn(id,4,a); put result0; put result1; put result2; put result3; put result4;run;
This produces the following output:
Bike Company (Misc)Bike CompanyBikeCompany(Misc)
Reference for language elementsVersion 3.3
701
The PRXPOSN function uses the positions of the substrings generated by PRXMATCH to identify thesubstrings. In the example, PUT is used to write the strings found in each capture buffer, includingcapture buffer 0, which contains all the strings. The order in which the strings are assigned to capturebuffers depends on the bracketing.
Example – different strings in PRXMATCH and PRXPOSNIn the following example, the regular expression is interpreted and an identifier created for it usingPRXPARSE. The identifier is used in the PRXMATCH function match identify the position and length ofthe strings in the capture buffers. The positions are then used in PRXPOSN to return strings at thosepositions with those lengths. The result is written to the log and to the example dataset.
data example; a="Magnificent Bike Company (Misc) Limited"; id=prxparse('/((Bike) (Company)) (\(Misc\))/'); match = prxmatch(id,a); result0 = prxposn(id,0,a); result1 = prxposn(id,1,a); result2 = prxposn(id,0,'Magnificent Cars Company (Misc) Limited'); result3 = prxposn(id,0,'Magnificent Tiger Company (Misc) Limited'); result4 = prxposn(id,2,'Magnificent Tiger Company (Misc) Limited'); put result0; put result1; put result2; put result3; put result4;run;
This produces the following output:
Bike Company (Misc)Bike CompanyCars Company (Misc)Tiger Company (MiscTige
The PRXPOSN function uses the positions of the substrings generated by PRXMATCH to identify thesubstrings. In the example, PUT is used to write the strings found in capture buffers 0 and 1 for thestring supplied to PRXMATCH. The locations found by the regular expression in the PRXMATCH are thenapplied to different strings in subsequent lines. Because the word Tiger is longer than Bike, theinformation returned is truncated to match the length of the capture buffer.
CALL PRXCHANGEFind and replace strings using a regular expression.
CALL PRXCHANGE ( regex-id , times , old-string , [ new-string ] , [ result-length ] , [ result-truncated ] [ , number-of-changes ] );
Reference for language elementsVersion 3.3
702
Finds a substring in a source string and replaces it using regular expressions, and then returns theresult. For example, if your data contains details of companies, the Limited in their name might berepresented in various ways, such as Limited, LTD, or Ltd., that you might prefer to represent simply asLtd. You could use this function to make such a change. This call routine is similar to the PRXCHANGEfunction.
regex-id
Type: Numeric
A regular expression identifier generated by the PRXPARSE function (which generates anidentifier for a compiled regular expression).
times
Type: Numeric
The number of matching patterns in the string to be replaced. Use -1 to replace all matchingpatterns. If you specify 0, no matching patterns are replaced.
old-string
Type: Character
The source string to be modified.
new-stringOptional argument
Type: Character
A value returned by the CALL. The resulting string after modification by the regular expression.
result-lengthOptional argument
Type: Numeric
A value returned by the CALL. The length of the modified string.
result-truncatedOptional argument
Type: Numeric
A value returned by the CALL. A flag indicating whether or not new-string was truncated to fit thelength specified for it. The flag is set to 1 if new-string has been truncated, 0 otherwise.
number-of-changesOptional argument
Type: Numeric
A value returned by the CALL. The number of changes made to old-string to create new-string.
Reference for language elementsVersion 3.3
703
ExampleIn the following example, observations are searched for the word Bike, which are replaced withBicycle in all cases. The result is written to the log and to the example dataset.
data example; INFILE DATALINES END=LASTOBS; input a $50.; length ns $40; if _N_ = 1 then do; rxid=prxparse('s/Bike/Bicycle/'); retain rxid; end; call prxchange(1, -1, a, ns, rl, rt, noc); put ns " " rl " " rt " " noc; if LASTOBS then call prxfree(id);datalines;Magnificent Bike Company (Bikes) LimitedMagnificent Bike Company (Misc.) LimitedLondon Bike Limited.Old Penny Farthing LtdRacing Bikes of Reading and London Lmtd.;
This produces the following output:
Magnificent Bicycle Company (Bicycles) L 40 1 2Magnificent Bicycle Company (Misc.) Limi 40 1 1London Bicycle Limited. 23 0 1Old Penny Farthing Ltd 22 0 0Racing Bicycles of Reading and London Lm 40 1 1
In this example, -1 has been specified for the times argument, which means all matching patterns willbe replaced. In the first result, therefore, Bike has been replaced with Bicycle twice (as shown by the2 returned in nt. In the first two results and the last result, replacing Bike with Bicycle has resultedin a string longer than the length specification for that string. The value 1 has therefore been returned inrt. In the third and fourth results, the string after substitution is shorter than the length specification; 0is therefore returned in rt.
CALL PRXDEBUGSwitch on debugging for regular expressions.
CALL PRXDEBUG ( on-off );
Switches on and off debugging for regular expressions. If switched on, messages are written to the logabout the operation of regular expression functions.
on-off
Type: Numeric
Reference for language elementsVersion 3.3
704
An integer that switches on or off regular expression debugging. 0 switches debugging off; anyother value switches it on.
ExampleIn the following example, the regular expressions are compiled and identifiers created for each of them,which can then be used in other functions. The result is written to the log and to the example dataset.
data example; INFILE DATALINES END=LASTOBS; input a $50.; length ns $50; call prxdebug(1); if _N_ = 1 then do; rxid=prxparse('s/Bike/Bicycle/'); retain rxid; end; rxid=prxparse('s/Bike/Car/'); call prxchange(1, -1, a, ns, rl, rt, noc); put ns " " rl " " rt " " noc; if LASTOBS then call prxfree(id);datalines;Magnificent Bike Company (Bikes) LimitedMagnificent Bike Company (Misc.) LimitedLondon Bike LTD.Old Penny Farthing LtdRacing Bikes of Reading and London Lmtd.;
CALL PRXDEBUG is set to 1, so debugging is switched on. Debugging messages are returned to the logfor each record; in this example, each series of messages is followed by the results written to the log bythe PUT statement.
This produces the following messages and output for the first input record for this example:
PRXDEBUG: CALL PRXDEBUG:PRXDEBUG: Regular expression debug setting set to ON
PRXDEBUG: PRXPARSE:PRXDEBUG: Parsing Regular expression s/Bike/Car/PRXDEBUG: Compiling regular expression pattern BikePRXDEBUG: Replacement text is: CarPRXDEBUG: Delimiter is: /PRXDEBUG: Compilation successfulPRXDEBUG: Regular expression successfully parsed
PRXDEBUG: CALL PRXCHANGE:PRXDEBUG: Retrieving Parsed Regular Expression from ID: 1PRXDEBUG: Retrieved Parsed Regular ExpressionPRXDEBUG: Replacing in 'Magnificent Bike Company (Bikes) Limited' every time it occursPRXDEBUG: Result is 'Magnificent Car Company (Cars) Limited 'Magnificent Car Company (Cars) Limited 38 0 2
Reference for language elementsVersion 3.3
705
CALL PRXFREEFree a regular expression identifier.
CALL PRXFREE ( regex-id );
Frees a specified regular expression identifier of its current regular expression. This effectively clearsthe regular expression from memory; any further call to that identifier by a regular expression function orcall routine will result in an error until the identifier is reassigned by a later invocation of PRXPARSE.
regex-id
Type: Numeric
A regular expression identifier.
Basic exampleIn the following example, the regular expression is compiled and an identifier created using PRXPARSE.The identifier is used in the CALL PRXCHANGE function. The CALL PRXFREE option is then used tofree the regular expression identifier.
data example; INFILE DATALINES END=LASTOBS; input a $50.; length ns $50; if _N_ = 1 then do; retain id; id=prxparse('s/Bike/Car/'); end; call prxchange(id, -1, a, ns, rl, rt, noc); put ns " " rl " " rt " " noc; if LASTOBS then call prxfree(id);datalines;Magnificent Bike Company (Bikes) LimitedMagnificent Bike Company (Misc.) LimitedLondon Bike LTD.Old Penny Farthing LtdRacing Bikes of Reading and London Lmtd.;
Reference for language elementsVersion 3.3
706
Example – error returned because identifier prematurely freedIn the following example, the regular expression is compiled and an identifier created when thefirst observation in the dataset is read. The CALL PRXFREE option is then used to free the regularexpression identifier before the CALL PRXCHANGE function is called for the next observation; the CALLPRXCHANGE does not, therefore, have a valid value for its identifier.
data example; INFILE DATALINES END=LASTOBS; input a $50.; length ns $50; if _N_ = 1 then do; retain id; id=prxparse('s/Bike/Car/'); end; call prxchange(1, -1, a, ns, rl, rt, noc); put ns " " rl " " rt " " noc; call prxfree(id);datalines;Magnificent Bike Company (Bikes) LimitedMagnificent Bike Company (Misc.) LimitedLondon Bike LTD.Old Penny Farthing LtdRacing Bikes of Reading and London Lmtd.;
Because CALL PRXCHANGE has no valid identifier, an error message similar to the following isgenerated for each line of data subsequent to the first.
ERROR: Argument 1 to the function PRXCHANGE must be a value returned by PRXPARSE for a valid patternNOTE: Argument 1 to function PRXCHANGE at line 173 column 7 is invalid
CALL PRXNEXTFind the next matching substring in a source string, starting from a specified position.
CALL PRXNEXT ( regex-id , start-position , stop-position , source , position , length );
Finds the next occurrence of a substring in a source string, from a specifed position in that string. Thesubstring to find is defined by a regular expression. You must define the position in the source string atwhich to start and stop searching. The regular expression must first be compiled using the PRXPARSEfunction, which returns an identifier that can be used in this function.
regex-id
Type: Numeric
A regular expression identifier.
start-position
Type: Numeric
Reference for language elementsVersion 3.3
707
The position in the source string at which to start searching for the substring.
stop-position
Type: Numeric
The position in the source string at which to stop searching for the substring.
source
Type: Character
The string to be examined for a pattern.
position
Type: Numeric
The position in source at which the substring is found.
length
Type: Numeric
The length of the substring found.
ExampleBasic example
In the following example, the regular expression is compiled and an identifier created for it usingPRXPARSE. The identifier is used in the CALL PRXNEXT function. The result is written to the log and tothe example dataset.
data example; id=prxparse('/Bike/'); a='Magnificent Bike Company (Bikes) Limited'; call prxnext(id,1,length(a), a, pos, len); put "String found at: " pos; put "String length is: " len;run;
This produces the following output:
String found at: 13String length is: 4
These results are the position and length of the first occurrence of the substring Bike.
Example – specifying start and end point
Reference for language elementsVersion 3.3
708
In the following example, the regular expression is compiled and an identifier for it created usingPRXPARSE. The identifier is used in the CALL PRXCHANGE function. The result is written to the log andto the example dataset.
data example; id=prxparse('/Bike/'); a='Magnificent Bike Company (Bikes) Limited'; call prxnext(id,20,35, a, rl, rt); put "String found at: " rl; put "String found at: " rt;run;
This produces the following output:
String found at: 27String length is: 4
The function starts searching the source string at character position 20, and stops at position 35. Thenext occurrence of the substring Bike is now found at position 27.
Note:If the end position for the search also terminates the string to be found, the string will not be found.In the example above, if the search had started at character 20 and ended at character 29, the rangewould contain only the string pany (Bik, which contains no match for Bike.
CALL PRXPOSNReturn the position and length of a Perl-style capture buffer.
CALL PRXPOSN ( regex-id , capture-buffer , position [ , length ] );
Returns the position and length of substrings contained in Perl-style capture buffers; the substrings tobe found and the capture buffers are defined using a regular expression. This call routine is similar tothe PRXPOSN function, except this routine returns the position and length of the capture buffers, ratherthan the contents of those buffers.
Before you call PRXPOSN to obtain the text contents of the capture buffers:
• The regular expression must first be compiled using the PRXPARSE function, which returns anidentifier that can be used by this function.
• Call PRXMATCH, using the regular expression identifier supplied by PRPARSE, to obtain the textcontents of the capture buffers, and establish their locations and lengths.
regex-id
Type: Numeric
A regular expression identifier.
Reference for language elementsVersion 3.3
709
capture-buffer
Type: Numeric
The index number of a capture-buffer. Capture buffers are numbered from 1 to n, where n is thenumber of buffers defined in the regular expression. Capture buffer 0 (zero) contains all strings inall capture buffers (that is, the entire search string).
position
Type: Numeric
A value returned by the CALL. The position at which the string in capture-buffer was found in thesource.
lengthOptional argument
Type: Numeric
A value returned by the CALL. The length of the string in capture-buffer.
ExampleIn the following example, the regular expression is compiled and an identifier created for it usingPRXPARSE. The identifier is used in the CALL PRXPOSN function. The result is written to the log and tothe example dataset.
data example; id=prxparse('/(Bike) (Company) (Misc)/'); a="Magnificent Bike Company (Misc) Limited"; match = prxmatch(id,a); put "PRXMATCH matches first at: " match; put "-------------------------"; CALL PRXPOSN (id,0, start, length); put "The strings captured in all buffers start at: " start; put "The strings captured in all buffers are: " length "characters long"; put "-------------------------"; CALL PRXPOSN (id, 1, start, length); put "String in capture buffer 1 found at : " start; put "Length of string in capture buffer 1 : " length; put "-------------------------"; CALL PRXPOSN (id, 2, start, length); put "String in capture buffer 2 found at : " start; put "Length of string in capture buffer 2 : " length; put "-------------------------"; CALL PRXPOSN (id, 3, start, length); put "String in capture buffer 3 found at : " start; put "Length of string in capture buffer 3 : " length;run;
Reference for language elementsVersion 3.3
710
This produces the following output:
PRXMATCH matches first at: 13-------------------------The strings captured in all buffers start at: 13The strings captured in all buffers are: 19 characters long-------------------------String in capture buffer 1 found at : 13Length of string in capture buffer 1 : 4-------------------------String in capture buffer 2 found at : 18Length of string in capture buffer 2 : 7-------------------------String in capture buffer 3 found at : 26Length of string in capture buffer 3 : 6
The PRXMATCH function has been used to ensure the capture buffer location and extents have beenidentified for the regular expression identifier.
The capture buffer 0 contains the strings starting at position 13 (the same as found by PRXMATCH, andin the first capture buffer in CALL PRXPOSN). The string length returned for capture buffer 0 is nineteencharacters, as it is the length of all strings captured to buffers 1 to 3 (the entire search pattern); in thiscase Bike Company (Misc).
The lengths and positions of each string found in each capture buffer are then written to the log.
CALL PRXSUBSTRFind the first occurrence of a substring in a source string.
CALL PRXSUBSTR ( regex-id , source , position [ , length ] );
Finds the first occurrence of a substring in a source string, using a regular expression to specify thestring to be found. The regular expression must first be interpreted using the PRXPARSE function, whichreturns an identifier that can be used in this function.
regex-id
Type: Numeric
A regular expression identifier.
source
Type: Character
The string to be examined for a pattern.
position
Type: Numeric
The position in source at which the substring is found.
Reference for language elementsVersion 3.3
711
lengthOptional argument
Type: Numeric
The length of the substring found.
ExampleIn the following example, the regular expression is interpreted and an identifier created for it usingPRXPARSE. The identifier is used in the CALL PRXSUBSTR function. The result is written to the log andto the example dataset.
data example; a="Magnificent Bike Company (Bikes) Limited"; id=prxparse('/Bike/'); call (id,a, pos, len); put "String found at : " pos; put "Length of string: " len;run;
This produces the following output:
String found at : 13Length of string: 4
Random number functions and call routinesFunctions that enable you to draw random numbers from various probability distributions.
The random number functions and CALL routines enable you to draw random numbers from variousprobability distributions, such as Cauchy and binomial distributions. There are two types of function andCALL routine:
• Named functions and CALL routines, such as RANBIN and CALL RANTRI. See Named functionsand CALL routines for more details
• Options accessed through the RAND function. See Rand functions for more details
Probability distributions are generated using parameters that are either specified by you in arguments tothe function or routine, or specified as defaults by the function or CALL routine.
Reference for language elementsVersion 3.3
712
Named functions and CALL routinesNamed functions and CALL routines that generate random numbers from probability distributions.
The named random number functions and CALL routines have the form RANname or CALL RANname.They obtain a random number from a corresponding distribution. For example, the RANCAU functionobtains a random number from a Cauchy distribution. These functions require that you specify a seednumber. If the seed is 0, the system clock is instead used to seed the function. If the system clock isused to seed the function, it will return a different result each time it is invoked. If a seed is specified thefunction will return the same value each time it is specified.
If a function is called repeatedly in a DATA step, the initial seed is replaced by another seed based onthe initial seed. This enables a series of differing random numbers to be obtained from a distribution,which can then be replicated exactly if the program is run again.
The CALL routines (CALL RANBIN, CALL RANCAU, and so on) provide a slightly different mode ofoperation to the functions, defining the scope of the initial seed differently. In a function, after a seed isfirst used, any further calls to the same routine in the same DATA step or DO loop use generated seeds,even if the routine is in a loop within a loop. For example, from the following datastep:
data _null_; do i = 1 to 5; result= ranpoi(10, 1); put result; end; do i = 1 to 5; result= ranpoi(10, 1); put result; end;run;
the following numbers are drawn from the Poisson distribution:
2151011011
Reference for language elementsVersion 3.3
713
If you were to then change the seed in the second DO loop to 12:
data _null_; do i = 1 to 5; result= ranpoi(10, 1); put result; end; do i = 1 to 5; result= ranpoi(12, 1); put result; end;run;
the same numbers would be returned. The seed is ignored in the second DO loop, replaced by a seedgenerated by the function. However, if the equivalent CALL routine is used:
data _null_; do i = 1 to 5; call ranpoi(10, 1, result); put result; end; do i = 1 to 5; call ranpoi(12, 1, result); put result; end;run;
the following is returned:
2151001200
Here, the seed of 12 in the second DO loop is not replaced, and becomes the initial seed for eachinvocation of the CALL RANPOI routine in the second loop.
RANBIN
Generate a random number from a binomial distribution.
RANBIN ( seed , N , Prob )
Generates a random number from a binomial distribution, and returns the result. You parameterise thedistribution by specifying the number of trials and the probability of success for each trial.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
Reference for language elementsVersion 3.3
714
Return type: Numeric
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
N
Type: Numeric
The number of trials.
This must be a positive number. If a negative number is used, a missing value is returned fromthe function, and a note indicating that the argument is invalid is written to the log.
Prob
Type: Numeric
The probability of success for each trial.
The random number returned will be a positive integer between 0 (zero) and number-of-trials.
ExampleIn the following example, the function is used to generate random numbers from a binomial distribution.The result is written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = ranbin(10, 50, 0.2); put result; end;run;
Reference for language elementsVersion 3.3
715
This produces the following output:
The random numbers are: 131119118
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result = ranbin(0, 50, 0.2); put result; end;run;
produces:
The random numbers are: 119111010
Running the DATA step again produces:
The random numbers are: 691258
RANCAU
Generate a random number from a Cauchy distribution.
RANCAU ( seed )
Generates a random number from a Cauchy distribution, and returns the result. The distribution isparameterised with location and scale parameters of 0 and 1 respectively.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
Return type: Numeric
Reference for language elementsVersion 3.3
716
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
The random number returned will be a positive or negative decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset. The result seeds the function in the next iteration.
data example; put "The random numbers are: "; do i = 1 to 5; result = rancau(10); put result; end;run;
This produces the following output:
The random numbers are: 1.7404084178-1.4730978320.3834782913-0.0124331121.1742074908
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result = rancau(0); put result; end;run;
Reference for language elementsVersion 3.3
717
produces:
The random numbers are: -19.056253761.27172098055.1594876086-0.2215194370.7377019906
Running the DATA step again produces:
The random numbers are: -0.511933644-5.4041568580.8455612831-2.7275549210.7114644347
RANEXP
Generate a random number from an exponential distribution.
RANEXP ( seed )
Return type: Numeric
Generates a random number from an exponential distribution, and returns the result. The distribution isparameterised using a mean of 1.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
A number used to seed the distribution.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
The random number returned will be (0,∞); hat is, greater than 0 and less than ∞.
Reference for language elementsVersion 3.3
718
ExampleIn the following example, the function is used to return random numbers from an exponentialdistribution. The result is written to the log and to the example dataset. The result seeds the function inthe next iteration.
data example; put "The random numbers are: "; do i = 1 to 5; result = ranexp(10); put result; end;run;
This produces the following output:
The random numbers are: 1.86411892820.10510167580.49935732560.25304882760.3939087162
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result = rancau(0); put result; end;run;
produces:
The random numbers are: 0.43237740840.15661953041.38688787490.77767270440.4901959216
Running the DATA step again produces:
The random numbers are:0.6331665580.93613233970.44233143521.1293635631.3409875818
Reference for language elementsVersion 3.3
719
RANGAM
Generate a random number from a gamma distribution.
RANGAM ( seed , shape )
Generates a random number from a gamma distribution, and returns the result. You parameterise thedistribution by specifying a shape parameter.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
Return type: Numeric
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
shape
Type: Numeric
A positive number that defines the shape of the gamma distribution.
If a negative number is used, a missing value is returned from the function, and a note indicatingthe argument is invalid is written to the log.
The random number returned will be a positive decimal number.
Reference for language elementsVersion 3.3
720
ExampleIn the following example, the function is used to return random numbers from a gamma distribution. Theresult is written to the log and to the example dataset. The result seeds the function in the next iteration.
data example; put "The random numbers are: "; do i = 1 to 5; result = rangam(50, 0.2); put result; end;run;
This produces the following output:
The random numbers are: 0.01045231620.59388028890.00009650850.00085356420.621719791
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result = rangam(0, 0.2); put result; end;run;
produces:
The random numbers are: 6.728089E-100.05384435860.01317002040.67676320930.0109073109
Running the DATA step again produces:
The random numbers are:0.00025285251.15536583210.00033538050.18494890862.9069978738
Reference for language elementsVersion 3.3
721
RANNOR
Generate a random number from a normal distribution.
RANNOR ( seed )
Can also be expressed as:
NORMAL ( seed )
Generates a random number from a normal distribution, and returns the result. The distribution isparameterised using a mean and standard deviation of 0 and 1 respectively.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
Return type: Numeric
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
The random number returned will be a real number in the range (-∞, +∞); that is, greater than -∞ andless than ∞.
ExampleIn the following example, the function is used to return random numbers from a normal distribution. Theresult is written to the log and to the example dataset. The result seeds the function in the next iteration.
data example; put "The random numbers are: "; do i = 1 to 5; result = rannor(50); put result; end;run;
Reference for language elementsVersion 3.3
722
This produces the following output:
The random numbers are:0.2772581053-0.0592691161.7234339317-0.5205850251.0438066355
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result = rannor(0); put result; end;run;
produces:
The random numbers are: -19.056253761.27172098055.1594876086-0.2215194370.7377019906
Running the DATA step again produces:
The random numbers are:-1.3445308740.63935235430.6405996383-0.6166695310.2737123402
RANPOI
Generate a random number from a Poisson distribution.
RANPOI ( seed , mean )
Generates a random number from a Poisson distribution, and returns the result. You parameterise thedistribution by specifying a mean.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
Return type: Numeric
Reference for language elementsVersion 3.3
723
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
mean
Type: Numeric
The mean of the distribution.
This must be a positive number. If a negative number is used, a missing value is returned fromthe function, and a note indicating that the argument is invalid is written to the log.
The random number returned will be a natural number.
ExampleIn the following example, the function is used to return random numbers from a Poisson distribution.The result is written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = ranpoi(10, 50); put result; end;run;
This produces the following output:
The random numbers are: 5754725244
If you were to run the program again, the same numbers would be returned.
Reference for language elementsVersion 3.3
724
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are:"; do i = 1 to 5; result = ranpoi(0, 50); put result; end;run;
produces:
The random numbers are: 4048446244
Running the DATA step again produces:
The random numbers are: 4954564158
RANTBL
Generate a random number from a discrete probability distribution.
RANTBL ( seed , { prob , … } )
Generates a random number from a discrete distribution of categories, and returns the result. Youparameterise the distribution by specifying probabilities for each category.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
Return type: Numeric
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Reference for language elementsVersion 3.3
725
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
prob
Type: Numeric
A discrete probability.
The number returned will be the number of a randomly selected category. If the probabilities sum to1, an ordinal number will be applied to each probability in the order they are specified. For example,in rantbl(5, 0.75,0.25) the 0.75 probability will be assigned to category 1, and 0.25 assignedto category 2. The random numbers returned would then be either 1 or 2, and would be expected tooccur, on average, 75% and 25% of the time respectively. If you specified rantbl(5, 0.25, 0.25,0.5, 0.25):
• The first 0.25 probability will be assigned to category 1• The second 0.25 probability assigned to category 2• The 0.5 probability assigned to category 3• The final 0.25 probability to category 4
The random numbers returned would then be in the range 1 through 4; the numbers 1, 2 and 4 wouldappear, on average, 25% of the time, while the number 3 would appear, on average 50% of the time.
If the numbers sum to less than 1, then a category is created that represents the probability required tosum to 1. For example, rantbl(5,0.5,0.2,0.1) would result in four categories, with the number 4assigned to the probability 0.2 that would be required to sum the probabilities to 1.
If the numbers sum to greater than 1, the result depends on which of the arguments caused theprobability to sum to 1. If it is the final argument, then the category assigned will only representthe probability required to sum to 1. For example, rantbl(5,0.5,0.3,0.3) would result inthree categories, with the number 3 assigned the probability 0.2 that would be required to sum theprobabilities to 1; that is, 3 would only be expected to be returned 20% of the time, rather than 30%of the time. If the probabilities sum to 1 before the final argument, then the arguments beyond theargument that causes the probabilities to sum to 1 are discarded. For example, if you specifiedrantbl(5,0.6,0.6,0.3,0.2), only two categories would be specified: category 1 with a probabilityof occurring, on average, 60% of the time, and 2 occurring, on average, 40% of the time.
Reference for language elementsVersion 3.3
726
Example — Basic ExamplesIn the following example, the function is used to return a random number. The result is written to the logand the example dataset.
data example; put "The random numbers are: "; do i = 1 to 10; result = rantbl(5, 0.25, 0.25, 0.5, 0.25); put result; end;run;
This produces the following output:
The random numbers are: 3332333312
If you were to run the program again, the same numbers would be returned. However, if the seed hadbeen set to 0, each run would produce a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result = rantbl(0, 0.7, 0.2, 0.1); put result; end;run;
produces:
The random numbers are: 11213
Running the DATA step again produces:
The random numbers are: 31111
Reference for language elementsVersion 3.3
727
Example — Probabililities Sum to Greater than 1The following example, shows what happens when the function contains probabilities that sum to morethan 1. The result is written to the log and to the example dataset.
data example; o = 0; x = 0; y = 0; average_x=0; average_y=0; toax=0; toay=0; overall_average_x=0; overall_average_y=0; m = 0; do k = 1 to 100;
do i = 1 to 500; result = rantbl(0, 0.6, 0.6, 0.3, 0.2); if result = 1 then x = x + 1; if result = 2 then y = y + 1; o = o + 1; end;
average_x = x/o*100; average_y = y/o*100; overall_average_x = overall_average_x + average_x; overall_average_y = overall_average_y + average_y; m = m + 1;
end;
toax = overall_average_x/m; toay = overall_average_y/m; put "Average occurrence of 1 = " toax; put "Average occurrence of 2 = " toay; run;
This produces the following output:
Average occurrence of 1 = 60.109367963Average occurrence of 2 = 39.890632037
The last two probabilities in the list of arguments provided to the function are ignored, as the list ofprobabilities sum to greater than 1. The second argument (0.6) is instead given the value 0.4 so thatthe probabilities sum to 1. Only two values are then returned, 1 and 2. 1 will be returned, on average,60% of the time, matching the specified argument of 0.6, while the 2 will be returned 40% of the time,matching the redefined second argument. The values returned by the example match these averages.
Reference for language elementsVersion 3.3
728
Example — Probabililities Sum to Less than 1The following example shows what happens when the function contains probabilities that sum to lessthan 1. The result is written to the log and to the example dataset.
data example; m = 0; o = 0; v = 0; w = 0; x = 0; y = 0; average_x = 0; average_y = 0; average_v = 0; average_w = 0; toav = 0; toaw = 0; toax = 0; toay = 0; overall_average_x = 0; overall_average_y = 0; overall_average_v = 0; overall_average_w = 0;
do k = 1 to 100; do i = 1 to 500; result = rantbl(0, 0.4, 0.2, 0.2); if result = 1 then x = x + 1; if result = 2 then y = y + 1; if result = 3 then v = v + 1; if result = 4 then w = w + 1; o = o + 1; end; average_x = x/o*100; average_y = y/o*100; average_v = v/o*100; average_w = w/o*100;
overall_average_x = overall_average_x + average_x; overall_average_y = overall_average_y + average_y; overall_average_w = overall_average_w + average_w; overall_average_v = overall_average_v + average_v; m = m + 1; end; toax = overall_average_x/m; toay = overall_average_y/m; toav = overall_average_v/m; toaw = overall_average_w/m;
put "Average occurrence of 1 = " toax; put "Average occurrence of 2 = " toay; put "Average occurrence of 3 = " toav; put "Average occurrence of 4 = " toaw;
Reference for language elementsVersion 3.3
729
run;
This produces the following output:
Average occurrence of 1 = 39.654043034Average occurrence of 2 = 20.068023606Average occurrence of 3 = 20.077069785Average occurrence of 4 = 20.200863575
As the results show, although only three arguments are supplied, results for four categories arereturned. Because the probabilities supplied as arguments to the function sum to less than 1, a fourthargument is assumed by the function, having a value that causes all probabilities to sum to 1. In thisexample, four values are then returned, 1 through 4, where 4 which will be returned, on average, 20%of the time; that is, the assumed argument is given a probability of 0.2, to make the arguments sum to1. The values returned by the example the average number of times each category is returned.
RANTRI
Generate a random number from a triangular distribution.
RANTRI ( seed , mode )
Generates a random number from a triangular distribution, and returns the result. You parameterise thedistribution by specifying a mode.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
Return type: Numeric
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
mode
Type: Numeric
Reference for language elementsVersion 3.3
730
The mode for the triangular distribution.
The random number returned will be a number in the range [0,1]; that is, from 0 through 1.
ExampleIn the following example, the function is used to return random numbers from a triangular distribution.The result is written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rantri(50, 0.34); put result; end;run;
This produces the following output:
The random numbers are: 0.29045427690.42809757520.92385606360.85912877310.1650570317
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result = rantri(0, 0.34); put result; end;run;
produces:
The random numbers are: 0.92585404230.36790899510.81423706970.49017082320.5053367342
Running the DATA step again produces:
The random numbers are: 0.28090934450.22747846810.35971532790.31336742460.7264610997
Reference for language elementsVersion 3.3
731
RANUNI
Generate a random number from a uniform distribution.
RANUNI ( seed )
Can also be expressed as:
UNIFORM ( seed )
Generates a random number from a uniform distribution, and returns the result. The distribution isparameterised using default parameters.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
Return type: Numeric
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
The random number returned will be a positive decimal number in the range (0,1); that is, greater than 0and less than 1.
ExampleIn the following example, the function is used to return random numbers from a uniform distribution. Theresult is written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result=ranuni(4); put result; end;run;
Reference for language elementsVersion 3.3
732
This produces the following output:
The random numbers are: 0.73985027930.88035486260.59929722440.03759458150.6864103115
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result=ranuni(0); put result; end;run;
produces:
The random numbers are: 0.78009249170.38835561340.57088765020.8589129550.1047348027
Running the DATA step again produces:
The random numbers are:0.44552233140.99036609940.2396259640.91347687690.2687704215
CALL RANBIN
Generate a random number from a binomial distribution, and return it in an argument.
CALL RANBIN ( seed , N , Prob , x );
Generates a random number from a binomial distribution, and returns that number to an argument youspecify in the CALL routine. You parameterise the distribution by specifying the number of trials and theprobability of success for each trial.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
Reference for language elementsVersion 3.3
733
A number used to seed the random number generator.
Each time you execute this routine with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the routine is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
N
Type: Numeric
The number of trials.
Prob
Type: Numeric
The probability of success for each trial.
x
Type: Numeric
An argument into which the random number is returned.
The random number returned will be a positive integer the range determined by the x-axis of thedistribution, which will be between 0 (zero) and N.
ExampleIn the following example, the routine is used to return random numbers from a binomial distribution.The result of the routine is returned to ranN, and seeds the next call of the routine. The results of theexample are written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; call ranbin(10, 50, 0.2, ranN); put ranN; end;run;
Reference for language elementsVersion 3.3
734
This produces the following output:
The random numbers are: 131119118
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; call ranbin(0, 50, 0.2, ranN); put ranN; end;run;
produces:
The random numbers are: 91591212
Running the DATA step again produces:
The random numbers are: 148121611
CALL RANCAU
Generate a random number from a Cauchy distribution, and return it in an argument.
CALL RANCAU ( seed , x );
Generates a random number from a Cauchy distribution, and returns that number to an argument youspecify in the CALL routine. The distribution is parameterised using location and scale parameters of 0(zero) and 1 respectively.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
Reference for language elementsVersion 3.3
735
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
x
Type: Numeric
An argument into which the random number is returned.
The random number returned will be a positive or negative decimal number.
ExampleIn the following example, the routine is used to return random numbers from a binomial distribution.The result of the routine is returned to ranN, and seeds the next call of the routine. The results of theexample are written to the log and to the example dataset.
data example; do i = 1 to 5; call rancau(10, ranN); put ranN; end;run;
This produces the following output:
1.7404084178-1.4730978320.3834782913-0.0124331121.1742074908
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; do i = 1 to 5; call rancau(0, ranN); put ranN; end;run;
Reference for language elementsVersion 3.3
736
produces:
The random numbers are: -0.075360642-0.7207063971.21598272411.80796392-0.716337281
Running the DATA step again produces:
The random numbers are:-0.266269517-0.77613149-1.5960823662.9803307352.2060086809
CALL RANEXP
Generate a random number from an exponential distribution, and return it in an argument.
CALL RANEXP ( seed , x );
Generates a random number from an exponential distribution,and returns that number to an argumentyou specify in the CALL routine. The distribution is parameterised using a mean of 1.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this function with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the function is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
x
Type: Numeric
The argument into which the random number is returned.
Reference for language elementsVersion 3.3
737
The random number returned will be (0,∞); that is, greater than 0 and less than ∞.
ExampleIn the following example, the routine is used to return random numbers from an exponential distribution.The result of the routine is returned to ranN, and seeds the next call of the routine. The results of theexample are written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; call ranexp(10, ranN); put ranN; end;run;
This produces the following output:
0.16295938150.35540837990.00175848430.5208987651.5323575328
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; call ranexp(0, ranN); put ranN; end;run;
produces:
The random numbers are: 4.37445494530.37874922770.68794838422.23488450640.693289297
Running the DATA step again produces:
The random numbers are: 0.98338341910.30008786720.15830150610.10952651911.6490832095
Reference for language elementsVersion 3.3
738
CALL RANGAM
Generate a random number from a gamma distribution, and return it in an argument.
CALL RANGAM ( seed , shape , x );
Generates a random number from a gamma distribution, and returns that number to an argument youspecify in the CALL routine. You parameterise the distribution by specifying a shape parameter.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this routine with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the routine is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
shape
Type: Numeric
A value defining the shape of the gamma distribution.
x
Type: Numeric
An argument into which the random number is returned.
The random number returned will be a positive decimal number.
Reference for language elementsVersion 3.3
739
ExampleIn the following example, the routine is used to return random numbers from a gamma distribution.The result of the routine is returned to ranN, and seeds the next call of the routine. The results of theexample are written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; call rangam(50, 0.2,ranN); put ranN; end;run;
This produces the following output:
The random numbers are: 0.01045231620.59388028890.00009650850.00085356420.621719791
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; call rangam(0, 0.2,ranN); put ranN; end;run;
produces:
The random numbers are: 0.05777408561.073869E-70.36673521590.03500470292.4169802E-6
Running the DATA step again produces:
The random numbers are: 3.1296626E-60.0016382550.41995213790.00570716440.0926429502
Reference for language elementsVersion 3.3
740
CALL RANNOR
Generate a random number from a normal distribution, and return it in an argument.
CALL RANNOR ( seed , x );
Generates a random number from a normal distribution, and returns that number to an argument youspecify in the CALL routine. The distribution is parameterised using a mean and standard deviation of 0and 1 respectively.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this routine with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the routine is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
x
Type: Numeric
An argument into which the random number is returned.
The random number returned will be a real number in the range (-∞, +∞); that is, greater than -∞ andless than ∞.
ExampleIn the following example, the routine is used to return random numbers from a normal distribution.The result of the routine is returned to ranN, and seeds the next call of the routine. The results of theexample are written to the log and to the example dataset.
data example; do i = 1 to 5; call rannor(50, ranN); put ranN; end;run;
Reference for language elementsVersion 3.3
741
This produces the following output:
The random numbers are:-1.6689674350.1304784715-2.189174283-1.682275958-0.564639193
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; call rannor(0, ranN); put ranN; end;run;
produces:
The random numbers are: -1.1118768510.17864191710.4742460052-0.9570770941.1507782067
Running the DATA step again produces:
The random numbers are: -2.6681042170.20811395880.95266971430.5769901728-1.289722773
CALL RANPOI
Generate a random number from a Poisson distribution, and return it in an argument.
CALL RANPOI ( seed , mean , x );
Generates a random number from a Poisson distribution, and returns that number to an argument youspecify in the CALL routine. You parameterise the distribution by specifying a mean.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
Reference for language elementsVersion 3.3
742
A number used to seed the random number generator.
Each time you execute this routine with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the routine is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
mean
Type: Numeric
The mean of the distribution.
x
Type: Numeric
An argument into which the random number is returned.
The random number returned will be a natural number.
ExampleIn the following example, the routine is used to return random numbers from a Poisson distribution.The result of the routine is returned to ranN, and seeds the next call of the routine. The results of theexample are written to the log and to the example dataset.
data _null_; do i = 1 to 5; call ranpoi(10, 1, ranN); put ranN; end;run;
This produces the following output:
The random numbers are: 21510
If you were to run the program again, the same numbers would be returned.
Reference for language elementsVersion 3.3
743
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; call ranpoi(0, 1, ranN); put ranN; end;run;
produces:
The random numbers are:01110
Running the DATA step again produces:
The random numbers are: 03210
CALL RANTBL
Generate a random number from a discrete probability distribution, and return it in an argument.
CALL RANTBL ( seed , { prob , … } );
Generates a random number from a discrete distribution of categories, and returns that number to anargument you specify in the CALL routine. You parameterise the distribution by specifying probabilitiesfor each category.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this routine with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the routine is called, set seed to 0.
Reference for language elementsVersion 3.3
744
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
prob
Type: Numeric
A discrete probability.
Basic ExamplesIn the following example, the routine is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 10; result = call rantbl(5, 0.25, 0.25, 0.5, 0.25); put result; end;run;
This produces the following output:
The random numbers are: 4341333311
If you were to run the program again, the same numbers would be returned. However, if the seed hadbeen set to 0, each run would produce a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 10; call rantbl(0, 0.4, 0.2, 0.3, 0.1, ranN); put ranN; end;run;
Reference for language elementsVersion 3.3
745
produces:
The random numbers are: 4331121133
Running the DATA step again produces:
TThe random numbers are: 2131114213
Reference for language elementsVersion 3.3
746
Probabililities Sum to Greater than 1The following example, shows what happens when the function contains probabilities that sum to morethan 1. The result is written to the log and to the example dataset.
data example; o = 0; x = 0; y = 0; toax=0; toay=0; overall_average_x=0; overall_average_y=0; m = 0; do k = 1 to 100;
do i = 1 to 500; result = rantbl(0, 0.6, 0.6, 0.3, 0.2); if result = 1 then x = x + 1; if result = 2 then y = y + 1; o = o + 1; end; overall_average_x = overall_average_x + x/o*100; overall_average_y = overall_average_y + y/o*100; m = m + 1;
end;
toax = overall_average_x/m; toay = overall_average_y/m; put "Average occurrence of 1 = " toax; put "Average occurrence of 2 = " toay; run;
This produces the following output:
Average occurrence of 1 = 60.109367963Average occurrence of 2 = 39.890632037
The last two probabilities in the list of arguments provided to the function are ignored, as the list ofprobabilities sum to greater than 1. The second argument (0.6) is instead given the value 0.4 so thatthe probabilities sum to 1. Only two values are then returned, 1 and 2. 1 will be returned, on average,60% of the time, matching the specified argument of 0.6, while the 2 will be returned 40% of the time,matching the redefined second argument. The values returned by the example match these averages.
Probabililities Sum to Less than 1The following example shows what happens when the function contains probabilities that sum to lessthan 1. The result is written to the log and to the example dataset.
data example;
Reference for language elementsVersion 3.3
747
m = 0; o = 0; v = 0; w = 0; x = 0; y = 0; toav = 0; toaw = 0; toax = 0; toay = 0; overall_average_x = 0; overall_average_y = 0; overall_average_v = 0; overall_average_w = 0;
do k = 1 to 100; do i = 1 to 500; call rantbl(0, 0.4, 0.2, 0.2, nN); if nN = 1 then x = x + 1; if nN = 2 then y = y + 1; if nN = 3 then v = v + 1; if nN = 4 then w = w + 1; o = o + 1; end; overall_average_x = overall_average_x + x/o*100; overall_average_y = overall_average_y + y/o*100; overall_average_w = overall_average_w + w/o*100; overall_average_v = overall_average_v + v/o*100;
m = m + 1; end; toax = overall_average_x/m; toay = overall_average_y/m; toav = overall_average_v/m; toaw = overall_average_w/m;
put "Average occurrence of 1 = " toax; put "Average occurrence of 2 = " toay; put "Average occurrence of 3 = " toav; put "Average occurrence of 4 = " toaw; run;
This produces the following output:
Average occurrence of 1 = 40.554983457Average occurrence of 2 = 20.050067559Average occurrence of 3 = 19.616092583Average occurrence of 4 = 19.778856401
Reference for language elementsVersion 3.3
748
As the results show, although only three arguments are supplied, results are returned for fourcategories. Because the probabilities supplied as arguments to the function sum to less than 1, a fourthargument is assumed by the function, having a value that causes all probabilities to sum to 1. In thisexample, four values are then returned, 1 through 4, where 4 which will be returned, on average, 20%of the time; that is, the assumed argument is given a probability of 0.2, to make the arguments sum to1. The values returned by the example the average number of times each category is returned.
CALL RANTRI
Generate a random number from a triangular distribution, and return it in an argument.
CALL RANTRI ( seed , mode , x );
Generates a random number from a triangular distribution, and returns that number to an argument youspecify in the CALL routine. You parameterise the distribution by specifying a mode.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this routine with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the routine is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
mode
Type: Numeric
The mode of distribution.
x
Type: Numeric
The variable into which the random number is returned.
The random number returned will be a number in the range [0,1]; that is, from 0 through 1.
Reference for language elementsVersion 3.3
749
ExampleIn the following example, the routine is used to return random numbers from a triangular distribution.The result of the routine is returned to ranN, and seeds the next call of the routine. The results of theexample are written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; call rantri(50, 0.34, ranN); put ranN; end;run;
This produces the following output:
The random numbers are: 0.29045427690.42809757520.92385606360.85912877310.1650570317
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; result = rancau(0); put result; end;run;
produces:
The random numbers are: 0.4613641970.80697699320.47510275290.57068970810.412730761
Running the DATA step again produces:
The random numbers are: 0.57231944320.3570890120.50047351720.15548282660.3989297724
Reference for language elementsVersion 3.3
750
CALL RANUNI
Generate a random number from a uniform distribution, and return it in an argument.
CALL RANUNI ( seed , x );
Generates a random number from a uniform distribution, and returns that number to an argument youspecify in the CALL routine.
A seed is used to initialise the random number generator. This enables you to generate the sameresults each time the DATA step is run. See seed below for more details.
seed
Type: Numeric
A number used to seed the random number generator.
Each time you execute this routine with the same seed except 0 (zero), the same randomnumber will be returned. This enables you to create a DATA step in which the same numberis generated from the distribution each time it is run; this might be required if results needreplication.
To generate a different random number each time the routine is called, set seed to 0.
Note:If the function is used repeatedly within a DATA step, the seed applies only the first time thefunction is used; subsequent use returns a random number based on the previous use of thefunction.
x
Type: Numeric
An argument into which the random number is returned.
The random number returned will be a positive decimal number in the range (0,1); that is, greater than 0and less than 1.
ExampleIn the following example, the routine is used to return random numbers from a uniform distribution.The result of the routine is returned to ranN, and seeds the next call of the routine. The results of theexample are written to the log and to the example dataset.
data _null_; do i = 1 to 5; call ranuni(4, ranN); put ranN; end;run;
Reference for language elementsVersion 3.3
751
This produces the following output:
The random numbers are: 0.73985027930.88035486260.59929722440.03759458150.6864103115
If you were to run the program again, the same numbers would be returned.
If the seed is set to 0, each run produces a different series of numbers. For example:
data example; put "The random numbers are: "; do i = 1 to 5; call ranuni(0, ranN); put ranN; end;run;
produces:
The random numbers are: 0.26294590920.62507306390.0476943990.5610572540.2579885285
Running the DATA step again produces:
The random numbers are: 0.90781096640.4485888250.82847406430.10392388330.9260302335
CALL STREAMINIT
Create a seed for use by RAND.
CALL STREAMINIT ( seed );
Creates a seed number that is used by a subsequent call to the RAND function.
Each time you execute the RAND function, a random number is generated using a seed based on thesystem clock. However, you might want to generate the same numbers from a specified distributioneach time you use it. In this case, you should use CALL STREAMINIT to create a seed number for useby RAND.
seed
Type: Numeric
Reference for language elementsVersion 3.3
752
A seed to be used by the RAND function.
ExampleIn the following example, the function is used to generate a seed for RAND.
data example; call streaminit(100); put "The random numbers are: "; do i = 1 to 5; result = rand("BINOMIAL", 0.2, 50); put result; end;run;
This produces the following output:
14127107
If you were to run the program again, the same random numbers would be generated from the binomialdistribution. If the CALL STREAMINIT were omitted, a different set of random numbers would beproduced each time the program is run.
RAND functionsThe RAND function enables the generation of random numbers from various probability distributionfunctions.
This function uses a different random number generator to that used in the RANx functions androutines (such as RANBIN, RANCAU and so on); this generator provides a longer run of numbers beforerepeating a pattern. This function also provides additional random generation methods to the RANxfunctions. For example, RAND provides beta and Bernoulli distributions.
A random number is generated, using a seed based on the system clock, that is then used to select anumber from the corresponding distribution. You can also specify a seed value for the random numbergenerator, in which case the same random numbers will be selected from the distribution; you mightneed to do this if you want to replicate results each time you run the program containing the function. Tospecify a seed, use CALL STREAMINIT before specifying a RAND function.
If you use a RAND function more than once in a DATA step, subsequent invocations use a differentseed to that specified in the initial invocation.
Reference for language elementsVersion 3.3
753
BERNOULLI Distribution
Generate a random number from a Bernoulli distribution.
RAND ( "BERNOULLI" , probability )
Generates a random number from a Bernoulli distribution, and returns the result. You parameterise thedistribution by specifying the probability of success for each trial.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
probability
Type: Numeric
The probability of success for each trial.
The number returned will be either 0 (zero) or 1, as the Bernoulli distribution is a discrete distributionhaving two possible outcomes, 0 (zero) for failure and 1 for success.
ExampleIn the following example, the function is used to return a random number from the Bernoulli distribution.The result is written to the log and to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("bernoulli", 0.75); put result; end;run;
This produces the following output:
The random numbers are: 00101
Reference for language elementsVersion 3.3
754
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 01001
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(10); put "The random numbers are: "; do i = 1 to 5; result = rand("bernoulli", 0.75); put result; end;run;
This produces the following output:
The random numbers are: 10011
If you were to run the program again, the same set of numbers would be returned.
BETA Distribution
Generate a random number from a beta distribution.
RAND ( "BETA" , alpha , beta )
Generates a random number from a beta distribution, and returns the result. You parameterise thedistribution by specifying shape parameters.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthis function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
alpha
Type: Numeric
Reference for language elementsVersion 3.3
755
Alpha parameter for function shape.
beta
Type: Numeric
Beta parameter for function shape.
The function returns a random number between 0 (zero) and 1, the boundary values of the x-axis of thedistribution.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("beta", 5, 7); put result; end;run;
This produces the following output:
The random numbers are: 0.662766420.52804933540.60886159730.36837751450.5415439703
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 0.2474275990.42179703410.40267295730.50060559130.5966151994
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(10); put "The random numbers are: "; do i = 1 to 5; result = rand("beta", 5, 3); put result; end;run;
Reference for language elementsVersion 3.3
756
This produces the following output:
The random numbers are: 0.74097402720.48779233540.55333040150.85360382680.3520169329
If you were to run the program again, the same set of numbers would be returned.
BINOMIAL Distribution
Generate a random number from a binomial distribution
RAND ( "BINOMIAL" , probability , number-of-trials )
Generates a random number from a binomial distribution, and returns the result. You parameterise thedistribution by specifying the number of trials and the probability of success for each trial.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthis function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
probability
Type: Numeric
The probability of success for each trial.
number-of-trials
Type: Numeric
The number of trials.
The random number returned will be a positive integer from the x-axis of the distribution, and will bebetween 0 (zero) and number-of-trials.
Reference for language elementsVersion 3.3
757
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("binomial", 0.75, 10); put result; end;run;
This produces the following output:
The random numbers are: 89789
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 810786
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(10); put "The random numbers are: "; do i = 1 to 5; result = rand("binomial", 0.75, 10); put result; end;run;
This produces the following output:
The random numbers are:106799
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
758
CAUCHY Distribution
Generate a random number from a Cauchy distribution.
RAND ( "CAUCHY" )
Generates a random number from a standard Cauchy distribution, and returns the result. Thedistribution is parameterised using location and scale parameters of 0 (zero) and 1 respectively.
No argument is required.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthis function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
The random number returned will be a positive or negative decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("cauchy"); put result; end;run;
This produces the following output:
The random numbers are: 0.4263776967-3.8880630751.6837079995-1.2716287111.042411634
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 0.8555157080.6539476118-3.7027088930.42704121434.8968502713
Reference for language elementsVersion 3.3
759
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(10); put "The random numbers are: "; do i = 1 to 5; result = rand("cauchy"); put result; end;run;
This produces the following output:
The random numbers are: -0.6131144172.4034121057-0.649756486-1.8215161786.856637058
If you were to run the program again, the same set of numbers would be returned.
CHISQUARE Distribution
Generate a random number from a chi-squared distribution.
RAND ( "CHISQUARE" , degrees-of-freedom )
Generates a random number from a chi-squared distribution, and returns the result. You parameterisethe distribution by specifying the number of degrees of freedom.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
degrees-of-freedom
Type: Numeric
The number of degrees of freedom.
The random number returned will be a positive decimal number greater than 0 (zero).
Reference for language elementsVersion 3.3
760
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("chisquare", 3); put result; end;run;
This produces the following output:
The random numbers are: 1.18907267012.65701604792.72557963591.54789113721.2643875905
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 4.11080277736.10368662882.48250351351.52454076661.1249219054
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(50); put "The random numbers are: "; do i = 1 to 5; result = rand("chisquare", 3); put result; end;run;
This produces the following output:
The random numbers are: 0.39229683160.60896422974.84763852460.56189481644.6102139672
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
761
ERLANG Distribution
Generate a random number from an Erlang distribution.
RAND ( "ERLANG" , shape )
Generates a random number from an Erlang distribution, and returns the result. You parameterise thedistribution by specifying the shape of the distribution; a default rate of 1 is used.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
shape
Type: Numeric
The shape of the distribution.
The random number returned will be a positive decimal number greater than 0 (zero).
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("erlang", 3); put result; end;run;
This produces the following output:
The random numbers are: 4.03004350516.68082267969.43844779974.28591116044.9152869497
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 4.61830650035.21194481496.21875197185.50327388699.3680427968
Reference for language elementsVersion 3.3
762
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(50); put "The random numbers are: "; do i = 1 to 5; result = rand("erlang", 3); put result; end;run;
This produces the following output:
The random numbers are: 3.23037003610.91122740812.86160644492.32207041663.1615075339
If you were to run the program again, the same set of numbers would be returned.
EXPONENTIAL Distribution
Generate a random number from an exponential distribution.
RAND ( "EXPONENTIAL" )
Generates a random number from an exponential distribution, and returns the result. The distribution isparameterised using a mean of 1.
No argument is required.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
The random number returned will be (0,∞); that is, greater than 0 and less than ∞.
Reference for language elementsVersion 3.3
763
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("exponential"); put result; end;run;
This produces the following output:
The random numbers are:2.70820113912.38980744540.31264765270.28650675640.1319622419
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 0.9705078312.60478128030.6818842760.34366860561.1060946519
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(16); put "The random numbers are: "; do i = 1 to 5; result = rand("exponential"); put result; end;run;
This produces the following output:
The random numbers are: 0.28625211140.07108855320.05747383762.84830749671.52861687
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
764
F Distribution
Generate a random number from an F-distribution.
RAND ( "F" , degrees-of-freedom , second-degrees-of-freedom )
Return type: Numeric
Generates a random number from an F-distribution, and returns the result. You parameterise thedistribution by specifying the first and second degrees of freedom.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
degrees-of-freedom
Type: Numeric
The first number of degrees of freedom for the distribution.
second-degrees-of-freedom
Type: Numeric
The second number of degrees of freedom for the distribution.
The random number returned will be a positive decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("F", 7,3); put result; end;run;
This produces the following output:
The random numbers are: 1.55802020430.22754449342.95563068420.28166584110.9441069678
Reference for language elementsVersion 3.3
765
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are:0.4362369440.49256251251.66891903285.35554362021.1726657119
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(16); put "The random numbers are: "; do i = 1 to 5; result = rand("F", 7,3); put result; end;run;
This produces the following output:
The random numbers are:0.31513902481.34422311080.4571422412.36320632611.8960485237
If you were to run the program again, the same set of numbers would be returned.
GAMMA Distribution
RAND ( "GAMMA" , shape )
Return type: Numeric
Generates a random number from a gamma distribution, and returns the result. You parameterise thedistribution by specifying a shape parameter; a default scale of 1 is used.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
shape
Type: Numeric
A shape parameter for the distribution.
Reference for language elementsVersion 3.3
766
The random number returned will be a positive decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("gamma", 3); put result; end;run;
This produces the following output:
The random numbers are: 5.70034955382.90986121350.77655849121.95720294151.0605257842
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 1.955371150.27554666342.95011999234.47320833112.9515196911
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(12); put "The random numbers are: "; do i = 1 to 5; result = rand("gamma", 3); put result; end;run;
This produces the following output:
The random numbers are: 3.48698161112.18919107062.81236907293.07558142952.3247368117
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
767
GEOMETRIC Distribution
Generate a random number from a geometric distribution.
RAND ( "GEOMETRIC" , probability )
Generates a random number from a geometric distribution, and returns the result. You parameterise thedistribution by specifying a probability.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
probability
Type: Numeric
A probability from the distribution.
The random number returned will be a positive decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("geometric", 0.75); put result; end;run;
This produces the following output:
The random numbers are: 1.04082026040.69316546162.19776680270.36786181180.3735144205
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 1.64219950561.93958786580.70458337210.03427754770.2960285254
Reference for language elementsVersion 3.3
768
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(11); put "The random numbers are: "; do i = 1 to 5; result = rand("geometric", 0.75); put result; end;run;
This produces the following output:
The random numbers are:2.06597851870.50513828861.03885748940.94381835020.3738827807
If you were to run the program again, the same set of numbers would be returned.
GUMBEL Distribution
Generate a random number from a Gumbel distribution.
RAND ( "GUMBEL" )
Return type: Numeric
Generates a random number from a Gumbel distribution, and returns the result. The distribution isparameterised using location and scale parameters of 0 (zero) and 1 respectively.
No argument is required.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
The random number returned will be a positive or negative decimal number.
Reference for language elementsVersion 3.3
769
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("gumbel"); put result; end;run;
This produces the following output:
The random numbers are: -0.851020115-0.367363323-1.0197685821.37077795550.6873485682
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: -0.779538288-1.013083359-1.2498025021.5490383986-0.116005925
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(18); put "The random numbers are: "; do i = 1 to 5; result = rand("gumbel"); put result; end;run;
This produces the following output:
The random numbers are:2.17885979061.1880261682-1.049847839-0.1851757360.0890908226
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
770
HYPER Distribution
Generate a random number from a hypergeometric distribution.
RAND ( "HYPER" , population-size , number-of-successful-items , number-of-draws )
Generates a random number from a hypergeometric distribution, and returns the result. Youparameterise the distribution by specifying the population size, number of draws, and number ofsuccesses.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
population-size
Type: Numeric
The size of the population from which draw are made.
number-of-successful-items
Type: Numeric
The number of draws that meet the criterion for success.
number-of-draws
Type: Numeric
The total number of draws from the population.
The random number returned will be a positive integer determined by the x-axis of the distribution.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("hyper", 1000, 450, 600); put result; end;run;
Reference for language elementsVersion 3.3
771
This produces the following output:
The random numbers are: 282272285273271
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 258266277277274
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(18); put "The random numbers are: "; do i = 1 to 5; result = rand("hyper", 1000, 450, 600); put result; end;run;
This produces the following output:
The random numbers are: 264279283271270
If you were to run the program again, the same set of numbers would be returned.
INVERSE GAUSSIAN Distribution
Generate a random number from a inverse Gaussian distribution.
RAND ( "INVERSE GAUSSIAN" , mean , shape )
Generates a random number from an inverse Gaussian distribution, and returns the result. Youparameterise the distribution by specifying the mean and scale.
Reference for language elementsVersion 3.3
772
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
mean
Type: Numeric
The mean of the distribution.
shape
Type: Numeric
The shape for the distribution.
The random number returned will be a positive decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("inverse gaussian", 50, 4); put result; end;run;
This produces the following output:
The random numbers are: 19.21689432788.8421562386.68454102495.39189849931.6023162835
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are:1.570214641512.6944375831.9724358952.41175571275.2739838598
Reference for language elementsVersion 3.3
773
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(12); put "The random numbers are: "; do i = 1 to 5; result = rand("inverse gaussian", 50, 4); put result; end;run;
This produces the following output:
The random numbers are: 5.08417495681.25540452380.41100299094.247636031410.979380548
If you were to run the program again, the same set of numbers would be returned.
LOGNORMAL Distribution
Generate a random number from a log-normal distribution.
RAND ( "LOGNORMAL" )
Generates a random number from a log-normal distribution, and returns the result. The distribution isparameterised using a mean and standard deviation of 0 and 1 respectively.
No argument is required.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
The random number returned will be a positive decimal number.
Reference for language elementsVersion 3.3
774
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("lognormal"); put result; end;run;
This produces the following output:
The random numbers are: 0.50241412250.36460484291.14005183514.19753184630.1907837004
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 0.13530044620.66021266872.94206704791.25572632940.7885070773
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; put "The random numbers are: "; call streaminit(9); do i = 1 to 5; result = rand("lognormal"); put result; end;run;
This produces the following output:
The random numbers are: 1.75064454180.52037944062.99961400741.65728967350.1503519974
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
775
NEGBINOMIAL Distribution
Generate a random number from a negative binomial distribution.
RAND ( "NEGBINOMIAL" , probability , number-of-successes )
Generates a random number from a negative binomial distribution, and returns the result. Youparameterise the distribution by specifying the probability of success for each trial, and the number ofsuccesses.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
probability
Type: Numeric
The probability of success of each trial.
number-of-successes
Type: Numeric
The number of successful trials.
The random number returned will be a positive decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("negbinomial", 0.79,100); put result; end;run;
This produces the following output:
The random numbers are: 66.38684603673.39173288368.26997895872.46794719754.952402765
Reference for language elementsVersion 3.3
776
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 62.83503356571.09015320366.89437298755.93353540665.669639433
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; put "The random numbers are: "; call streaminit(9); do i = 1 to 5; result = rand("negbinomial", 0.79,100); put result; end;run;
This produces the following output:
The random numbers are: 63.2627440769.84991072361.80756063664.03633337573.657909167
If you were to run the program again, the same set of numbers would be returned.
NORMAL Distribution
Generate a random number from a normal (Gaussian) distribution.
RAND ( "NORMAL" , [ mean ] [ , variance ] )
Generates a random number from a normal (Gaussian) distribution, and returns the result. Youparameterise the distribution by specifying the mean and variance of the distribution.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
meanOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
777
The mean of the distribution.
varianceOptional argument
Type: Numeric
The variance of the distribution from the mean.
The random number returned will be a real number in the range (-∞, +∞); that is, greater than -∞ andless than ∞.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("normal", 10,5); put result; end;run;
This produces the following output:
The random numbers are: -1.74642084415.46945974411.23535835110.3045860732.0368974722
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 0.38167049150.34732014280.3726214430.37329038650.4076553479
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(111); put "The random numbers are: "; do i = 1 to 5; result = rand("normal", 10,5); put result; end;run;
Reference for language elementsVersion 3.3
778
This produces the following output:
The random numbers are: 1.323432845912.17923101612.84684950616.76804465112.22727412
If you were to run the program again, the same set of numbers would be returned.
PARETO Distribution
Generate a random number from a Pareto distribution.
RAND ( "PARETO" , shape )
Generates a random number from a Pareto distribution, and returns the result. You parameterise thedistribution by specifying a shape parameter; a default scale parameter is used.
No argument is required.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
shape
Type: Numeric
The shape of the distribution.
The random number returned will be a positive decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("pareto", 15); put result; end;run;
Reference for language elementsVersion 3.3
779
This produces the following output:
The random numbers are: 1.13686190621.06277078921.00618617231.07204403221.0517167879
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 1.17615792491.05384617921.06969853081.06371532451.0401712807
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; put "The random numbers are: "; call streaminit(12); do i = 1 to 5; result = rand("pareto", 15); put result; end;run;
This produces the following output:
The random numbers are: 1.03658976451.02584967791.07653565551.01163399651.0525305894
If you were to run the program again, the same set of numbers would be returned.
POISSON Distribution
Generate a random number from a Poisson distribution.
RAND ( "POISSON" , mean )
Generates a random number from a Poisson distribution, and returns the result. You parameterise thedistribution by specifying the mean.
Reference for language elementsVersion 3.3
780
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
mean
Type: Numeric
The mean of the distribution.
The random number returned will be a natural number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("poisson", 21); put result; end;run;
This produces the following output:
The random numbers are: 2225182223
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 1824221819
Reference for language elementsVersion 3.3
781
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; put "The random numbers are: "; call streaminit(9); do i = 1 to 5; result = rand("poisson", 21); put result; end;run;
This produces the following output:
The random numbers are: 2318262313
If you were to run the program again, the same set of numbers would be returned.
POWER Distribution
Generate a random number from a power law distribution.
RAND ( "POWER" , shape )
Generates a random number from a power law distribution, and returns the result. You parameterisethe distribution by specifying a shape.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
shape
Type: Numeric
The shape of the distribution.
The random number returned will be a positive decimal number.
Reference for language elementsVersion 3.3
782
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("power", 5); put result; end;run;
This produces the following output:
The random numbers are: 0.92136910460.80197312890.7849806680.75685619930.9939329395
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 0.93156271330.76621255040.97040905360.83532392840.8949201734
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; put "The random numbers are: "; call streaminit(12); do i = 1 to 5; result = rand("power", 5); put result; end;run;
This produces the following output:
The random numbers are: 0.89779927710.92629393550.8015207030.96589463350.8576218172
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
783
RAYLEIGH Distribution
Create a random number from Rayleigh distribution.
RAND ( "RAYLEIGH" )
Return type: Numeric
Generates a random number from a Rayleigh distribution, and returns the result. The distribution isparameterised using a default scale value of 2.0.
No argument is required.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
The random number returned will be a positive decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("rayleigh"); put result; end;run;
This produces the following output:
The random numbers are: 1.88606681021.65242860071.89055692440.9833272761.5175924268
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 2.05365827781.94431913780.90085925281.32041582190.362170589
Reference for language elementsVersion 3.3
784
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; put "The random numbers are: "; call streaminit(12); do i = 1 to 5; result = rand("rayleigh"); put result; end;run;
This produces the following output:
The random numbers are: 1.03830996230.87500668431.48742891250.58907152181.239322594
If you were to run the program again, the same set of numbers would be returned.
T Distribution
Generate a random number from a Student's t-distribution.
RAND ( "T" , degrees-of-freedom )
Generates a random number from a t-distribution, and returns the result. You parameterise thedistribution by specifying the number of degrees of freedom.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
degrees-of-freedom
Type: Numeric
The number of degrees of freedom.
The random number returned will be a positive or negative decimal number.
Reference for language elementsVersion 3.3
785
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("t", 10); put result; end;run;
This produces the following output:
The random numbers are: 0.19703401782.27747599680.71337086141.6070218831-0.539787121
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 1.4278503855-1.424301771-0.5255674291.1571239401-0.379811436
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(20); put "The random numbers are: "; do i = 1 to 5; result = rand("t", 10); put result; end;run
This produces the following output:
The random numbers are: -0.0374706780.39815608651.36248545012.4989899483-0.798725141
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
786
TABLE Distribution
Generate a random number from a discrete probability distribution.
RAND ( "TABLE" , { probability , … } )
Generates a random number from a discrete distribution of categories, and returns the result. Youparameterise the distribution by specifying probabilities for each category.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
probability
Type: Numeric
A probability from the table probability.
The number returned will be the number randomly of a selected category. If the probabilities sum to1, an ordinal number will be applied to each probability in the order they are specified. For example,in rantbl(5, 0.75,0.25) the 0.75 probability will be assigned to category 1, and 0.25 assignedto category 2. The random numbers returned would then be either 1 or 2, and would be expected tooccur, on average, 75% and 25% of the time respectively. If you specified rantbl(5, 0.25, 0.25,0.5, 0.25):
• The first 0.25 probability will be assigned to category 1• The second 0.25 probability assigned to category 2• The 0.5 probability assigned to category 3• The final 0.25 probability to category 4
The random numbers returned would then be in the range 1 through 4; the numbers 1, 2 and 4 wouldappear, on average, 25% of the time, while the number 3 would appear, on average 50% of the time.
If the numbers sum to less than 1, then a category is created that represents the probability required tosum to 1. For example, rantbl(5,0.5,0.2,0.1) would result in four categories, with the number 4assigned to the probability 0.2 that would be required to sum the probabilities to 1.
If the numbers sum to greater than 1, the result depends on which of the arguments caused theprobability to sum to 1. If it is the final argument, then the category assigned will only representthe probability required to sum to 1. For example, rantbl(5,0.5,0.3,0.3) would result inthree categories, with the number 3 assigned the probability 0.2 that would be required to sum theprobabilities to 1; that is, 3 would only be expected to be returned 20% of the time, rather than 30%of the time. If the probabilities sum to 1 before the final argument, then the arguments beyond theargument that causes the probabilities to sum to 1 are discarded. For example, if you specifiedrantbl(5,0.6,0.6,0.3,0.2), only two categories would be specified: category 1 with a probabilityof occurring, on average, 60% of the time, and 2 occurring, on average, 40% of the time.
Reference for language elementsVersion 3.3
787
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("table",0.2,0.5,0.2,0.1); put result; end;run;
This produces the following output:
The random numbers are: 13331
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 32232
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; put "The random numbers are: "; call streaminit(9); do i = 1 to 5; result = result = rand("table",0.7); put result; end;run;
This produces the following output:
The random numbers are: 3232122422
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
788
TRIANGLE Distribution
Generate a random number from a triangular distribution.
RAND ( "TRIANGLE" , mode )
Generates a random number from a triangular distribution, and returns the result. You parameterise thedistribution by specifying a mode for the distribution.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
mode
Type: Numeric
The mode of the distribution.
The random number returned will be number in the range [0,1]; that is, from 0 through 1.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("triangle",0.78); put result; end;run;
This produces the following output:
The random numbers are:0.29099090690.52977774260.27789856070.74230499240.7418666133
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 0.42412741960.54467751170.76735641870.44225575750.7960401493
Reference for language elementsVersion 3.3
789
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(9); put "The random numbers are: "; do i = 1 to 5; result = rand("triangle",0.78); put result; end;run;
This produces the following output:
The random numbers are: 0.74535814940.44756609650.82702812230.73536543810.1505576581
If you were to run the program again, the same set of numbers would be returned.
UNIFORM Distribution
Generate a random number from a uniform distribution.
RAND ( "UNIFORM" )
Generates a random number from a uniform distribution, and returns the result.
No argument is required.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
The random number returned will be a positive decimal number in the range (0,1); that is, greater than 0and less than 1.
Reference for language elementsVersion 3.3
790
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("uniform"); put result; end;run;
This produces the following output:
The random numbers are: 0.9545245760.56546238680.01921140850.66544829790.5257064517
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 0.58949059330.38427835010.27550296490.28090839560.8773915851
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(9); put "The random numbers are: "; do i = 1 to 5; result = rand("uniform"); put result; end;run;
This produces the following output:
The random numbers are: 0.71225483450.25681462910.8640033160.69328503540.0290610364
If you were to run the program again, the same set of numbers would be returned.
Reference for language elementsVersion 3.3
791
WEIBULL Distribution
RAND ( "WEIBULL" , shape , scale )
Generates a random number from a Weibull distribution, and returns the result. You parameterise thedistribution by specifying arguments for shape and scale.
Each time you execute this function, a different random number is generated. However, you can specifythat the same random number is generated; you do this by calling CALL STREAMINIT before usingthe function. This enables you to create a program in which the same numbers are generated from thedistribution each time; this might be required if results need replication.
Return type: Numeric
shape
Type: Numeric
The shape of the distribution.
scale
Type: Numeric
The scale of the distribution.
The random number returned will be a positive decimal number.
ExampleIn the following example, the function is used to return a random number. The result is written to the logand to the example dataset.
data example; put "The random numbers are: "; do i = 1 to 5; result = rand("weibull", 5,20); put result; end;run
This produces the following output:
The random numbers are: 11.4565110710.63366708519.25669223614.98774859411.624668812
Reference for language elementsVersion 3.3
792
If you were to run the program again, a different set of numbers would be returned. Using the exampleabove, running the program again produces:
The random numbers are: 14.19283711721.53435047519.9520705220.57154254618.188153803
However, if you were to first use CALL STREAMINIT to specify a seed, each run would produce thesame series of numbers; for example:
data example; call streaminit(9); put "The random numbers are: "; do i = 1 to 5; result = rand("weibull", 5,20); put result; end;run;;
This produces the following output:
The random numbers are: 1.75064454180.52037944062.99961400741.65728967350.1503519974
If you were to run the program again, the same set of numbers would be returned.
Special functions and call routines
ADDR
ADDR ( variable )
Return type: Numeric
variable
Type: Var
Reference for language elementsVersion 3.3
793
ADDRX
ADDRX ( variable-name )
Return type: Numeric
variable-name
Type: Character
ADDRLONG
ADDRLONG ( variable )
Return type: Character
variable
Type: Var
ADDRLONGX
ADDRLONGX ( variable-name )
Return type: Character
variable-name
Type: Character
CALL POKE
CALL POKE ( source , pointer [ , length ] );
Reference for language elementsVersion 3.3
794
source
Type: Character
pointer
Type: Numeric
lengthOptional argument
Type: Numeric
CALL POKELONG
CALL POKELONG ( source , pointer [ , length ] );
source
Type: Character
pointer
Type: Character
lengthOptional argument
Type: Numeric
CALL SLEEP
CALL SLEEP ( n [ , unit ] );
n
Type: Numeric
unitOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
795
CALL SOUND
CALL SOUND ( frequency , duration );
frequency
Type: Numeric
duration
Type: Numeric
CALL SYSTEM
CALL SYSTEM ( argument );
argument
Type: Character
ENVLEN
ENVLEN ( environment-variable )
Return type: Numeric
environment-variable
Type: Character
GETOPTION
GETOPTION ( option-name [ , return-value-option ] )
Return type: Character
Reference for language elementsVersion 3.3
796
option-name
Type: Character
return-value-optionOptional argument
Type: Character
INPUTC
INPUTC ( argument , informat [ , w ] )
Return type: Character
argument
Type: Character
informat
Type: Character
wOptional argument
Type: Numeric
INPUTN
INPUTN ( argument , informat , [ w ] [ , d ] )
Return type: Numeric
argument
Type: Character
informat
Type: Character
Reference for language elementsVersion 3.3
797
wOptional argument
Type: Numeric
dOptional argument
Type: Numeric
LOOKSLIKENUMBER
LOOKSLIKENUMBER ( argument )
Return type: Numeric
argument
Type: Character
PEEK
PEEK ( address [ , length ] )
Return type: Numeric
address
Type: Numeric
lengthOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
798
PEEKC
PEEKC ( address [ , length ] )
Return type: Character
address
Type: Numeric
lengthOptional argument
Type: Numeric
PEEKCLONG
PEEKCLONG ( address [ , length ] )
Return type: Character
address
Type: Character
lengthOptional argument
Type: Numeric
PEEKLONG
PEEKLONG ( address [ , length ] )
Return type: Numeric
address
Type: Character
Reference for language elementsVersion 3.3
799
lengthOptional argument
Type: Numeric
PTRLONGADD
PTRLONGADD ( address , amount )
Return type: Character
address
Type: Character
amount
Type: Numeric
PUTC
PUTC ( argument , format [ , w ] )
Return type: Character
argument
Type: Character
format
Type: Character
wOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
800
PUTN
PUTN ( argument , format , [ w ] [ , d ] )
Return type: Character
argument
Type: Numeric
format
Type: Character
wOptional argument
Type: Numeric
dOptional argument
Type: Numeric
SLEEP
SLEEP ( n [ , unit ] )
Return type: Numeric
n
Type: Numeric
unitOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
801
SYSGET
SYSGET ( environment-variable )
Return type: Character
environment-variable
Type: Character
SYSPARM
SYSPARM ( )
Return type: Character
SYSPROCESSID
SYSPROCESSID ( )
Return type: Character
SYSPROCESSNAME
SYSPROCESSNAME ( [ , process-id ] )
Return type: Character
process-idOptional argument
Type: Character
Reference for language elementsVersion 3.3
802
SYSPROD
SYSPROD ( argument )
Return type: Numeric
argument
Type: Character
SYSTEM
SYSTEM ( argument )
Return type: Numeric
argument
Type: Character
UUIDGEN
UUIDGEN ( [ unused ] [ , binary-uuid ] )
Return type: Character
unusedOptional argument
Type: Numeric
binary-uuidOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
803
Statistical functionsFunctions that perform statistical operations on the data.
The functions in this section are defined either for numeric and character values, or for numeric valuesonly. In the latter case if a character string is presented where a number is expected, the string isconverted into a numeric value if it represents a number, or it is considered missing otherwise.
Value countsFunctions that return counts for lists of values.
CMISS Returns the number of missing values in a list of character or numeric values.NMISS Returns the number of missing values in a list of numeric values.N Returns the number of non-missing values in a list of numeric values.
Examples in this section use a list of values containing a mix of numeric, character and missing values:
1, -2, 3, ., "a", "4", ""
CMISS
Returns the number of missing values in a list of character or numeric values.
CMISS ( { value , … } )
This function is defined for character and numeric values.
Return type: Numeric
value
Type: Character or numeric value
The value(s) to be evaluated.
Exampledata example; c = cmiss(1,-2,3,.,"a","4","");run;
The output is 2, as only the fourth (.) and last ("") values are considered missing.
Reference for language elementsVersion 3.3
804
NMISS
Returns the number of missing values in a list of numeric values.
NMISS ( { value , … } )
This function is defined for numeric values only.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; n = nmiss(1,-2,3,.,"a","4",""); run;
The output is 3, as the sixth value ("4") has been converted into a number, but the fourth (.), the fifth("a") and last ("") values are considered missing.
N
Returns the number of non-missing values in a list of numeric values.
N ( { value , … } )
This function is defined for numeric values only.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; n = n(1,-2,3,.,"a","4","");run;
The output is 4, as the sixth value ("4") has been converted into a number, but the fourth (.), the fifth("a") and last ("") values are considered missing.
Reference for language elementsVersion 3.3
805
Minimum and maximum valuesFunctions that operate on the minimum and maximum in a list of values.
MIN Returns the minimum value in a list of numeric values.MAX Returns the maximum value in a list of numeric values.RANGE Returns the difference between the maximum and minimum value in a list of numeric
values.SMALLEST Returns the n-th smallest value in a list of numeric values.LARGEST Returns the n-th largest value in a list of numeric values.ORDINAL Returns the n-th smallest value in a list of numeric or missing values.
Examples in this section use a list of values containing a mix of numeric, character and missing values:
1, -2, 3, ., "a", "4", ""
MIN
Returns the minimum value in a list of numeric values.
MIN ( v1 , { value , … } )
This function is defined for numeric values only, at least two values are required. It considers non-missing values and returns the minimum among them.
If all values are missing, a missing value is returned.
Return type: Numeric
v1
Type: Numeric
The first value in the list.
value
Type: Numeric
Further value(s) to be evaluated.
Exampledata example; m = min(1,-2,3,.,"a","4","");run;
The output is -2, as the sixth value ("4") has been converted into a number, but the fourth (.), the fifth("a") and last ("") values are considered missing.
Reference for language elementsVersion 3.3
806
MAX
Returns the maximum value in a list of numeric values.
MAX ( v1 , { value , … } )
This function is defined for numeric values only, at least two values are required. It considers non-missing values and returns the maximum among them.
If all values are missing, a missing value is returned.
Return type: Numeric
v1
Type: Numeric
The first value in the list.
value
Type: Numeric
Further value(s) to be evaluated.
Exampledata example; m = max(1,-2,3,.,"a","4","");run;
The output is 4, as the sixth value ("4") has been converted into a number, but the fourth (.), the fifth("a") and last ("") values are considered missing.
RANGE
Returns the difference between the maximum and minimum value in a list of numeric values.
RANGE ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns thearithmetic difference between the maximum and the minimum.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Reference for language elementsVersion 3.3
807
Exampledata example; range = range(1,-2,3,.,"a","4","");run;
The output is 4 - (-2) = 6.
SMALLEST
Returns the n-th smallest value in a list of numeric values.
SMALLEST ( n , { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns the n-thsmallest among them.
Return type: Numeric
n
Type: Numeric
The order of the value to find.
If the argument is out of range or contains a missing value, a missing value is returned.
value
Type: Numeric
The value(s) to be evaluated.
If all values are missing, a missing value is returned.
Exampledata example; s = smallest(2, 1,-2,3,.,"a","4","");run;
The second smallest value is 1, as the sixth value ("4") has been converted into a number, but thefourth (.), the fifth ("a") and last ("") values are considered missing.
LARGEST
Returns the n-th largest value in a list of numeric values.
LARGEST ( n , { value , … } )
Reference for language elementsVersion 3.3
808
This function is defined for numeric values only. It considers non-missing values and returns the n-thlargest among them.
Return type: Numeric
n
Type: Numeric
The order of the value to find.
If the argument is out of range or contains a missing value, a missing value is returned.
value
Type: Numeric
The value(s) to be evaluated.
If all values are missing, a missing value is returned.
Exampledata example; l = largest(2, 1,-2,3,.,"a","4","");run;
The second largest value is 3, as the sixth value ("4") has been converted into a number, but thefourth (.), the fifth ("a") and last ("") values are considered missing.
ORDINAL
Returns the n-th smallest value in a list of numeric or missing values.
ORDINAL ( n , { value , … } )
This function is defined for numeric and missing values, with character values that cannot be convertedinto numbers, considered missing. It returns the n-th smallest value in the list. Missing values areconsidered smaller than any non-missing values.
Return type: Numeric
n
Type: Numeric
The order of the value to find.
If the argument is out of range or contains a missing value, a missing value is returned.
value
Type: Numeric
Reference for language elementsVersion 3.3
809
The value(s) to be evaluated.
If all values are missing, a missing value is returned.
Exampledata example; o1 = ordinal(1, 1,-2,3,.,"a","4",""); o2 = ordinal(2, 1,-2,3,.,"a","4",""); o3 = ordinal(3, 1,-2,3,.,"a","4",""); o4 = ordinal(4, 1,-2,3,.,"a","4","");run;
The first value in the argument list is the function parameter n. The remainder forms the list of values toprocess.
The sixth value ("4") has been converted into a number, but the fourth (.), the fifth ("a") and last ("")values are considered missing. The function returns a missing value (.) as the first, second and thirdsmallest value in the list (o1, o2 and o3, respectively). The fourth smallest value returned (o4) is -2, thesmallest non-missing value in this example.
Percentile-based calculationsFunctions that calculate percentile-based values.
PCTL Returns a percentile of a list of numeric values.MEDIAN Returns the median of a list of numeric values.
pctl5(50, x1, …, xn)
MAD Returns the median absolute deviation from the median of a list of numeric values.
median (|x1 - median(x1, …, xn)|, …, |xn - median(x1, …, xn)|)
IQR Returns the inter-quartile range of a list of numeric values.
pctl5(75, x1, …, xn) - pctl5(25, x1, …, xn)
Examples in this section use two similar lists of values. The first list contains values close to each other,while the second list contains the same values plus a significantly larger outlier:
1.1, 1.2, 1.3, 1.4, 1.5, 1, -2, 3, ., "a", "4", ""
1.1, 1.2, 1.3, 1.4, 1.5, 1, -2, 3, ., "a", "4", "", 1e15
Reference for language elementsVersion 3.3
810
PCTL
Returns a percentile of a list of numeric values.
PCTL ( p , { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns theirspecified percentile p.
Return type: Numeric
p
Type: Numeric
The percentile to find.
Restriction: 0≥p≥100
If the argument is out of range or contains a missing value, a missing value is returned.
value
Type: Numeric
The value(s) to be evaluated.
If all values are missing, a missing value is returned.
There are five methods for percentile calculation implemented by the correspondingly numberedfunctions PCTL1 through PCTL5. The unnumbered function PCTL calls the default: method 5.
Percentiles are calculated as follows:
1. Non-missing values are sorted into ascending order allowing the identification of two adjacent valuesxi and xi+1 between which falls the specified percentile. The index i is calculated using a helpervariable q depending on the method:
method 4 q = p(n+1) / 100
methods 1, 2, 3 and 5 q = pn / 100
Using q, index i and a helper value h needed in the next step, are calculated based on the floor of q,or rounding down to the nearest whole number:
⌊q⌋ = floor(q)
i = ⌊q⌋ - 1
h = q - ⌊q⌋
2. The percentile is calculated based on i-th and i+1-st values from the sorted list:
methods 1 and 4 (1-h)xi + hxi+1
method 2 If h < 0.5 return xi
Reference for language elementsVersion 3.3
811
If h > 0.5 return xi+1
If h = 0.5 and i is even, return xi
If h = 0.5 and i is odd, return xi+1
method 3 If h = 0 return xi otherwise return xi+1
method 5 If h = 0 return (xi + xi+1) / 2 otherwise return xi+1
ExampleAs an example, consider the 0-, 25-, 50-, 75- and 100-percentile of the two value lists used in thissection:
data example; do i = 0 to 100 by 25; p1 = pctl1(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); p2 = pctl2(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); p3 = pctl3(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); p4 = pctl4(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); p5 = pctl5(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); output; end;
do i = 0 to 100 by 25; p1 = pctl1(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15); p2 = pctl2(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15); p3 = pctl3(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15); p4 = pctl4(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15); p5 = pctl5(i, 1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15); output; end;run;
The output is as follows:
value list 1 value list 2percentile PCTL1 PCTL2 PCTL3 PCTL4 PCTL5 PCTL1 PCTL2 PCTL3 PCTL4 PCTL5
0 -2 -2 -2 -2 -2 -2 -2 -2 -2 -225 1.025 1 1.1 1.05 1.1 1.05 1 1.1 1.075 1.150 1.25 1.2 1.3 1.3 1.3 1.3 1.3 1.3 1.35 1.3575 1.475 1.5 1.5 2.25 1.5 2.25 3 3 3.25 3
100 4 4 4 4 4 1015 1015 1015 1015 1015
MEDIAN
Returns the median of a list of numeric values.
MEDIAN ( { value , … } )
Reference for language elementsVersion 3.3
812
This function is defined for numeric values only. It considers non-missing values and returns theirmedian calculated as a 50-percentile using function PCTL5, see section PCTL:
pctl5(50, x1, …, xn)
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; m1 = median(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); m2 = median(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15);run;
The output is: m1=1.3 and m2=1.35. The outlier in the second value list has only a small impact on themedian.
MAD
Returns the median absolute deviation from the median of a list of numeric values.
MAD ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns the medianabsolute deviation from their median, see MEDIAN for more information:
median (|x1 - median(x1, …, xn)|, …, |xn - median(x1, …, xn)|)
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Reference for language elementsVersion 3.3
813
Exampledata example; d1 = mad(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); d2 = mad(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15);run;
This function uses median calculations of the same values shown in variables m1 and m2:
IQR
Returns the inter-quartile range of a list of numeric values.
IQR ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns their inter-quartile range calculated using function PCTL5, (see PCTL for more information) as the differencebetween the 75-percentile and the 25-percentile of the value list:
pctl5(75, x1, …, xn) - pctl5(25, x1, …, xn)
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; q1 = iqr(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); q2 = iqr(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15);run;
Reference for language elementsVersion 3.3
814
The output is:
Sums and sums of squaresFunctions that return sums and sums of squares of a list of numeric values.
SUM Returns the sum of values of a list of numeric values.
SUMABS Returns the sum of absolute values of a list of numeric values.
USS Returns the uncorrected sum of squares of a list of numericvalues.
CSS Returns the corrected sum of squares of a list of numericvalues.
EUCLID Returns the Euclidean norm of a list of numeric values.
RMS Returns the root mean square of a list of numeric values.
LPNORM Returns the Lp norm of a list of numeric values.
Examples in this section use a list of values containing a mix of numeric, character and missing values:
1, -2, 3, ., "a", "4", ""
SUM
Returns the sum of values of a list of numeric values.
SUM ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns theirarithmetic sum:
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Reference for language elementsVersion 3.3
815
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; s = sum(1,-2,3,.,"a","4","");run;
The output is: 1-2+3+4 = 6.
SUMABS
Returns the sum of absolute values of a list of numeric values.
SUMABS ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns the sum oftheir absolute values, also known as the Manhattan norm:
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; s = sumabs(1,-2,3,.,"a","4","");run;
The output is: |1| + |-2| + |3| + |4| = 10.
Reference for language elementsVersion 3.3
816
USS
Returns the uncorrected sum of squares of a list of numeric values.
USS ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns theiruncorrected sum of squares:
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; u = uss(1,-2,3,.,"a","4","");run;
The output is: 12+(-2)2+32+42 = 30.
CSS
Returns the corrected sum of squares of a list of numeric values.
CSS ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns theircorrected sum of squares:
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
Reference for language elementsVersion 3.3
817
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; c = css(1,-2,3,.,"a","4","");run;
The output is: 12+(-2)2+32+42 - 1/4(1-2+3+4)2 = 21.
EUCLID
Returns the Euclidean norm of a list of numeric values.
EUCLID ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns theirEuclidean norm:
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; d = euclid(1,-2,3,.,"a","4","");run;
The output is: .
Reference for language elementsVersion 3.3
818
RMS
Returns the root mean square of a list of numeric values.
RMS ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns their rootmean square:
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; r = rms(1,-2,3,.,"a","4","");run;
The output is: .
LPNORM
Returns the Lp norm of a list of numeric values.
LPNORM ( p , { value , … } )
This function is defined for numeric values only with p≥1. It considers non-missing values and returnstheir Lp norm:
where n is the number of non-missing values in the list.
Return type: Numeric
Reference for language elementsVersion 3.3
819
p
Type: Numeric
The order of the L-norm.
Restriction: p≥1
If the argument is out of range or contains a missing value, a missing value is returned.
value
Type: Numeric
The value(s) to be evaluated.
If all values are missing, a missing value is returned.
The first two Lp norms, L1 or the Manhattan norm, and L2 or the Euclidean norm, are also implementedwith functions SUMABS and EUCLID, see sections SUMABS and EUCLID, respectively.
Exampledata example; s = sumabs( 1,-2,3,.,"a","4",""); e = euclid( 1,-2,3,.,"a","4",""); l1 = lpnorm(1, 1,-2,3,.,"a","4",""); l2 = lpnorm(2, 1,-2,3,.,"a","4",""); l3 = lpnorm(3, 1,-2,3,.,"a","4",""); l4 = lpnorm(4, 1,-2,3,.,"a","4","");run;
The output is:
Mean calculationsFunctions that calculate mean values.
MEAN Returns the arithmetic mean of a list of numeric values.
GEOMEANZ Returns the geometric mean of a list of numeric values.GEOMEAN Returns the geometric mean of a list of numeric values if their
spread is not too great. Returns zero otherwise.
Reference for language elementsVersion 3.3
820
HARMEANZ Returns the harmonic mean of a list of numeric values.HARMEAN Returns the harmonic mean of a list of numeric values if their
spread is not too great. Returns zero otherwise.
Examples in this section use two similar lists of values. The first list contains values close to each other,while the second list contains the same values plus a significantly larger outlier. In addition, the thirdvalue list contains a zero value:
1.1, 1.2, 1.3, 1.4, 1.5, 1, 2, 3, ., "a", "4", ""
1.1, 1.2, 1.3, 1.4, 1.5, 1, 2, 3, ., "a", "4", "", 1e15
1.1, 1.2, 1.3, 1.4, 1.5, 1, 2, 3, ., "a", "4", "", 0
Note that these value lists only contain non-negative numbers because some of the functions are notdefined for negative numbers.
MEAN
Returns the arithmetic mean of a list of numeric values.
MEAN ( { value , … } )
This function is defined for numeric values only. It considers non-missing values and returns theirarithmetic mean:
where n is the number of non-missing values in the list.
If all values are missing, a missing value is returned.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Exampledata example; m1 = mean(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4",""); m2 = mean(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4","",1e15);run;
Reference for language elementsVersion 3.3
821
The output is:
Notice the rounding error in value m2.
GEOMEANZ
Returns the geometric mean of a list of numeric values.
GEOMEANZ ( { value , … } )
This function is defined for non-negative numeric values only. It considers non-missing values andreturns their geometric mean:
where n is the number of non-missing values in the list.
Note that if one of the values is zero, the result is always zero too.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Restriction: value ≥ 0
If any of the values is negative or if all values are missing, a missing value is returned.
Exampledata example; m1 = geomeanz(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4",""); m2 = geomeanz(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4","",1e15);run;
The output is:
Reference for language elementsVersion 3.3
822
GEOMEAN
Returns the geometric mean of a list of numeric values if their spread is not too great. Returns zerootherwise.
GEOMEAN ( { value , … } )
This function is defined for non-negative numeric values only. It considers non-missing values andreturns their geometric mean:
where n is the number of non-missing values in the list.
Note that if one of the values is zero, the result is always zero too.
The above calculation is the same as in GEOMEANZ function (see section GEOMEANZ), but if thedifference between the minimum and maximum values (the spread) exceeds 1013, zero is returnedinstead of the actual mean.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Restriction: value ≥ 0
If any of the values is negative or if all values are missing, a missing value is returned.
Exampledata example; m1 = geomean(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4",""); m2 = geomean(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4","",1e15);run;
The output is:
The output for m1 is the same as that returned by the GEOMEANZ function. However, the output for m2 iszero because the spread of the second value list is too great.
Reference for language elementsVersion 3.3
823
HARMEANZ
Returns the harmonic mean of a list of numeric values.
HARMEANZ ( { value , … } )
This function is defined for positive numeric values only. It considers non-missing values and returnstheir harmonic mean:
where n is the number of non-missing values in the list.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Restriction: value > 0
If any of the values is negative or if all values are missing, a missing value is returned.
If one of the values is zero, computation is not attempted and zero is returned.
Exampledata example; m1 = harmeanz(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4",""); m2 = harmeanz(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4","",1e15); m3 = harmeanz(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4","",0);run;
The output is:
The third example contains a zero value in the list. Attempting to compute harmonic mean would resultin division by zero, therefore computation is not attempted and zero is returned.
Reference for language elementsVersion 3.3
824
HARMEAN
Returns the harmonic mean of a list of numeric values if their spread is not too great. Returns zerootherwise.
HARMEAN ( { value , … } )
This function is defined for positive numeric values only. It considers non-missing values and returnstheir harmonic mean:
where n is the number of non-missing values in the list.
The above calculation is the same as in HARMEANZ function (see section HARMEANZ), but if thedifference between the minimum and maximum values (the spread) exceeds 1013, zero is returnedinstead of the actual mean.
Return type: Numeric
value
Type: Numeric
The value(s) to be evaluated.
Restriction: value > 0
If any of the values is negative or if all values are missing, a missing value is returned.
If one of the values is zero, computation is not attempted and zero is returned.
Exampledata example; m1 = harmean(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4",""); m2 = harmean(1.1,1.2,1.3,1.4,1.5,1,2,3,.,"a","4","",1e15);run;
The output is:
The output for m1 is the same as that returned by the HARMEANZ function. However, the output for m2 iszero because the spread of the second value list is too great.
Reference for language elementsVersion 3.3
825
Variance, skewness and kurtosis calculationsFunctions based on the moments about the mean: calculations of variance, skewness, kurtosis andrelated values.
Moment Derived statistics Related valuesSecond moment about the mean Variance
Coefficient of variance, standarddeviation and standard error
Third moment about the mean Skewness
Fourth moment about the mean Kurtosis
The centre of the moments is the arithmetic mean (see MEAN):
The formulae in this section define statistics that estimate the corresponding population parameters. Apopulation parameter is a characteristic based on the entire population of values, whereas a statisticis an estimate of a population parameter based on a sample of values randomly drawn from thepopulation. The same population parameter can have several statistics associated with it, as it canbe estimated in several ways. In general, unless the complete population is known and available forcomputation, it is not possible to calculate a population parameter directly, so population statistics areused instead.
Population parameters and some statistics often have widely known identifiers, such as the ones usedin this section. Note that such identifiers may not be adopted universally, and may sometimes be usedto denote other entities. Please confirm your notation if unsure.
For more information on population parameters, statistics, moments about the mean as well asidentifiers as used in this section, see for example Sheskin, D.J. (2000) Handbook of Parametric andNonparametric Statistical Procedures, Second Edition. Boca Raton, Florida: Chapman & Hall/CRC.
VAR Returns the variance of a list of numeric values.
CV Returns the coefficient of variation of a list of numeric values.
STD Returns the standard deviation of a list of numeric values.
STDERR Returns the standard error of the mean of a list of numericvalues.
SKEWNESS Returns the skewness of a list of numeric values.
Reference for language elementsVersion 3.3
826
KURTOSIS Returns the kurtosis of a list of numeric values.
Examples in this section use two similar lists of values. The first list contains values close to each other,while the second list contains the same values plus a significantly larger outlier:
1.1, 1.2, 1.3, 1.4, 1.5, 1, -2, 3, ., "a", "4", ""
1.1, 1.2, 1.3, 1.4, 1.5, 1, -2, 3, ., "a", "4", "", 1e15
VAR
Returns the variance of a list of numeric values.
VAR ( v1 , { value , … } )
This function is defined for numeric values only, at least two values are required. It considers non-missing values and returns their variance , or the second moment about the mean. The returnedstatistic is the unbiased estimate of the population variance σ2. See Variance, skewness and kurtosiscalculations for more information on moments about the mean, population parameters and statistics.
where n is the number of non-missing values in the list.
If only one value is available or if all values are missing, a missing value is returned.
Return type: Numeric
v1
Type: Numeric
The first value in the list.
value
Type: Numeric
Further value(s) to be evaluated.
Exampledata example; s1 = var(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); s2 = var(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15);run;
Reference for language elementsVersion 3.3
827
The output is:
The outlier in the second sample dramatically increases the variance.
CV
Returns the coefficient of variation of a list of numeric values.
CV ( v1 , { value , … } )
This function is defined for numeric values only, at least two values are required. It considers non-missing values and returns their coefficient of variation cv expressed in percent, using their variance (see VAR) and their mean (see MEAN):
where n is the number of non-missing values in the list.
If only one value is available or if all values are missing, a missing value is returned.
Return type: Numeric
v1
Type: Numeric
The first value in the list.
value
Type: Numeric
Further value(s) to be evaluated.
Reference for language elementsVersion 3.3
828
Exampledata example; c1 = cv(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); c2 = cv(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15);run;
The output is:
STD
Returns the standard deviation of a list of numeric values.
STD ( v1 , { value , … } )
This function is defined for numeric values only, at least two values are required. It considers non-missing values and returns their standard deviation using their variance (see section VAR).The returned statistic is the unbiased estimate of the population standard deviation σ. See Variance,skewness and kurtosis calculations for more information on moments about the mean, populationparameters and statistics.
where n is the number of non-missing values in the list.
If only one value is available or if all values are missing, a missing value is returned.
Return type: Numeric
v1
Type: Numeric
The first value in the list.
value
Type: Numeric
Further value(s) to be evaluated.
Exampledata example; s1 = std(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); s2 = std(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15);run;
Reference for language elementsVersion 3.3
829
The output is:
STDERR
Returns the standard error of the mean of a list of numeric values.
STDERR ( v1 , { value , … } )
This function is defined for numeric values only, at least two values are required. It considers non-missing values and returns their standard error of the mean SE using their standard deviation (seesection STD):
where n is the number of non-missing values in the list.
If only one value is available or if all values are missing, a missing value is returned.
Return type: Numeric
v1
Type: Numeric
The first value in the list.
value
Type: Numeric
Further value(s) to be evaluated.
Exampledata example; se1 = stderr(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4",""); se2 = stderr(1.1,1.2,1.3,1.4,1.5,1,-2,3,.,"a","4","",1e15);run;
The output is:
Reference for language elementsVersion 3.3
830
SKEWNESS
Returns the skewness of a list of numeric values.
SKEWNESS ( v1 , v2 , { value , … } )
This function is defined for numeric values only, at least three values are required. It considers non-missing values and returns their skewness g1 as a ratio of the third moment about the mean m3 and
cubed standard deviation (see section STD). The returned statistic is the unitless estimate of thepopulation parameter γ1. See Variance, skewness and kurtosis calculations for more information onmoments about the mean, population parameters and statistics.
where n is the number of non-missing values in the list.
If fewer than three values are available or if all values are missing, a missing value is returned.
Return type: Numeric
v1
Type: Numeric
The first value in the list.
v2
Type: Numeric
The second value in the list.
value
Type: Numeric
Further value(s) to be evaluated.
Skewness is a measure of symmetry of a distribution as illustrated below:
Symmetrical distribution g1 = 0
Reference for language elementsVersion 3.3
831
Negatively skewed distribution g1 < 0
Positively skewed distribution g1 > 0
Exampledata example; g1_1 = skewness(1.1,1.2,1.3,1.4, 1.5, 1 ,-2 , 3 ,.,"a","4",""); g1_2 = skewness(1.1,1.2,1.3,1.4, 1.5, 1 ,-2 , 3 ,.,"a","4","", 1e15); g1_3 = skewness(1.1,1.2,1.3,1.4, 1.5, 1 ,-2 , 3 ,.,"a","4","",-1e15); g1_4 = skewness(1.1,1.2,1.3,1.4,-1.1,-1.2,-1.3,-1.4,.,"a","0","");run;
The output is:
Analogous to the above, g13 = -3.1622776602 and g14 = -9.88457 ⋅ 10-17 ≈ 0.
The positive outlier in the second sample significantly increases the degree of skewness and changesits sign, as the sample is now skewed to the right. Equally large negative outlier in the third sampleyields equally large skewness, changing its direction to the left.
Reference for language elementsVersion 3.3
832
The fourth sample is symmetrical about the mean, and its skewness is close to zero. Note that even fora perfectly symmetrical sample, the value may not be exactly zero.
KURTOSIS
Returns the kurtosis of a list of numeric values.
KURTOSIS ( v1 , v2 , v3 , { value , … } )
This function is defined for numeric values only, at least four values are required. It considers non-missing values and returns their kurtosis g2 as a ratio of the fourth moment about the mean m4 and
squared variance . The returned statistic is the unitless estimate of the population parameter γ2.See Variance, skewness and kurtosis calculations for more information on moments about the mean,population parameters and statistics.
where n is the number of non-missing values in the list.
If fewer than four values are available or if all values are missing, a missing value is returned.
Return type: Numeric
v1
Type: Numeric
The first value in the list.
v2
Type: Numeric
The second value in the list.
v3
Type: Numeric
The third value in the list.
value
Type: Numeric
Further value(s) to be evaluated.
Kurtosis characterises the degree of curvature or tail weight compared to a normal distribution asillustrated below:
Reference for language elementsVersion 3.3
833
Mesokurtic distribution g2 = 0
Normal distributions are mesokurtic, this is thereference distribution for kurtosis.
Leptokurtic distribution g2 > 0
The values are clustered closer around the mean thanin a normal distribution resulting in a higher peak andheavier tails.
Platykurtic distribution g2 < 0
The values are spread further from the mean than in anormal distribution resulting in a lower peak and lightertails.
Exampledata example; g2_1 = kurtosis(1.1,1.2,1.3,1.4, 1.5, 1 ,-2 , 3 ,.,"a","4",""); g2_2 = kurtosis(1.1,1.2,1.3,1.4, 1.5, 1 ,-2 , 3 ,.,"a","4","",1e15); g2_3 = kurtosis(1.1,1.2,1.3,1.4, 1.1, 1.1, 1 , 1 ,.,"a","1",""); g2_4 = kurtosis(1.1,1.2,1.3,1.4,-1.1,-1.2,-1.3,-1.4,.,"a","0","");run;
The output is:
Reference for language elementsVersion 3.3
834
Analogous to the above, g23 = -0.017857143 ≈ 0 and g24 = -2.360997732.
The first sample represents a distribution with heavier tails than a normal distribution, and the outlier inthe second sample dramatically increases it.
The third sample has kurtosis close to zero making its tail weight similar to that of a normal distribution.
The fourth sample has negative kurtosis indicating that it has lighter tails than a normal distribution.
String functions and call routinesThe string functions and CALL routines enable you to manipulate strings. Strings are sequences of oneor more characters. You can find and replace characters and substrings, find the length of strings andsubstrings, and so on.
IFCReturn a value depending on the truth or otherwise of a supplied parameter.
IFC ( condition , true-string , false-string [ , missing-string ] )
Evaluates a condition and returns one string if the condition is true; otherwise a different string isreturned. Optionally, if the condition is missing, another string can be returned.
Return type: Character
condition
Type: Numeric
A valid condition. This can be another function, or any expression.
true-string
Type: Character
The string to be returned if condition is true.
Reference for language elementsVersion 3.3
835
false-string
Type: Character
The string to be returned if condition is false.
missing-stringOptional argument
Type: Character
The string to be returned if condition is missing.
Basic exampleIn the following example, the function returns the appropriate text for the truth value of the firstparameter. The result is written to the log.
data _null_; result=ifc(1, 'tree', 'flash'); put "The string returned is: " result;run;
This produces the following output:
The string returned is: tree
condition is explicitly set to 1 and is therefore true, so the function returns the string in the true-resultparameter.
Example – condition returned by another functionIn the following example, the value of condition is set by another DATA step function. The result iswritten to the log and to the example dataset.
data example; search = 'London'; result=ifc(contains('SBC Ltd 2 50 London', search), 'Contains London', 'No London'); put "The string returned is: " result;run;
This produces the following output:
The string returned is: Contains London
In this example, condition is set to true ( 1) by the CONTAINS function, which returns 1 if a stringcontains a specified substring, 0 if not. In this case, the string is searched for London; the string isfound, so CONTAINS returns 1. Because condition is true, the function returns the string in the true-result parameter.
Reference for language elementsVersion 3.3
836
Example – missing valueIn the following example, the function returns the text specified for the missing-result . The result iswritten to the log and the example dataset.
data example; result=ifc(choosen(3, 1, 100, var1, 7, 12), 'Big Number', 'Small Number', 'Missing'); put "The string returned is: " result;run;
This produces the following output:
The string returned is: Missing
In this example, the CHOOSEN function contains an uninitialised variable (var1), which causes thefunction to return a missing value. In turn, this causes the IFC function to use the missing-resultparameter.
NVALIDCheck that a string is a valid variable name.
NVALID ( string [ , check-rule ] )
Checks a string and returns a flag indicating whether it is a valid variable name. If the string is a validname, 1 is returned; 0 is returned otherwise.
Return type: Numeric
string
Type: Character
The string to be analyzed.
check-ruleOptional argument
Specifies how the string should be checked.
"ANY"
Any characters are accepted.
"V7"
A strict interpretation of validity in which strings must meet rules the for variable namesintroduced at Version 7 of the language of SAS.
Reference for language elementsVersion 3.3
837
Example – valid variable nameIn the following example the function checks whether a string is a valid variable name, and returns avalue indicating whether it is or not. The result is written to the log and to the example dataset.
data _null_; b='string1'; result=nvalid(b); put "Is it a valid variable name? " result;run;
This produces the following output:
Is it a valid variable name? 1
In this example, string1 is a valid variable name.
Example – invalid variable nameIn the following example the function checks whether a string is a valid variable name, and returns avalue indicating whether it is or not. The result is written to the log and to the example dataset.
data _null_; b='1string'; result=nvalid(b); put "Is it a valid variable name? " result;run;
This produces the following output:
Is it a valid variable name? 0
In this case, 1string is an invalid variable name.
Example – using ANY to allow invalid variable namesIn the following example the function checks whether a string is a valid variable name, and returns avalue indicating whether it is or not. The result is written to the log and to the example dataset.
data _null_; b='1string'; result=nvalid(b, 'ANY'); put "Is it a valid variable name? " result;run;
This produces the following output:
Is it a valid variable name? 1
Although 1string is an invalid variable name, the ANY parameter allows any characters to beaccepted as valid.
Reference for language elementsVersion 3.3
838
Calculate edit distances
COMPGED
Calculates the generalised edit distance between two strings.
COMPGED ( string1 , string2 )
COMPGED ( string1 , string2 , cutoff [ , modifiers ] )
COMPGED ( string1 , string2 , modifiers [ , cutoff ] )
Compares two strings and calculates an overall cost, based on the generalised edit distance, oftransforming a specified string to another specified string. It can be regarded as a measure ofthe difference between two character strings. The generalised edit distance defines additionaltransformations to the standard (Levenshtein) edit distance.
Return type: Numeric
string1
Type: Character
The string to be compared to string2.
string2
Type: Character
The string to be compared to string1.
cutoff
Type: Numeric
The maximum cost to be returned by the function; above this value, costs will be ignored. Forexample if this argument is set to 100, and the function calculates that the cost of transformationis 200, the function will return 100.
modifiersOptional argument
Type: Character
Parameters that modify the output. These are optional. The following modifiers are available:
D
Provide detailed information on how the edit distance is calculated. The information isprovided in a tabular format. See the example below.
I
Ignore case in the source string.
Reference for language elementsVersion 3.3
839
L
Ignore leading spaces in string1.
N
If the string is a name literal, ignore differences in case. For example, incompged("Ford"N,"FoRd"N, 'N') the case of r and R would be ignored.
:
If string2 is longer than string1, ignore characters in string2 beyond the length of string1.For example, compged('London Bikes','London Bikes s', ':'); would returnthe value 0.
The order of the cutoff and modifiers arguments can be swapped; for example compged('LondonBikes','London Bokes', 100, 'I') and compged('London Bikes','London Bokes','I', 100) are equivalent.
ExampleIn the following example, the function is used to find the generalised edit distance between two strings.The result is written to the log and to the example dataset.
data example; result = compged('London Bikes','London Bokes'); put "The generalised edit distance is: " result;run;
This produces the following output:
The generalised edit distance is: 100
ExampleIn the following example, the function is used to find the generalised edit distance between two strings.The D modifier is specified to provide detailed information. The result is written to the log and to theexample dataset.
data example; result = compged('London Bikes','London Bokes',200,'D'); put "The generalised edit distance is: " result;run;
This produces the following output:
L o n d o n B i k e s 0 200 200 200 200 200 200 200 200 200 200 200 200L 200 0 100 200 300 300 300 300 300 300 300 300 300o 200 200 0 100 200 220 320 330 400 400 400 400 400n 200 300 100 0 100 200 220 230 330 430 500 500 500d 200 300 200 100 0 100 200 210 310 410 510 600 600o 200 300 300 200 100 0 100 110 210 310 410 510 610n 200 300 400 300 200 100 0 10 110 210 310 410 510 200 300 400 310 210 110 10 0 100 200 300 400 500
Reference for language elementsVersion 3.3
840
B 200 300 400 410 310 210 110 100 0 100 200 300 400o 200 300 300 400 410 310 210 200 100 100 200 300 400k 200 300 400 400 500 410 310 300 200 200 100 200 300e 200 300 400 500 500 510 410 400 300 300 200 100 200s 200 300 400 500 600 600 510 500 400 400 300 200 100 L : MATCH o : MATCH n : MATCH d : MATCH o : MATCH n : MATCH : MATCH B : MATCH o -> i : REPLACE k : MATCH e : MATCH s : MATCHThe generalised edit distance is: 100
COMPLEV
Calculates the Levenshtein edit distance between two strings.
COMPLEV ( string1 , string2 )
COMPLEV ( string1 , string2 , cutoff [ , modifiers ] )
COMPLEV ( string1 , string2 , modifiers [ , cutoff ] )
Compares two strings and calculates an overall cost, based on the Levenshtein edit distance, oftransforming a specified string to another specified string. It can be regarded as a measure of thedifference between two character strings.
Return type: Numeric
string1
Type: Character
The string to be compared to string2.
string2
Type: Character
The string to be compared to string1.
cutoff
Type: Numeric
The maximum cost to be returned by the function; above this value, costs will be ignored. Forexample if this argument is set to 10, and the function calculates that the cost of transformation is12, the function will return 10.
Reference for language elementsVersion 3.3
841
modifiersOptional argument
Type: Character
Parameters that modify the output. These are optional. The following modifiers are available:
I
Ignore case in the source string.
L
Ignore leading spaces in string1.
N
If the string is a name literal, ignore differences in case. For example, incomplev("Ford"N,"FoRd"N, 'N') the case of r and R would be ignored.
:
If string2 is longer than string1, ignore characters in string2 beyond the length of string1.For example, complev('London Bikes','London Bikes s', ':'); would returnthe value 0.
ExampleIn the following example, the function is used to find the Levenshtein edit distance between two strings.The result is written to the log and to the example dataset.
data example; result = complev('London Bikes','London Bokes'); put "The Levenshtein edit distance is: " result;run;
This produces the following output:
The Levenshtein edit distance is: 1
SPEDIS
Determine the likelihood that two words match.
SPEDIS ( string1 , string2 )
Determines the degree to which two words match, based on the spelling distance between them.The function returns the distance as an asymmetric value; that is, changing a to z is not the same aschanging z to a.
Return type: Numeric
Reference for language elementsVersion 3.3
842
string1
Type: Character
The source string.
string2
Type: Character
The string to which string1 is compared.
The spelling distance is calculated based on the transformations that would be required to make string2match string1. The following operations will be tried:
• Insert a letter• Delete a letter• Replace a letter• Append a letter• Delete the first letter• Insert a first a letter• Replace the first letter
Each operation has an associated cost. The function used default costs, but you can specify alternativecosts using the CALL COMPCOST routine.
ExampleIn the following example, the function is used to calculate the spelling distance between the target stringLondon and the source string Londin. The result is written to the log and the example dataset.
data example; result = spedis('London','Londin'); put 'The spelling distance is: ' result;run;
This produces the following output:
The spelling distance is: 16
CALL COMPCOST
Adjust costs of generalised edit distance.
CALL COMPCOST ( { option , … } );
Reference for language elementsVersion 3.3
843
Adjusts the costs of various operations associated with the transformation of one string into another,such as deleting a character, or swapping one character with another. It is most often called beforethe COMPGED function, which calculates the generalised edit distance for the transformation of twostrings. The costs provided by the CALL COMPCOST function can be used to adjust the cost calculationsperformed by COMPGED.
option
Type: Character or numeric value
This option specifes an editing operation, and the cost associated with that operation. The optionis specified as a pair of values, a character operation name, enclosed in quotation marks, and anumeric cost for the operation. The format is:
"operation=', n
where operation is the name for an operation such as appending a character or inserting a blank.The following operations are available:
"APPEND="
Specifies the cost of appending a character.
"BLANK="
Specifies the cost of replacing a character with a blank.
"DELETE="
Specifies the cost of deleting a character.
"DOUBLE="
Specifies the cost of doubling a character (modifying O to be OO, for example).
"FDELETE="
Specifies the cost of deleting the first character in the string.
"FINSERT="
Specifies the cost of inserting a character at the first position in the string.
"FREPLACE="
Specifies the cost of replacing the first character in the string.
"INSERT="
Specifies the cost of inserting a character.
"MATCH="
Specifies the cost of maching a character.
"PUNCTUATION="
Specifies the cost of inserting a punctuation character.
Reference for language elementsVersion 3.3
844
"REPLACE="
Specifies the cost of replacing a character.
"SINGLE="
Specifies the cost of making a doubled character single (modifying OO to be O, forexample).
"SWAP="
Specifies the cost of swapping one character with another.
"TRUNCATE="
Specifies the cost of truncating a string.
ExampleIn the following example, COMPGED is first used to calculate the generalised edit distance between twostrings based on the default costs used to calculate that distance. CALL COMPCOST is used to changethe cost of inserting a value; COMPGED is then used to calculate the generalised edit distance using thenew cost for inserting a character. The results are written to the log and to the example dataset.
data example; result1 = compged("London Bike","London Boke"); put "Generalised edit distance is: " result1; call compcost('replace=',10,'insert=',30); result2 = compged("London Bike","London Boke"); put "Generalised edit distance is now: " result2;run;
This produces the following output:
Generalised edit distance is: 100Generalised edit distance is now: 10
The generalised edit distance is first calculated to be 100. After executing CALL COMPCOST, thegeneralised edit distance is calculated to be 10.
Change character case in source string
LOWCASE
Convert all uppercase characters to lowercase.
LOWCASE ( string )
Converts all uppercase alphabetic characters in a string to corresponding lowercase characters, andreturns the result.
Reference for language elementsVersion 3.3
845
Return type: Character
string
Type: Character
A string in which uppercase characters are to be converted.
ExampleIn the following example, the function is used to examine the string for upper case characters that arethen converted to lower case characters; the result is written to the log and to the example dataset.
data example; result = lowcase('Magnificent Bike Company Bike A 1 2 50 London'); put 'The converted string is: ' result;run;
This produces the following output:
The converted string is: magnificent bike company bike a 1 2 50 london
PROPCASE
Convert case in words in a string so that the first letter is uppercase and other letters lowercase.
PROPCASE ( string [ , delimiters ] )
Converts words in a string where necessary so that the first letter is uppercase and other letterslowercase. Words in a string are separated by spaces by default, but a different separator can beused as a separator if required. If the first character of the string is a lowercase letter, it is converted touppercase.
Return type: Character
string
Type: Character
A string containing words to be converted.
delimitersOptional argument
Type: Character
One or more characters to be recognised as delimiters (separators).
Reference for language elementsVersion 3.3
846
Example – using default space separatorsIn the following example the function converts the case of words separated by spaces; the result iswritten to the log and the example dataset.
data example; result=propcase('london bike company'); put "Converted string is: " result;run;
This produces the following output:
Converted string is: London Bike Company
Example – using a specified separatorIn the following example the function converts the case of words separated by full-stops; the result iswritten to the log and the example dataset.
data example; result=propcase('london bike.company', '.'); put "Converted string is: " result;run;
This produces the following output:
Converted string is: London bike.Company
Note:If the string had been london bike. company (note the space after the full stop), the result wouldbe London bike. company. In this example, the character after the full-stop is a space, rather than aletter, so there is nothing to convert.
Example – using multiple separatorsIn the following example the function converts the case of words separated by full-stops and commas;the result is written to the log and the example dataset.
data example; sentence='london,lovely bike.company'; seps= ',.'; result=propcase(sentence, seps); put "Converted string is: " result;run;
This produces the following output:
Converted string is: London,Lovely bike.Company
Reference for language elementsVersion 3.3
847
UPCASE
Convert all lowercase characters to uppercase.
UPCASE ( string )
Converts all lowercase alphabetic characters in a string to corresponding uppercase characters, andreturns the modified string.
Return type: Character
string
Type: Character
A string in which lowercase characters are to be converted.
ExampleIn the following example, the function is used to convert lowercase characters to uppercase. The resultis written to the log and to the example dataset.
data example; result= upcase("Magnificent Bike Company A 1 2 50 London"); put result;run;
This produces the following output:
MAGNIFICENT BIKE COMPANY A 1 2 50 LONDON
Collating sequence and characters
COLLATE
Return the collating sequence between specified positions.
COLLATE ( startpos , endpos [ , length ] )
Returns a string consisting of the ASCII or EBCDIC collating sequence (depending on the device onwhich the function is run) starting at and including, and ending at and including, the positions specifiedby the parameters you supply to the function.
Return type: Character
startpos
Type: Numeric
Reference for language elementsVersion 3.3
848
The position in the collating sequence at which the function should start returning characters,specified as an integer.
endpos
Type: Numeric
The position in the collating sequence at which the function should stop returning characters,specified as an integer. If you specify this parameter, you do not need to specify length. If youomit this parameter because you are specifying length, you must delimit the position with acomma (see examples below).
lengthOptional argument
Type: Numeric
The number of characters that should be returned. If you specify this parameter, you do not needto specify end-position.
Note:If you specify both length and end-position, the value of end-position will take precedence. Forexample, result=collate(65,90,10) will return ABCDEFGHIJKLMNOPQRSTUVWXYZ ratherthan ABCDEFGHIJ.
Example – using specified start and end positionsIn the following example, the function is used to return the collating from position 65 through to position122. The result is written to the log and the example dataset.
data example; result=collate(65,122); put "The collating sequence is: " result;run;
This produces the following output:
The collating sequence is: ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
This is the collating sequence for the specified starting position (65) through to the end position (122).
Example – specifing start position and subsequent number ofcharactersdata example; result=collate(65,,26); put "The collating sequence is: " result;run;
This produces the following output:
The collating sequence is: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Reference for language elementsVersion 3.3
849
This is the ASCII collating sequence from and including position 65 through the next 26 characters.
RANK
Return the rank of a character in the collating sequence.
RANK ( character )
Returns an integer representing the rank (position) of a character in the collating sequence of thedevice on which the function is executed.
Return type: Numeric
character
Type: Character
The character for which you want the rank returned. (You can also specify a string, but thefunction will only examine the first character.)
ExampleIn the following example the rank of the character A in the collating sequence on a Windows PC isreturned; the result is written to the log and the example dataset.
data example; char='A'; result=rank(char); put "Rank of character in the collating sequence: " result;run;
This produces the following output:
Rank of character in the collating sequence: 65
Compare strings
COMPARE
Compare two strings for and return first position of difference.
COMPARE ( string1 , string2 [ , modifiers ] )
Compares two strings, and returns the first position where the strings differ.
Return type: Numeric
Reference for language elementsVersion 3.3
850
string1
Type: Character
The first string to be compared.
string2
Type: Character
The second string to be compared.
modifiersOptional argument
One or more modifiers. A modifier changes the operation of the function. The following modifiersare available:
":"
If string2 is longer than string1, ignore characters in string2 beyond the length of string1.
"I"
Differences in case when comparing alphabetic characters are ignored.
"L"
Ignore leading spaces in the comparision.
"N"
If the string is a name literal, differences in case are ignored. For example,compare("Ford"N,"FoRd"N, 'N') would return 0.
If the character that differs is higher in the collating sequence in string1 than it is in string2, then thevalue returned is positive.
If the character that differs is higher in the collating sequence in string2 than it is in string2, then thevalue returned is negative.
For example, comparing Bicycle to Bacycle returns 2, whereas comparing Bacycle to Bicyclereturns -2.
Example – specifying no parametersIn the following example, the function is used to compare two strings, with no parameters specified. Theresult is written to the log and the example dataset.
data example; result = compare("Ford","Ford"); put "The result of the comparison is: " result;run;
This produces the following output:
The result of the comparison is: 0
Reference for language elementsVersion 3.3
851
The function returns 0 (zero), as both strings are the same.
Example – how collation sequence affects resultIn the following example, the function is used to compare two strings, with no parameters specified. Theresult is written to the log and the example dataset.
data example; result = compare("Ford","Fprd"); put "The result of the comparison is: " result;run;
This produces the following output:
The result of the comparison is: -2
The function returns -2, which is the position of the first character that is different in the second string;the value is negative because o is lower in the collating sequence than p.
Example – using modifiersIn the following example, the function is used to compare two strings, with the I modifier specified,which instructs the function to ignore case. The result is written to the log and the example dataset.
data example; result = compare("Ford","FOrd", 'I'); put "The result of the comparison is: " result;run;
This produces the following output:
The result of the comparison is: 0
The function returns 0 (zero), because the I modifier causes the function to ignore the differencebetween the upper and lower case O. The two strings are then seen as the same.
LIKE
Compare two strings for exact similarity.
LIKE ( string1 , string2 )
Compares two strings, and if they exactly alike returns 1 (true), and if not returns 0 (false).
Return type: Numeric
string1
Type: Character
A string to be compared.
Reference for language elementsVersion 3.3
852
string2
Type: Character
A string to be compared to string-1.
Example – Strings are the SameIn the following example, the function is used to compare two strings that are the same.
data example; a="Magnificent"; b="Magnificent"; same=like(a,b); result=ifc(same,'Yes','No'); put 'Are the strings alike? ' result;run;
This produces the following output:
Are the strings alike? Yes
Example – Strings DifferIn the following example, the function is used to compare two strings that differ.
data example; a="Magnificent"; b="Malificent"; same=like(a,b); result=ifc(same,'Yes','No'); put 'Are the strings alike? ' result;run;
This produces the following output:
Are the strings alike? No
MAXC
Compare two strings and return the higher in the collating sequence of the two.
MAXC ( string1 , string2 )
Compares two strings and returns the string that is highest in the collating sequence used by thedevice on which the function runs. If one string is longer than the other, the shorter string is paddedwith spaces before the comparison. Case is ignored. If two strings are the same apart from case (forexample, Bike and BIkE), the first argument is returned.
Return type: Character
Reference for language elementsVersion 3.3
853
string1
Type: Character
A character or string.
string2
Type: Character
A character or string.
Example – comparing charactersIn the following example, the function is used to compare two characters. The character highest in thecollating sequence is written to the log and the example dataset.
data example; result1 = maxc('M', 'm'); result2 = maxc('m', 'M'); result3 = maxc('M', 'o'); put 'The higher character in the collating sequence is ' result1; put 'The higher character in the collating sequence is ' result2; put 'The higher character in the collating sequence is ' result3; run;
This produces the following output:
The higher character in the collating sequence is MThe higher character in the collating sequence is mThe higher character in the collating sequence is o
In the first two uses of the function the characters are the same apart from case, so the first argument isreturned: In the third use of the function, M is higher in the collating sequence than o, so M is returned.
Example – comparing stringsIn the following example, the function is used to compare two strings. The string containing the highestcharacter in the collating sequence is written to the log and the example dataset.
data example; result = maxc('London ', 'Londun'); put 'The higher string in the collating sequence is ' result;run;
This produces the following output:
The higher string in the collating sequence is Londun
The second string is padded with spaces to match the length of the first string. The function returns thevalue Londun, as u in the second string is higher than o in the first.
Reference for language elementsVersion 3.3
854
MINC
Compare two strings and return the lower of the two.
MINC ( string1 , string2 )
Compares two strings and returns the string that is lower in the collating sequence used by the deviceon which the function runs. If one string is longer than the other, the shorter string is padded withspaces before the comparison. Case is ignored. If two strings are the same apart from case (forexample, Bike and BIkE), the first argument is returned.
Return type: Character
string1
Type: Character
A character or string.
string2
Type: Character
A character or string.
Example – comparing charactersIn the following example, the function is used to compare two characters. The character lowest in thecollating sequence is written to the log and to the example dataset.
data example; result1 = minc('M', 'm'); result2 = minc('m', 'M'); result3 = minc('M', 'o'); put 'The lower character in the collating sequence is ' result1; put 'The lower character in the collating sequence is ' result2; put 'The lower character in the collating sequence is ' result3;run;
This produces the following output:
The lower character in the collating sequence is MThe lower character in the collating sequence is mThe lower character in the collating sequence is M
Example – comparing stringsIn the following example, the function is used to compare two strings. The string containing the lowestcharacter in the collating sequence is written to the log and the example dataset.
data example; result = minc('London ', 'Londun'); put 'The lower string in the collating sequence is ' result;run;
Reference for language elementsVersion 3.3
855
This produces the following output:
The lower string in the collating sequence is London
The second string is padded with spaces to match the length of the first string. The function returns thevalue London, as u in the second string is higher than o in the first.
SOUNDSLIKE
Compare two strings and indicate whether they are similar or not.
SOUNDSLIKE ( string1 , string2 )
Compares two strings. The strings are converted to soundex equivalents, and then compared; if theyare similar based on this comparison, 1 is returned; if they are not , 0 is returned.
Return type: Numeric
string1
Type: Character
The source string.
string2
Type: Character
The string to be compared for similarity with source.
ExampleIn the following example, the function is used to compare various strings. The result is written to the logand to the example dataset.
data example; result1 = soundslike('Bike', 'Bike'); result2 = soundslike('Bike', 'Bikes'); result3 = soundslike('Bike', 'Buke'); result4 = soundslike('Bike', 'Bkue'); result5 = soundslike('Bike', 'Bite'); put result1; put result2; put result3; put result4; put result5;run;
Reference for language elementsVersion 3.3
856
This produces the following output:
10110
Concatenate strings
CAT
Concatenate characters or strings to create another string.
CAT ( { item , … } )
Concatenates a comma-separated list of characters or strings to create another string. Spaces arepreserved, except for any leading spaces in the first string, and included in the concatenated string.
Return type: Character
item
Type: Character or numeric value
A character or string.
ExampleIn this example, the function concatenates the comma-separated list of strings to form a new string. Theresult is written to the log and to the example dataset.
data example; result = cat(" Magnificent"," Bicycle "," Company"); put "Concatenated string: " result;run;
The result will be:
Concatenated string: Magnificent Bicycle Company
Strings have been concatenated and their spaces preserved (except for the first string where leadingspaces have been removed by the PUT operation). No separators have been inserted between strings.
Reference for language elementsVersion 3.3
857
CATQ
Concatenate characters or strings to create another string, adding or removing spaces and separatorsas defined by parameters.
CATQ ( modifiers , delimiter , { item , … } )
CATQ ( modifiers , { item , … } )
Provides a flexible way of concatenating characters or strings to create another string. Parameters tothe function enable you to specify:
• If spaces will be stripped from strings• Whether strings will be enclosed in quotation marks• The separators used to separate strings
Return type: Character
modifiers
Parameters that modify the output. You can specify more than one modifier. For example, youcan specify 'C', or 'CA1S'.
The following modifiers are available:
"1"
Specifies that modifiers that insert quotation marks to delimit substrings in theconcatenated string should use single quotation marks. By default, double quotation marksare used in such instances. You can alternatively specify the single quotation mark (') inplace of 1.
You can use this modifier with the modifiers A and B; for example, you can specify A1or A'. If you specify this modifier without also specifying the A and B modifier,results areunpredictable.
"2"
Specifies that modifiers that insert quotation marks to delimit substrings in theconcatenated string should use double quotation marks. You can alternatively specify thedouble quotation mark (") in place of 2.
This modifier can be used with the A or B modifiers; for example, you can specify A2 orA".
If you specify this modifier without also specifying the A or B modifier, results areunpredictable.
"A"
Strings will be enclosed in quotation marks in the resulting string. Any leading and trailingspaces in the strings are preserved.
Reference for language elementsVersion 3.3
858
By default, double quotation marks will be used, but this modifier can be used with the 1 or2 modifier, described above, to define the type of quotation mark to be used. For example,specifying the modifier A1 will enclose a string in single quotation marks.
"B"
Strings with leading and/or trailing spaces are enclosed in quotation marks in the resultingstring, and separated by a space character.
By default, double quotation marks will be used, but this modifier can be used with the 1 or2 modifier, described above, to define the type of quotation mark to be used. For example,specifying the modifier B1 will enclose a string in single quotation marks.
"C"
Strings are separated by commas in the resulting string. Any leading and trailing spaces inthe strings are preserved.
"D"
Strings are separated by a specified delimiter in the resulting string.
If you specify this modifier, you must specify the delimiter; otherwise, the first string orcharacter in your input will be used as the delimiter. Any leading and trailing spaces in thestrings are preserved. See delimiter below for more information.
"H"
Strings are separated by horizontal tabs in the resulting string. Any leading and trailingspaces in the strings are preserved.
"M"
Use a delimiter to separate all strings and characters, even nulls and hidden characters.This modifier should be used with the D modifier to specify a delimiter.
"N"
If the format of a resulting string is not a valid data variable name (for example, it startswith a numeric or contains spaces), it is converted to a name literal by wrapping the stringin quotation marks and appending an N character.
"Q"
Retains the quotation marks around the strings, maintains the leading and trailing spacesexactly as they exist between the quotation marks.
Strings are separated by spaces in the resulting string. If a string contains quotation marks,the quotation marks in the resulting string are set such that the result will not cause anerror. For strings that do not contain quotation marks, the quotation mark for the string inthe resulting string will be the default, or that set by the A modifier.
Reference for language elementsVersion 3.3
859
For example, the CAT function cat(' "Hello"','"World" ',' Programming');would return the concatenated string "Hello""World" Programming. The quotedquotation marks and leading and trailing spaces have been retained, except for the leadingspaces of the first string, which have been removed as expected for CAT. However, if youwere to enter the same strings into CATQ with the Q modifier:
catQ('q', ' "Hello"','"World" ',' Programming')
The output would be as follows:
' "Hello"' '"World" ' " Programming"
Here, the leading and trailing spaces have been preserved, and the style of the quotationmarks used from the input strings to surround the strings in the concatenated string.However, the final string, " Programming" has been surrounded with double quotationmarks, as there are no other quotation marks to preserve, and double quotation marks arethe default marks for delimiting strings.
"S"
Strips leading and trailing spaces in strings in the resulting string, and separates the stringswith spaces. Strings that contain spaces are wrapped in quotation marks.
"T"
Strips trailing spaces in strings in the resulting string, and separates the strings withspaces. If strings still contain spaces, they are wrapped in quotation marks.
"X"
Any non-printable character in the input is replaced by its hexadecimal equivalent.
"1"
Specifies that modifiers that insert quotation marks to delimit substrings in theconcatenated string should use single quotation marks. By default, double quotation marksare used in such instances. You can alternatively specify the single quotation mark (') inplace of 1.
You can use this modifier with the modifiers A and B; for example, you can specify A1or A'. If you specify this modifier without also specifying the A and B modifier,results areunpredictable.
"2"
Specifies that modifiers that insert quotation marks to delimit substrings in theconcatenated string should use double quotation marks. You can alternatively specify thedouble quotation mark (") in place of 2.
This modifier can be used with the A or B modifiers; for example, you can specify A2 orA".
If you specify this modifier without also specifying the A or B modifier, results areunpredictable.
Reference for language elementsVersion 3.3
860
"A"
Strings will be enclosed in quotation marks in the resulting string. Any leading and trailingspaces in the strings are preserved.
By default, double quotation marks will be used, but this modifier can be used with the 1 or2 modifier, described above, to define the type of quotation mark to be used. For example,specifying the modifier A1 will enclose a string in single quotation marks.
"B"
Strings with leading and/or trailing spaces are enclosed in quotation marks in the resultingstring, and separated by a space character.
By default, double quotation marks will be used, but this modifier can be used with the 1 or2 modifier, described above, to define the type of quotation mark to be used. For example,specifying the modifier B1 will enclose a string in single quotation marks.
"C"
Strings are separated by commas in the resulting string. Any leading and trailing spaces inthe strings are preserved.
"D"
Strings are separated by a specified delimiter in the resulting string.
If you specify this modifier, you must specify the delimiter; otherwise, the first string orcharacter in your input will be used as the delimiter. Any leading and trailing spaces in thestrings are preserved. See delimiter below for more information.
"H"
Strings are separated by horizontal tabs in the resulting string. Any leading and trailingspaces in the strings are preserved.
"M"
Use a delimiter to separate all strings and characters, even nulls and hidden characters.This modifier should be used with the D modifier to specify a delimiter.
"N"
If the format of a resulting string is not a valid data variable name (for example, it startswith a numeric or contains spaces), it is converted to a name literal by wrapping the stringin quotation marks and appending an N character.
"Q"
Retains the quotation marks around the strings, maintains the leading and trailing spacesexactly as they exist between the quotation marks.
Strings are separated by spaces in the resulting string. If a string contains quotation marks,the quotation marks in the resulting string are set such that the result will not cause anerror. For strings that do not contain quotation marks, the quotation mark for the string inthe resulting string will be the default, or that set by the A modifier.
Reference for language elementsVersion 3.3
861
For example, the CAT function cat(' "Hello"','"World" ',' Programming');would return the concatenated string "Hello""World" Programming. The quotedquotation marks and leading and trailing spaces have been retained, except for the leadingspaces of the first string, which have been removed as expected for CAT. However, if youwere to enter the same strings into CATQ with the Q modifier:
catQ('q', ' "Hello"','"World" ',' Programming')
The output would be as follows:
' "Hello"' '"World" ' " Programming"
Here, the leading and trailing spaces have been preserved, and the style of the quotationmarks used from the input strings to surround the strings in the concatenated string.However, the final string, " Programming" has been surrounded with double quotationmarks, as there are no other quotation marks to preserve, and double quotation marks arethe default marks for delimiting strings.
"S"
Strips leading and trailing spaces in strings in the resulting string, and separates the stringswith spaces. Strings that contain spaces are wrapped in quotation marks.
"T"
Strips trailing spaces in strings in the resulting string, and separates the strings withspaces. If strings still contain spaces, they are wrapped in quotation marks.
"X"
Any non-printable character in the input is replaced by its hexadecimal equivalent.
delimiter
Type: Character
A character or string to be used as a separator for concatenated strings. delimiter must bespecified with the D modifier.
item
Type: Character or numeric value
A character or string.
Example – compressing spaces and inserting Separators using CTAModifiersIn the following example, a new string will be created by concatenating the strings in the function.Multiple modifiers are used to:
• Strip trailing spaces in the strings before concatenation (T modifier)• Insert commas as separators items in the resulting string (C modifier)• Wrap each concatenated string in single quotes, (A and 1 modifiers)
Reference for language elementsVersion 3.3
862
The result is written to the log and to the example dataset.
data example; string1='Programming'; mods='CA1T'; result = catq(mods, ' Hello',' World ', string1); put "Concatenated string: " result;run;
This produces the following output:
Concatenated string: ' Hello',' World','Programming'
Example – compressing spaces and inserting separators using DSmodifiersIn the following example, a new string will be created by concatenating the strings in the function.Multiple modifiers have been used to:
• Strip all leading and trailing spaces in strings before concatenation (S modifier)• Separate concatenated strings in the resulting string using the ** characters as specified by the D
modifier and the second argument
The result is written to the log and to the example dataset.
data example; string1='Programming'; result = catq('DS', '**', ' Hello',' World ', string1); put "Concatenated string: " result;run;
This produces the following output:
Concatenated string: Hello**World**Programming
CATS
Concatenate characters or strings to create another string, first stripping leading and trailing spaces.
CATS ( { item , … } )
Concatenates characters or strings to create another string. All leading and trailing spaces are strippedfrom the strings before concatenation.
Return type: Character
item
Type: Character or numeric value
A character or string.
Reference for language elementsVersion 3.3
863
ExampleIn this example, the function concatenates the comma-separated list of strings to form a new string,stripping leading and trailing spaces as it does so. The result is written to the log and the exampledataset.
data example; result = cats(" Hello"," World "," Programming"); put "Concatenated string: " result;run;
This produces the following output:
Concatenated string: HelloWorldProgramming
CATT
Concatenate characters or strings to create another string, first stripping trailing spaces.
CATT ( { item , … } )
This function concatenates characters or strings to create another string. All trailing spaces are strippedfrom the strings being concatenated.
Return type: Character
item
Type: Character or numeric value
A character or string.
ExampleIn this example, the function concatenates the comma-separated list of strings to form a new string,stripping the trailing spaces. The result is written to the log and to the example dataset.
data example; result = catt(" Hello","World "," Programming"); put "Concatenated string: " result;run;
This produces the following output:
Concatenated string: HelloWorld Programming
Whether leading spaces are removed from the resulting concatenated string depends on the operationon the result; for example, the PUT in this example removes them, but a QUOTE would retain them.
Reference for language elementsVersion 3.3
864
CATX
Concatenate strings to create another string, inserting a specified separator.
CATX ( separator , { item , … } )
Concatenates characters or strings to create another string. All leading and trailing spaces are strippedfrom the strings before concatenation. The strings are separated by a character you specify.
Return type: Character
separator
Type: Character
A character or string that will be used as the string separator.
item
Type: Character or numeric value
A character or string, or a variable containing a character or string.
ExampleIn this example, the function concatenates the comma-separated list of strings to form a new string, firststripping the leading and trailing spaces from each string and inserting the specified separator betweenthem. The result is written to the log, and to the example dataset.
data example; result = catx('*', " Hello","World "," Programming"); put "Concatenated string: " result;run;
This produces the following output:
Concatenated string: Hello*World*Programming
CALL CATS
Concatenate characters or strings to create another string, after stripping leading and trailing spaces.
CALL CATS ( result [ , { string , … } ] );
Concatenates characters or strings to create another string. All leading and trailing spaces are strippedfrom the strings before concatenation. The concatenated string is returned to a parameter in the CALLroutine.
result
Type: Character
Reference for language elementsVersion 3.3
865
An argument into which the concatenated string is returned.
stringOptional argument
Type: Character or numeric value
A character or string to be concatenated.
ExampleIn this example, the routine concatenates the comma-separated list of strings to form a new string,stripping the leading and trailing spaces. The result is returned to the strng parameter, and is thenwritten to the log and to the example dataset.
data example; length strng $ 17; call cats(strng,'London',' Bike',' Company '); put "The concatenated string is " strng;run;
This produces the following output:
The concatenated string is LondonBikeCompany
CALL CATT
Concatenate characters or strings to create another string, first stripping trailing spaces.
CALL CATT ( result [ , { string , … } ] );
Concatenates characters or strings to create another string. All trailing spaces are stripped from thestrings being concatenated. The concatenated string is returned to a specified parameter in the routine.
result
Type: Character
An argument into which the concatenated string is returned.
stringOptional argument
Type: Character or numeric value
A character or string to be concatenated.
Reference for language elementsVersion 3.3
866
ExampleIn this example, the routine concatenates the comma-separated list of strings to form a new string,stripping the trailing spaces. The result is returned to the strng parameter, and is then written to thelog and to the example dataset.
data example; length strng $ 26; call catt(strng," Hello","World "," Programming"); result=quote(strng); put "The concatenated string is " strng;run;
This produces the following output:
The concatenated string is " HelloWorld Programming"
Note:
If PUT had been used to write strng to the log, the result would have have been:
HelloWorld Programming
The leading spaces would have been removed.
CALL CATX
Concatenate strings to create another string, inserting a specified separator.
CALL CATX ( separator , result [ , { string , … } ] );
Concatenates characters or strings to create another string. All leading and trailing spaces are strippedfrom the strings before concatenation. The strings are separated by a character you specify. Theconcatenated string is returned to a specified parameter in the routine.
separator
Type: Character
A character or string that will be used as the string separator.
result
Type: Character
The parameter into which the string is returned.
stringOptional argument
Type: Character or numeric value
A character or string.
Reference for language elementsVersion 3.3
867
ExampleIn this example, the routine strips the leading and trailing spaces from each comma-separated string,and then concatenates each string, inserting the specified separator between strings, to form a newstring. The result is returned to the strng parameter, and is then written to the log and to the exampledataset.
data example; length strng $ 25; call catx('**', strng, " Hello "," World "," Programming"); put "The concatenated string is " strng;run;
This produces the following output:
The concatenated string is Hello**World**Programming
Count characters or strings in a source string
COUNT
Find the number of occurrences of a string in a source string.
COUNT ( string , substring [ , modifiers ] )
Finds the number of times a specified string occurs in a source string, and returns that number.
Return type: Numeric
string
Type: Character
The string to be examined.
substring
Type: Character
The string to find in source.
modifiersOptional argument
Parameters that modify the output. The following modifiers are available:
"I"
Ignore case in the source string.
Reference for language elementsVersion 3.3
868
"T"
Trim trailing spaces from both arguments.
"I"
Ignore case in the source string.
"T"
Trim trailing spaces from both arguments.
Example – finding a matching stringIn the following example, the function is used to find the number of times Bike is found in the sourcestring. The result is written to the log and to the example dataset.
data example; search = 'Bike'; result = count('Magnificent Bike Company (Bikes)', search); put "The string is found " result "times";run;
This produces the following output:
The string is found 2 times
The string is found twice, so 2 is returned.
Example – finding matches by ignoring caseIn the following example, the function is used to match a string while ignoring case. The result is writtento the log and the example dataset.
data example; search = 'company'; result = count('Magnificent Bike Company (Bikes)', search, 'I'); put "The string is found " result "times";run;
This produces the following output:
The string is found 1 times
The string company matches Company because the I modifier has been set, so 1 is returned.
COUNTC
Find the number of occurrences of a string in a source string.
COUNTC ( string , characters [ , modifiers ] )
Find number of occurrences of specified characters in an input string.
Reference for language elementsVersion 3.3
869
Return type: Numeric
string
Type: Character
The string to be examined.
characters
Type: Character
One or more characters to find in source.
modifiersOptional argument
Parameters that modify the output. The following modifiers are available:
"I"
Ignore case in the source string.
"O"
Store the list of separators required the first time the function is called. This can increaseprocessing efficiency if there are multiple calls to the function.
"T"Trim trailing spaces from both arguments.
"V"Return the number of characters that do not match the search.
"I"
Ignore case in the source string.
"O"
Store the list of separators required the first time the function is called. This can increaseprocessing efficiency if there are multiple calls to the function.
"T"Trim trailing spaces from both arguments.
"V"Return the number of characters that do not match the search.
Reference for language elementsVersion 3.3
870
Example – searching for charactersIn the following example, the function is used to find the characters i and B in the source string. Theresult is written to the log and to the example dataset.
data example; search = 'iB'; result = countc('Magnificent Bike Company Bike A 1 2 50 London', search); put "The character(s) found " result "times";run;
This produces the following output:
The character(s) found 6 times
The character B is found twice in the two instances of Bike, and i four times in Bike andMagnificent.
Example – returning the count of unmatched charactersIn the following example, the function is used to find the character i in the source string. The modifierV specifies that the value returned is the number of characters that do not match the search string. Theresult is written to the log and to the example dataset.
data example; search = 'i'; result = countc('Magnificent Bike Company Bike A 1 2 50 London', search, 'V'); put "The character(s) found " result "times";run;
This produces the following output:
The character(s) found 43 times
The character i is found four times; as there are 47 characters in the source strings, 43 is returned.
COUNTW
Count the number of words in a string.
COUNTW ( string , [ characters ] [ , modifiers ] )
Counts the number of words in a string. The character to be used as a word separator can be specified.
Return type: Numeric
string
Type: Character
The string to be examined.
Reference for language elementsVersion 3.3
871
charactersOptional argument
Type: Character
One or more characters that identify the separator between words in source. By default, thisfunction uses a space as a separator.
modifiersOptional argument
One or more parameters that modify the output. For example, you can specify 'A', or 'AI'.
The following modifiers are available:
"A"
Alphabetic characters will be used as separators.
"B"
Examine source backwards; that is, start searching from the right-hand side of the stringtowards the left-hand side.
"C"
Control characters will be used as separators.
"D"
Decimal numbers (0 though 9) will be used as separators.
"F"
A character that is a valid character for the first position in a variable name will beconsidered a separator.
"G"
Graphics characters will be used as separators.
"H"
Horizontal tabs will be used as separators.
"I"
If an alphabetic character is set as a separator, ignore the case of the character.
"K"
Causes modifiers to act in the opposite way. So, for example, if L is set, instead ofremoving all lower-case characters, the function will instead remove all uppercasecharacters.
"L"
Lower-case alphabetic characters will be used as separators.
Reference for language elementsVersion 3.3
872
"M"
Specifies that multiple adjacent separators delimit nulls. By default, multiple adjacentseparators are assumed to operate as a single seperator. In the following example, thisoption is not specifed (the default):
data _null_; result = countw('london,,,bike,company;;A1', ',;'); put result; run;
The function would return 4, as the adjacent separators are treated as a single separator.However, if you specified the M modifier:
data _null_; result = countw('london,,,bike,company;;A1', ',;', 'M'); put result;run;
the function would return 7, as adjacent separators are now treated as individualseparators each delimiting a null.
"N"
A character that is a valid character for a variable name will be considered a separator.
"O"
Store the list of separators required the first time the function is called. This can increaseprocessing efficiency if there are multiple calls to the function.
"P"
Punctuation marks will be considered separators.
"Q"
Separators in strings delimited by quotation marks will be ignored. For example:
data _null_; result1 = countw('"The London Bike Company" A1 London ',' ','q'); result2 = countw('"The London Bike Company" A1 London ',' '); put result1; put result2; run;
In this example, the following is written to the log:
36
In the first use of the function, the first word is The London Bike Company, as theQ modifier ensures the spaces are not identified as separators; the function thereforecounts three words. In the second use of the function, spaces within the quoted string areidentified as separators, as the Q modifier is not specified; the function therefore counts sixwords.
Reference for language elementsVersion 3.3
873
"R"
Trims the result.
"S"
White space (including spaces and tabs) is used as a separator.
"T"
Removes trailing spaces from each substring in the source string before applyingseparators.
"U"
Uppercase alphabetic characters will be used as separator.
"W"
Use print characters as separator.
"X"
Use all characters that can constitute hexadecimal numbers (0-9, A-F) as separator.
"A"
Alphabetic characters will be used as separators.
"B"
Examine source backwards; that is, start searching from the right-hand side of the stringtowards the left-hand side.
"C"
Control characters will be used as separators.
"D"
Decimal numbers (0 though 9) will be used as separators.
"F"
A character that is a valid character for the first position in a variable name will beconsidered a separator.
"G"
Graphics characters will be used as separators.
"H"
Horizontal tabs will be used as separators.
"I"
If an alphabetic character is set as a separator, ignore the case of the character.
Reference for language elementsVersion 3.3
874
"K"
Causes modifiers to act in the opposite way. So, for example, if L is set, instead ofremoving all lower-case characters, the function will instead remove all uppercasecharacters.
"L"
Lower-case alphabetic characters will be used as separators.
"M"
Specifies that multiple adjacent separators delimit nulls. By default, multiple adjacentseparators are assumed to operate as a single seperator. In the following example, thisoption is not specifed (the default):
data _null_; result = countw('london,,,bike,company;;A1', ',;'); put result; run;
The function would return 4, as the adjacent separators are treated as a single separator.However, if you specified the M modifier:
data _null_; result = countw('london,,,bike,company;;A1', ',;', 'M'); put result;run;
the function would return 7, as adjacent separators are now treated as individualseparators each delimiting a null.
"N"
A character that is a valid character for a variable name will be considered a separator.
"O"
Store the list of separators required the first time the function is called. This can increaseprocessing efficiency if there are multiple calls to the function.
"P"
Punctuation marks will be considered separators.
"Q"
Separators in strings delimited by quotation marks will be ignored. For example:
data _null_; result1 = countw('"The London Bike Company" A1 London ',' ','q'); result2 = countw('"The London Bike Company" A1 London ',' '); put result1; put result2; run;
Reference for language elementsVersion 3.3
875
In this example, the following is written to the log:
36
In the first use of the function, the first word is The London Bike Company, as theQ modifier ensures the spaces are not identified as separators; the function thereforecounts three words. In the second use of the function, spaces within the quoted string areidentified as separators, as the Q modifier is not specified; the function therefore counts sixwords.
"R"
Trims the result.
"S"
White space (including spaces and tabs) is used as a separator.
"T"
Removes trailing spaces from each substring in the source string before applyingseparators.
"U"
Uppercase alphabetic characters will be used as separator.
"W"
Use print characters as separator.
"X"
Use all characters that can constitute hexadecimal numbers (0-9, A-F) as separator.
Example – unmodified countIn the following example, the function counts the words in the source string with no modifiers applied,so the words are by default separated by spaces and punctuation characters. The result is written to thelog and to the example dataset.
data example; result = countw('Magnificent Bike Company. A 1 2 50-London'); put "The word was found " result "times";run;
This produces the following output:
The word was found 8 times
Reference for language elementsVersion 3.3
876
Example – using specified separatorIn the following example, the function counts the words in the source string with a separator applied; inthis case, the space character. The result is written to the log and to the example dataset.
data example; search = 'i'; result = countw('Magnificent Bike Company. A 1 2 50-London', ' '); put "The word was found " result "times";run;
This produces the following output:
The word was found 7 times
As the separator has been expressly set to the space character, Company. and 50-London are eacha single string; the source string therefore contains seven words.
Extract a substring from a source string
SUBPAD
Return a substring from a source string, padding it to a specified length if necessary.
SUBPAD ( string , startpos [ , length ] )
Finds a substring of a specified length in a source string that starts at a specified position. If thereturned string is shorter than the length of substring you requested (if, for example, the end of thestring is reached), padding is added in the form of trailing spaces.
Return type: Character
string
Type: Character
The source string.
startpos
Type: Numeric
The position in the source string at which to return the substring.
lengthOptional argument
Type: Numeric
The number of characters of the source string to be returned. This parameter is optional.
Reference for language elementsVersion 3.3
877
If you do not specify length, the function returns the substring that begins at position and continuesthrough to the end of the source string.
If length is set to 0 (zero), null ('') is returned; unlike SUBSTR, no error is returned.
ExampleIn the following example, the function is used to find and return the string that begins at position 35 andis ten characters long. The result is written to the log and to the example dataset. The QUOTE functionhas been used in this example to show the padding.
data example; result=quote(subpad("Magnificent Bike Company A 1 2 50 London",35,10)); put 'The padded substring is: ' result;run;
This produces the following output:
The padded substring is: "London "
Because the source string ends after the last character of the substring London, and that substring isonly six characters long, the function returns "London "; four trailing spaces have been added to padthe result to the required ten character length. The string has been quoted so that the spaces can beseen.
SUBSTR
Return a substring of a specified length from a source string.
SUBSTR ( string , startpos [ , length ] )
Finds and returns the substring of a specified length that starts at a specified position in a source string.
Return type: Character
string
Type: Character
The source string.
startpos
Type: Numeric
The position in the source string at which to return the substring.
lengthOptional argument
Type: Numeric
The number of characters of the source string to be returned. This parameter is optional.
Reference for language elementsVersion 3.3
878
Basic exampleIn the following example, the function is used to find and return the string that begins at position 35 andis six characters long. The result is written to the log and to the example dataset.
data example; result=substr("Magnificent Bike Company A 1 2 50 London", 35,6); put "The returned substring is: " result;run;
This produces the following output:
The returned substring is: "London"
Example – returning an errorIn the following example, the function is used to find and return the string that begins at position 35 andis ten characters long. The result is written to the log and to the example dataset.
data example; result=substr("Magnificent Bike Company A 1 2 50 London", 35,10); put "The returned substring is: " result;run;
This produces the following output:
NOTE: Argument 3 to function SUBSTR at line 3296 column 11 is invalidThe returned substring is: London_N_=1 _ERROR_=1 result=London
This example returns the string starting at the position specified through to the end of the string, as wellas message indicating that an error has occurred.
Note:If you had used SUBPAD, the substring would have been padded to the specified length, and no errormessage would have been returned. If you had used SUBSTRN, the function would have read over theend of the string and returned the substring starting at the specified position and finishing at the end ofthe string; no error message would returned.
SUBSTRN
Return a substring of a specified length from a source string, including zero length.
SUBSTRN ( string , startpos [ , length ] )
Returns the substring of a specified length that starts at a specified position in a source string; thesubstring can have zero length, and the function can also read beyond the end of the source stringwithout error.
Return type: Character
Reference for language elementsVersion 3.3
879
string
Type: Character
The source string.
startpos
Type: Numeric
The position in the source string at which to return the substring of length.
lengthOptional argument
Type: Numeric
The number of characters of the source string to be read. This parameter is optional.
If you do not specify length, the substring found starting at position through to the end of the sourcestring is returned.
If length would result in an attempt to read over the end of the string, the characters from positionthrough to the end of the string are returned. Unlike SUBSTR, no error is returned; unlike SUBPAD, nopadding is appended.
If length is set to 0 (zero), null ('') is returned; unlike SUBSTR, no error is returned.
Basic exampleIn the following example, the function is used to find and return the string that begins at position 35 andis six characters long. The result is written to the log and to the example dataset.
data example; result=substrn("Magnificent Bike Company A 1 2 50 London", 35,6); put "The returned substring is: " result;run;
This produces the following output:
The returned substring is: London
Example – with zero lengthIn the following example, the function is used to find and return the string that begins at position 35 andis zero characters long. The result is written to the log and to the example dataset. The QUOTE functionis also used in this example to help visualise the result.
data example; result=quote(substrn("Magnificent Bike Company A 1 2 50 London", 35,0)); put "The returned substring is: " result;run;
This produces the following output:
The returned substring is: ""
Reference for language elementsVersion 3.3
880
Unlike SUBSTR, no error message is returned.
Example – reading over end of lineIn the following example, the function is used to find and return the substring that is ten characters long,beginning at position 35 in a string that is 40 characters long. The result is written to the log and to theexample dataset.
data example; result=substrn("Magnificent Bike Company A 1 2 50 London",35,10); put "The returned substring is: " result;run;
This produces the following output:
The returned substring is: London
Unlike SUBSTR, no error message is returned for exceeding the end of the source string. The functionhas read from the starting position to the end of the source string, and returned only that substring. Notrailing spaces have been appended; you would need to use SUBPAD to achieve that result.
Find first character of a type in string
ANYALNUM
Find the position of the first alphanumeric character in a string.
ANYALNUM ( string [ , startpos ] )
Finds and returns the position of the first alphanumeric character in a string. You can optionally specifya position at which to start searching the string. If no alphanumeric character is found in the string, thevalue 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
Reference for language elementsVersion 3.3
881
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anyalnum("A101 01aSDx", 5) returns 7, the position of the first alphanumericafter character position 5 (the space); anyalnum("A101 01aSDx", -5) returns 4, the positionof the last alphanumeric before character position5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the first instance of an alphanumeric in a string,starting at the fourth character in the string. The result is written to the log and to the example dataset.
data example; result = anyalnum("101 01adx", 4); put "First alphanumeric found at position: " result;run;
This produces the following output:
First alphanumeric found at position: 6
ANYALPHA
Find the position of the first alphabetic character in a string.
ANYALPHA ( string [ , startpos ] )
Finds and returns the position of the first alphabetic character in a string. You can optionally specify aposition at which to start searching the string. If no alphabetic character is found in the string, the value0 (zero) is returned.
For example, if you wanted to start the search at the second position of the string, you would set start to2.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
Reference for language elementsVersion 3.3
882
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anyalpha("A101 01aSDx", 5) returns 9, the position of the first alphabeticcharacter after position 5 (the space); anyalpha("A101 01aSDx", -5) returns 1, the positionof the last alphabetic character before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the position of the first alphabetic character, startingfrom the fifth character, and the result written to the log and to the example dataset.
data example; string1 = "0101 adxG" ; result=anyalpha(string1, 5); put "First alphabetic found at position: " result;run;
This produces the following output:
First alphabetic found at position: 8
ANYCNTRL
Find the position of the first control character in a string.
ANYCNTRL ( string [ , startpos ] )
Finds and returns the position of the first control character in a string. You can optionally specify aposition at which to start searching the string. If no control character is found in string, the value 0 (zero)is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
Reference for language elementsVersion 3.3
883
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anycntrl('33330A33330A'x ,5) returns 6, the position of the first controlcharacter after character position 5; anycntrl('33330A33330A'x ,-5) returns 3, theposition of the last control character before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the position of the first control character. The resultis written to the log and to the example dataset.
data example; a='33330A'x; result=anycntrl(a); put "First control character found at position: " result;run;
This produces the following output:
First control character found at position: 3
This is the position of the LF character.
ANYDIGIT
Find the position of the first numeric character (digit) in a string.
ANYDIGIT ( string [ , startpos ] )
Finds and returns the position of the first numeric character (digit) in a string. You can optionally specifya position at which to start searching the string. If no matching character is found in the string, the value0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
Reference for language elementsVersion 3.3
884
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anydigit("A101 01aSDx", 5) returns 7, the position of the first number afterposition 5 (the space); anyalpha("A101 01aSDx", -5) returns 4, the position of the lastnumber before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the position of the first numeric character, startingfrom the fourth character, and the result written to the log and to the example dataset.
data example; string1="101 01adx"; result = anydigit(string1, 4); put "First digit found at position: " result;run;
This produces the following output:
First digit found at position: 6
ANYFIRST
Find the position of the first character that matches the format of the first character of a variable name.
ANYFIRST ( string [ , startpos ] )
Finds and returns the position of the first character in a string that matches the format for the firstcharacter of a variable name. You can optionally specify a position at which to start searching the string.If no matching character is found in the string, the value 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
Reference for language elementsVersion 3.3
885
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anyfirst("A101 01aSDx", 5) returns 9, the position of the first character,after position 5 (the space), that can be used as the first character in a variable name;anyfirst("A101 01aSDx", -5) returns 1, the position of the last character, before characterposition 5, that can be used as the first character in a variable name.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the position of the first character that can start avariable name. The result is written to the log and to the example dataset.
data example; string1 = "0101 adxG" ; result=anyfirst(string1); put "Character that can be first " "in variable name found at position: " result;run;
This produces the following output:
Character that can be first in variable name found at position: 8
Numbers and spaces cannot be the first character of a variable name.
ANYGRAPH
Find the position of the first graphical character in a string.
ANYGRAPH ( string [ , startpos ] )
Finds and returns the position of the first graphical character in a string. You can optionally specify aposition at which to start searching the string. If no matching character is found in the string, the value 0(zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
886
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anygraph('1C1C311C1C31'x, 5) returns 6, the position of the first graphicalcharacter after position 5; anygraph('1C1C311C1C31'x, -5) returns 3, the position of thelast graphical character before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the first graphical character. The result is written tothe log and to the example dataset.
data example; a='1C1C31'x; result=anygraph(a); put "First graphic character found at position: " result;run;
This produces the following output:
First graphic character found at position: 3
ANYLOWER
Find the position of the first lower-case character in a string.
ANYLOWER ( string [ , startpos ] )
Finds and returns the position of the first lower-case character in a string. You can optionally specify aposition at which to start searching the string. If no matching character is found in the string, the value 0(zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
Reference for language elementsVersion 3.3
887
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anylower("A1b01 01aSDx", 5) returns 10, the position of the first lowercaseafter position 5 (the space); anylower("A1b01 01aSDx", -5) returns 3, the position of thelast lowercase character before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the first lowercase character, starting from the fifthcharacter in the string. The result is written to the log and to the example dataset.
data example; string1 = "0101 adxG" ; result=anylower(string1, 5); put "First lowercase character found at position: " result;run;
This produces the following output:
First lowercase character found at position: 8
ANYNAME
Find the position of the first character in a string that could be a character in a variable name.
ANYNAME ( string [ , startpos ] )
Finds and returns the position of the first character in a string that could be part of a variable name. Youcan optionally specify a position at which to start searching the string. If no matching character is foundin the string, the value 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
Reference for language elementsVersion 3.3
888
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anyname("A101 01aSDx", 5) returns 7, the position of the first character,after position 5 (the space), that can be used in any position except the first in a variable name;anyname("A101 01aSDx", -5) returns 4, the position of the last character before characterposition 5 that can be used in any position except the first in a variable name.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for for the first character than could be used in avariable name, starting from the fifth character in the string and writes the result to the log and to theexample dataset.
data example; string1 = "0101 adxG" ; result=anyname(string1, 5); put "Character that can exist " "in variable name found at position: " result;run;
This produces the following output:
First alphabetic found at position: 8
The function will start searching the string from the fifth character in the string. The result will be 8,as spaces cannot be part of a variable name. If you had not specified that the search should start atthe fifth character, but at the first, the result would have been 1 as numeric characters can be used invariable names (although not for the first character of a variable).
ANYPRINT
Find the position of the first print character in a string.
ANYPRINT ( string [ , startpos ] )
Finds the position of the first print character in a string, and returns that position. You can optionallyspecify a position at which to start searching the string. If no print character is found in the string, thevalue 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
Reference for language elementsVersion 3.3
889
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anyprint('C1C01C1C311C1C31C1C010'x, 6) returns 8, the position of thefirst printing character after position 6; anyprint('C1C01C1C311C1C31C1C010'x, -6) returns 5, the position of the last printing character before character position 6.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the first print character and writes the result to thelog and to the example dataset.
data example; a='C1C010'x; result=anyprint(a); put "First printing character found at position: " result;run;
This produces the following output:
First printing character found at position: 1
ANYPUNCT
Find the position of the first punctuation character in a string.
ANYPUNCT ( string [ , startpos ] )
Finds the position of the first punctuation character in a string, and returns that position. You canoptionally specify a position at which to start searching the string. Punctuation characters are definedby the translation table in use. If no punctuation character is found in the string, the value 0 (zero) isreturned.
Return type: Numeric
string
Type: Character
The string to be analysed.
Reference for language elementsVersion 3.3
890
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anypunct("A1,01 01aS;Dx", 5) returns 12, the position of the firstpunctuation character after position 5 (the space); anypunct("A1,01 01aS;Dx", -5)returns 3, the position of the last punctuation character before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for the first punctuation character, starting from the fifthcharacter in the string and writes the result to the log and to the example dataset.
data example; string1 = "0101ad;xG" ; result=anypunct(string1, 5); put "First punctuation character found at position: " result;run;
This produces the following output:
First punctuation character found at position: 7
ANYSPACE
Find the position of the first space character in a string.
ANYSPACE ( string [ , startpos ] )
Finds and returns the position of the first space character in a string. You can optionally specify aposition at which to start searching the string. If no space character is found in the string, the value 0(zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Reference for language elementsVersion 3.3
891
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anyspace("A10 101a SDx", 5) returns 9, the position of the first space afterposition 5; anyspace("A10 101a SDx", -5) returns 4, the position of the last space beforecharacter position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Spaces include:
• Space character• Horizontal tab• Vertical tab• Line feed• Form feed
ExampleIn this example, the function searches the string for the first space character, starting from the thirdcharacter in the string and writes the result to the log and to the example dataset.
data example; string1 = "0101 adxG" ; result=anyspace(string1, 3); put "First space found at position: " result;run;
This produces the following output:
First space found at position: 5
ANYUPPER
Find the position of the first uppercase character in a string.
ANYUPPER ( string [ , startpos ] )
Finds and returns the position of the first uppercase character in a string. You can optionally specify aposition at which to start searching the string. If no uppercase character is found in the string, the value0 (zero) is returned.
Return type: Numeric
Reference for language elementsVersion 3.3
892
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anyupper("A10 101a SDx", 5) returns 10, the position of the first uppercasecharacter after position 5 (the space); anyupper("A10 101a SDx", -5) returns 1, theposition of the last uppercase character before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for an uppercase character starting at the fifthcharacter. The result is written to the log and to the example dataset.
data example; string1 = "0101 adxG" ; result=anyupper(string1, 5); put "First uppercase found at position: " result;run;
This produces the following output:
First uppercase found at position: 11
ANYXDIGIT
Find the position of the first hexadecimal character in a string.
ANYXDIGIT ( string [ , startpos ] )
Finds and returns the position in a string of the first character that could constitute a hexadecimalnumber (0-9, a-f, A-F). You can optionally specify a position at which to start searching the string. If nocorresponding character is found in the string, the value 0 (zero) is returned.
Return type: Numeric
Reference for language elementsVersion 3.3
893
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, anyxdigit("AB9 101a SDx", 4) returns 7, the position of the first characterthat can be used in a hexadecimal number, after position 4; anyxdigit("AB9 101a SDx",-4) returns 3, the position of the last character that can be used in a hexadecimal number,before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for a character that could be used in a hexadecimalnumber, starting at the fifth character. The result is written to the log and to the example dataset.
data example; string1 = "City xA0" ; result=anyxdigit(string1, 5); put "First hexadecimal character found at position: " result;run;
This produces the following output:
First hexadecimal character found at position: 9
FIRST
Return the first character of a string.
FIRST ( string )
Finds and returns the first character in a string, and returns that character.
Return type: Character
string
Type: Character
Reference for language elementsVersion 3.3
894
The string or a variable containing the string to be examined.
ExampleIn the following example, the function is used to find the first character in the source string. Thecharacter found is written to the log and the example dataset.
data example; result = first('Magnificent Bike Company Bike A 1 2 50 London'); put "The first character in the string is: " result;run;
This produces the following output:
The first character in the string is: M
NOTALNUM
Find the first position in a string of any non-alphanumeric character.
NOTALNUM ( string [ , startpos ] )
Finds and returns the position in a string of the first character that is not alphanumeric. You canoptionally specify a position at which to start searching the string. If only alphanumeric characters arefound in the string, the value 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notalnum("A101 01aSDx", 5) returns 9, the position of the first character afterposition 5 that is not an alphnumeric; notalnum("A101 01aSDx", -5) returns 4, the positionof the last character before character position 5 that is not an alphanumeric.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Reference for language elementsVersion 3.3
895
ExampleIn this example, the function searches for the first instance of an alphanumeric in a string, starting at thetenth character in the string. The result is written to the log and the example dataset.
data example; result = notalnum("Magnificent Bike Company A 1 2 50 London", 10); put "First non-alphanumeric found at position: " result;run;
This produces the following output:
First non-alphanumeric found at position: 12
If the string had been "MagnificentBikeCompany", the result returned would be 0, as all charactersin the string are alphanumeric.
NOTALPHA
Find the position of the first non-alphabetic character in a string.
NOTALPHA ( string [ , startpos ] )
Finds and returns the position of the first non-alphabetic character in a string. You can optionally specifya position at which to start searching the string. For example, if you wanted to start the search at thesecond position of the string, you would set start to 2. If no non-alphabetic character is found in thestring, the value 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notalpha("AB9 AA1a SDx", 5) returns 7, the position of the first characterafter position 5 that is not an alphabetic; notalpha("AB9 AA1a SDx", -5) returns 4, theposition of the last character that is not an alphabetic before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Reference for language elementsVersion 3.3
896
ExampleIn this example, the function searches the string for the position of the first non-alphabetic character.The result is written to the log and to the example dataset.
data example; string1 = "London0101 adxG" ; result=notalpha(string1); put "First non-alphabetic found at position: " result;run;
This produces the following output:
First non-alphabetic found at position: 7
NOTCNTRL
Find the position of the first non-control character in a string.
NOTCNTRL ( string [ , startpos ] )
Finds the position of the first non-control character in a string, and returns that position. You canoptionally specify a position at which to start searching the string.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notcntrl('C1C01C1C311C1C31C1C010'x, 6) returns 8,the position of the first character after position 5 that is not a control character;notcntrl('C1C01C1C311C1C31C1C010'x, -6) returns 5, the position of the last characterthat is not an a control control character before character position 5 (that is, that position containsthe last such character).
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Reference for language elementsVersion 3.3
897
ExampleIn this example, the function searches the string for the position of the first character that is not a controlcharacter. The result is written to the log and to the example dataset.
data example; a='0A3333'x; result=notcntrl(a); put "First non-control character found at position: " result;run;
This produces the following output:
First non-control character found at position: 2
NOTDIGIT
Find the position of the first non-numeric character (digit) in a string.
NOTDIGIT ( string [ , startpos ] )
Finds and returns the position of the first non-numeric character in a string. You can optionally specify aposition at which to start searching the string.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notdigit("AB9 111a SDx", 6) returns 8, the position of the first characterafter position 5 that is not a number; notdigit("AB9 AA1a SDx", -5) returns 4, the positionof the last character that is not a number before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Reference for language elementsVersion 3.3
898
ExampleIn this example, the function searches the string for the position of the first non-numeric character, andthe result written to the log and to the example dataset.
data example; result = notdigit("101London 01adx"); put "First non-numeric found at position: " result;run;
This produces the following output:
First non-numeric found at position: 4
NOTFIRST
Find the position of the first character in a string that cannot be used as the first character of a variablename.
NOTFIRST ( string [ , startpos ] )
Finds and returns the position of the first character in a string that cannot be the first character of avariable name. You can optionally specify a position at which to start searching the string.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notfirst("A101AA AA1aSDx", 5) returns 7, the position of the first character,after position 5 (the space), that cannot be used as the first character in a variable name;notfirst("A101AA AA1aSDx", -5) returns 1, the position of the last character, beforecharacter position 4, that cannot be used as the first character in a variable name.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Reference for language elementsVersion 3.3
899
ExampleIn this example, the function searches the string for the position of the first character that can start avariable name, starting from the fifth character, and the result written to the log and to the exampledataset.
data example; string1 = "ad0101 xG" ; result=notfirst(string1); put "First character that cannot be used as first character" " of variable name found at position: " result;run;
This produces the following output:
First character that cannot be used as first character of variable name found at position: 3
This result is returned as a number cannot be the first character of a variable name.
NOTGRAPH
Find the position of the first character that is not a graphical character in a string.
NOTGRAPH ( string [ , startpos ] )
Finds the position of the first character that is not a graphical character in a string, and returns thatposition. You can optionally specify a position at which to start searching the string.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notgraph('1C1C45311C1C4531'x, 4) returns 5, the position of the first non-graphical character after position 5; notgraph('1C1C45311C1C4531'x, -4) returns 2, theposition of the last non-graphical character before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Reference for language elementsVersion 3.3
900
If only graphical characters are found in the string, the value 0 (zero) is returned.
ExampleIn this example, the function searches the string for the first non-graphical character, starting from thefifth character in the string and writes the result to the log and to the example dataset.
data example; a='1C1C31'x; result=notgraph(a); put "First non-graphical character found at position: " result;run;
This produces the following output:
First non-graphical character found at position: 1
NOTLOWER
Find the position of the first character that is not lower-case character in a string.
NOTLOWER ( string [ , startpos ] )
Finds and returns the position in a string of the first character that is not lower-case. You can specify aposition at which to start searching the string, or start at the first character of the string (the default). Forexample, if you wanted to start the search at the second position of the string, you would set start to 2.If no lower-case character is found in the string, the value 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notlower("aa10a bA1aSDx", -7) returns 8, the position of the first non-lowercase character after position 7; notlower("aa10abA1aSDx", -7) returns 6, theposition of the last non-lowercase character (in this case, the space) before character position 7.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Reference for language elementsVersion 3.3
901
ExampleIn this example, the function searches the string for the first character that is not lowercase, startingfrom the fifth character in the string, and writes the result to the log and to the example dataset.
data example; string1 = "bicycle, A1, 120"; result=notlower(string1,5); put "First non-lowercase character found at position: " result;run;
This produces the following output:
First non-lowercase character found at position: 8
This is the comma (,) after the word bicycle.
NOTNAME
Find the position of the first character in a string that cannot be a character in a variable name.
NOTNAME ( string [ , startpos ] )
Finds the position of the first character in a string that cannot be a character in a variable name, andreturn that position. You can optionally specify a position at which to start searching the string. If nomatching character is found in the string, the value 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notname("A 01SDx", 3) returns 0, as no there is no character after position 3, that cannot be used in any position except the first in a variable name; notname("A 01SDx",-3) returns 3, the position of the last character before character position 3 that cannot be used inany position except the first in a variable name.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
Reference for language elementsVersion 3.3
902
ExampleIn this example, the function searches the string for a character that could be used in a variable name,starting from the third character in the string, and writes the result to the log and to the exampledataset.
data example; string1 = "ad0101 xG"; result=notname(string1,3); put "First character that cannot be a character " "in a variable name found at position: " result;run;
This produces the following output:
First character that cannot be a character in a variable name found at position: 7
This result is returned because spaces cannot be part of a variable name. If the starting position of thefunction had not been the third character, but the first; the result would still have been 7 as alphabeticand numeric characters can be used in variable names (although numerics cannot be used for the firstcharacter of a variable name).
NOTPRINT
Find the position of the first character that is not a print character in a string.
NOTPRINT ( string [ , startpos ] )
Finds the position of the first character that is not a print character in a string, and returns that position.You can optionally specify a position at which to start searching the string.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
Reference for language elementsVersion 3.3
903
For example, notprint('1C1C45311C1C4531'x, 4) returns 5, the position of the first non-printing character after position 4; notprint('1C1C45311C1C4531'x, -4) returns 2, theposition of the last non-printing character before character position 4.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
If no print character is found in the string, the value 0 (zero) is returned.
ExampleIn this example, the function searches the string for the first non-printing character, starting from the fifthcharacter in the string, and writes the result to the log and to the example dataset.
data example; a='C1C010'x; result=notprint(a); put "First non-printing character found at position: " result;run;
This produces the following output:
First non-printing character found at position: 3
NOTPUNCT
Find the position of the first character that is not a punctuation character in a string.
NOTPUNCT ( string [ , startpos ] )
Finds the position of the first character that is not a punctuation character in a string, and returnsthat position. You can optionally specify a position at which to start searching the string. Punctuationcharacters are defined by the translation table in use.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
Reference for language elementsVersion 3.3
904
For example, notpunct("A1,01...01aS", 7) returns 9, the position of the first non-punctuation character after position 7; notpunct("A1,01...01aS", -7) returns 5, theposition of the last non-punctuation character before character position 7.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
If only punctuation characters are found in the string, the value 0 (zero) is returned.
ExampleIn this example, the function searches the string for the first non-punctuation character, starting from thefifth character in the string, and writes the result to the log and to the example dataset.
data example; string1 = "#1,0,1ad;xG"; result=notpunct(string1, 5); put "First non-punctuation character found at position: " result;run;
This produces the following output:
First non-punctuation character found at position: 6
NOTSPACE
Find the position of the first character in a string that is not a space character.
NOTSPACE ( string [ , startpos ] )
Finds the position of the first character that is not a space character in a string, and returns thatposition. You can optionally specify a position at which to start searching the string.
Return type: Numeric
string
Type: Character
The string to be analysed.
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
Reference for language elementsVersion 3.3
905
For example, notspace("A10 101a SDx", 9) returns 11, the position of the first non-spacecharacter after position 9; notspace("A10 101a SDx", -9) returns 8, the position of the lastnon-space character space before character position 9.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
If only space characters are found in the string, the value 0 (zero) is returned.
Spaces include:
• Space character• Horizontal tab• Vertical tab• Line feed• Form feed
ExampleIn this example, the function searches the string for the first non-space character, starting from the ninthcharacter in the string, and writes the result to the log and to the example dataset.
data example; string1 = "10 01 01 adxG" ; result=notspace(string1, 9); put "First non-space found at position: " result;run;
This produces the following output:
First non-space found at position: 12
NOTUPPER
Find the position of the first character that is not in uppercase in a string.
NOTUPPER ( string [ , startpos ] )
Finds the position of the first character not in uppercase in a string, and return the position of thatcharacter. You can optionally specify a position at which to start searching the string. If no upper-casecharacter is found in the string, the value 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
Reference for language elementsVersion 3.3
906
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notupper("a10 ABCEG SDx", 5) returns 10, the position of the first non-uppercase character after position 5; notupper("a10 ABCEG SDx", -5) returns 4, theposition of the last non-uppercase character before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for a character not in uppercase. The result is written tothe log and to the example dataset.
data example; string1 = "LONDON0101 adx G" ; result=notupper(string1); put "First non-uppercase character found at position: " result;run;
This produces the following output:
First non-uppercase character found at position: 7
NOTXDIGIT
Find the position in a string of the first character that is not a character in a hexadecimal number.
NOTXDIGIT ( string [ , startpos ] )
Finds and returns the position in a string of the first character that is not a possible hexadecimal number(that is, not one of the characters 0 through 9, a through f, and A through F). You can optionally specifya position at which to start searching the string. If no corresponding character is found in the string, thevalue 0 (zero) is returned.
Return type: Numeric
string
Type: Character
The string to be analysed.
Reference for language elementsVersion 3.3
907
startposOptional argument
Type: Numeric
The position in string at which the search starts.
If you set startpos to a positive number, the function searches for the first instance of thecharacter at or beyond that character position. If you set startpos to a negative number, thefunction looks backward through the string starting at the (positive) character position.
For example, notxdigit("AB9H 101aH SDx", 6) returns 10, the position of the firstcharacter that cannot be used in a hexadecimal number, after position 6; notxdigit("AB9H101aH SDx", -6) returns 5, the position of the last character that cannot be used in ahexadecimal number, before character position 5.
If you do not set this parameter, the search starts at the first (leftmost) character of string.
ExampleIn this example, the function searches the string for characters that do not make up hexadecimalnumbers. The result is written to the log and to the example dataset.
data example; string1 = "01A0London00Bicycle" ; result=notxdigit(string1); put "First non-hexadecimal character found at position: " result;run;
This produces the following output:
First non-hexadecimal character found at position: 5
Find length of strings
LENGTH
Return the length of a non-blank character string, excluding trailing blanks.
LENGTH ( string )
Returns the length of a character string, excluding any trailing blanks or, if the string is blank (null, orcomposed entirely of spaces), returns the value 1. If a number is specified as an argument, a value of12 is returned, and a message written to the log noting that numeric values have been converted tocharacter values.
Return type: Numeric
Reference for language elementsVersion 3.3
908
string
Type: Character
A string to be examined for a substring.
If the length of a variable has been specified and the variable contains a string to be checked, then ifthe string is longer than the specified length, the length of the variable will be returned.
Basic ExampleIn the following example, the function is used to find the length of various strings. The results are writtento the log and to the example dataset.
data example; number=1234567890123456789; result1=length('Magnificent Bike Company Bike A 1 2 50 London '); result2=length(' '); result3=length(number); put "The length of the string is: " result1; put "The length of the string is: " result2; put "The length of the string is: " result3;run;
This produces the following output:
The length of the string is: 47The length of the string is: 1The length of the string is: 12
In this example:
• The first use of the function returns the value 47, which is the length of the string ignoring the trailingblanks.
• The second use of the function returns the value 1, as the string contains only blanks.• The third use of the function returns the value 12, because the string contains a numeric value. A
message is written to the log by WPS noting that numeric values have been converted to charactervalues.
Reference for language elementsVersion 3.3
909
Example – strings in variables of a specified lengthIn the following example, the function is used to find the length of various strings that have beenassigned to variables with a specified length. The results are written to the log and to the exampledataset.
data example; length twsl twsln $10; twsl="Bicycle"; result = length(twsl); ps = quote(twsl); put "The string is now: " ps " and its length is: " result; twsl="Twenty-three bicycles"; result = length(twsl); ps = quote(twsl); put "The string is now: " ps " and its length is: " result; twsln=""; result = length(twsln); ps = quote(twsln); put "The string is now: " ps " and its length is: " result; run;
This produces the following output:
The string is now: "Bicycle " and its length is: 7The string is now: "Twenty-thr" and its length is: 10The string is now: " " and its length is: 1
Because this function excludes trailing spaces, the padding spaces applied to the strings to makethem match the length specified for the variable are ignored. However, the string that is longer than thespecified variable length has been truncated, and the length returned by the function is the same as thevariable length.
LENGTHC
Return the length of a character string, including leading and trailing blanks.
LENGTHC ( string )
Returns the length of a character string, including any leading or trailing blanks. If a number is specifiedas an argument, the value 12 is returned, and a message written to the log noting that numeric valueshave been converted to character values.
Return type: Numeric
string
Type: Character
A string.
Reference for language elementsVersion 3.3
910
If the string is null ('') the value 1 is returned.
If the length of a variable has been specified, and the string to be checked is contained in that variable,then the length returned will be length of the variable.
Basic ExampleIn the following example, the function is used to find the length of various strings. The results are writtento the log and to the example dataset.
data example; data example; number=1234567123456789; result1=lengthc('Magnificent Bike Company Bike A 1 2 50 London '); result2=lengthc(' '); result3=lengthc(''); result4=lengthc(number); put "The length of the string is: " result1; put "The length of the string is: " result2; put "The length of the string is: " result3; put "The length of the string is: " result4;
run;
This produces the following output:
The length of the string is: 51The length of the string is: 4The length of the string is: 1The length of the string is: 12
• The first use of the function returns the value 51, which is the length of the string including trailingblanks.
• The second use of the function returns the value 4, which is the number of spaces in the string.• The third use of the function returns the value 1, because the string is a null.• The fourth use of the function returns the value 12, because the string contains a numeric value.
A message is written to the log noting that the numeric values have been converted to charactervalues.
Reference for language elementsVersion 3.3
911
Example – strings in variables of a specified lengthIn the following example, the function is used to find the length of various strings that have beenassigned to variables with a specified length. The results are written to the log and to the exampledataset.
data example; length twsl twsln $10; twsl="Bicycle"; result = lengthc(twsl); ps = quote(twsl); put "The string is now: " ps " and its length is: " result; twsl="Twenty-three bicycles"; result = lengthc(twsl); ps = quote(twsl); put "The string is now: " ps " and its length is: " result; twsln=""; result = lengthc(twsln); ps = quote(twsln); put "The string is now: " ps " and its length is: " result; run;
This produces the following output:
The string is now: "Bicycle " and its length is: 10The string is now: "Twenty-thr" and its length is: 10The string is now: " " and its length is: 10
In this example, no matter the length of the string assigned to a variable, the result returned is 10,because both variables have been assigned a length of ten characters and the padding spaces are notignored. Strings shorter than the variable length are padded with spaces, and strings longer than thevariable length are truncated. Contrast this result to that obtained with LENGTH.
LENGTHM
Return the number of bytes of memory allocated to a character string.
LENGTHM ( string )
Returns the number of bytes of memory occupied by a character string, including any leading or trailingblanks. If a number is specified as an argument, a value of 12 is returned, and a message written to thelog noting that numeric values have been converted to character values.
Return type: Numeric
string
Type: Character
The string to be examined.
Reference for language elementsVersion 3.3
912
If the length of a variable has been specified, and the string to be checked is contained in that variable,then the number returned will correspond to the length of the variable.
Basic ExampleIn the following example, the function is used to return results for various strings. The results are writtento the log and to the example dataset.
data example; number=1234567123456789; result1=lengthm(' Magnificent Bike Company Bike A 1 2 50 London '); result2=lengthm(' '); result3=lengthm(''); result4=lengthm(number); put "The number of bytes occupied by the string is: " result1; put "The number of bytes occupied by the string is: " result2; put "The number of bytes occupied by the string is: " result3; put "The number of bytes occupied by the string is: " result4;run;
This produces the following output:
The number of bytes occupied by the string is: 55The number of bytes occupied by the string is: 4The number of bytes occupied by the string is: 1The number of bytes occupied by the string is: 12
In this example:
• The first use of the function returns the value 55, which is the number of bytes of memory occupiedby the string; the string in this case includes leading and trailing spaces.
• The second use of the function returns the value 4, which is the number of bytes of memoryoccupied by the string.
• The third use of the function returns the value 1, as the string contains a null.• The fourth use of the function returns the value 12, because the string contains a numeric value.
A message is written to the log noting that the numeric values have been converted to charactervalues.
Reference for language elementsVersion 3.3
913
Example – strings in variables of a specified lengthIn the following example, the function is used to return results for various strings that have beenassigned to variables with a specified length. The results are written to the log and to the exampledataset.
data example; length twsl twsln $10; twsl="Bicycle"; result = lengthc(twsl); ps = quote(twsl); put "The string is now: " ps " and its length is: " result; twsl="Twenty-three bicycles"; result = lengthc(twsl); ps = quote(twsl); put "The string is now: " ps " and its length is: " result; twsln=""; result = lengthc(twsln); ps = quote(twsln); put "The string is now: " ps " and its length is: " result; run;
This produces the following output:
The string is now: "Bicycle " and its length is: 10The string is now: "Twenty-thr" and its length is: 10The string is now: " " and its length is: 10
Strings shorter than the variable length have been padded with spaces, and strings longer than thevariable length have been truncated. In this example, therefore, the result returned is 10 for each string,because both variables have been assigned a length of ten characters and padding spaces are notignored. Contrast this result to that obtained with LENGTH.
LENGTHN
Return the length of a character string, excluding trailing blanks.
LENGTHN ( string )
Returns the length of a character string, including any leading blanks, but excluding trailing blanks;if the string is null ('') or contains only blanks the value 0 is returned. If a number is specified as anargument, a value of 12 is returned, and a message written to the log noting that numeric values havebeen converted to character values.
Return type: Numeric
string
Type: Character
Reference for language elementsVersion 3.3
914
The string for which the length is required.
If the length of a variable has been specified, and the string to be checked is contained in that variable,then the length returned will be length of the variable minus any leading spaces. See below for anexample.
Basic ExampleIn the following example, the function is used to find the length of various strings. The results are writtento the log and to the example dataset.
data example; number=1234567123456789; result1=lengthn(' Magnificent Bike Company Bike A 1 2 50 London '); result2=lengthn(' '); result3=lengthn(''); result4=lengthn(number); put "The length of the string is: " result1; put "The length of the string is: " result2; put "The length of the string is: " result3; put "The length of the string is: " result4;run;
This produces the following output:
The length of the string is: 51The length of the string is: 0The length of the string is: 0The length of the string is: 12
In this example:
• The first use of the function returns the value 51, which is the length of the string including leadingblanks but excluding trailing blanks.
• The second use of the function returns the value 0, as the string consists only of spaces.• The third use of the function returns the value 0, as the string consists of a null.• The fourth use of the function returns the value 12, because the string contains a numeric value.
A message is written to the log noting that the numeric values have been converted to charactervalues.
Reference for language elementsVersion 3.3
915
Example – strings in variables of a specified lengthIn the following example, the function is used to find the length of various strings that have beenassigned to variables with a specified length. The results are written to the log and to the exampledataset.
data example; length twsl twsln $15; twsl="Bicycle"; result = lengthn(twsl); ps = quote(twsl); put "The string is now: " ps " and its length is: " result; twsl=" Bicycle "; result = lengthn(twsl); ps = quote(twsl); put "The string is now: " ps " and its length is: " result; twsln=""; result = lengthn(twsln); ps = quote(twsln); put "The string is now: " ps " and its length is: " result; run;
This produces the following output:
The string is now: "Bicycle " and its length is: 7The string is now: " Bicycl" and its length is: 10The string is now: " " and its length is: 0
This function includes leading spaces from the count, but ignores trailing spaces, including the paddingspaces applied to the strings to make them match the length specified for the variable. However, thestring that is longer than the specified variable length has been truncated, and the length returned bythe function is the same as the variable length. Contrast this result to that obtained with LENGTH andLENGTHC.
Find number or string in a list
CHOOSEC
Find the string at a specified position in a list of strings.
CHOOSEC ( value , { item , … } )
Finds and returns the string at a specified position in a list of comma-separated strings.
Return type: Character
Reference for language elementsVersion 3.3
916
value
Type: Numeric
The ordinal position of the string in the list of strings. This should be an integer. For example, ifthere are five strings, the leftmost is number 1, and the rightmost number 5; to select the thirdstring in the list, specify 3 for this argument.
item
Type: Character
A string, or a variable containing a string.
Example – returning string found at specified positionIn the following example, the function is used to find the second string in the list of strings provided tothe function. The result is written to the log and the example dataset.
data example; string1="Company"; result = choosec(2,"Magnificent","Bike", string1,"London"); put "The string found is: " result;run;
This produces the following output:
The string found is: Bike
Example – returning string contained in variableIn the following example, the function is used to find the third string in the list of strings provided to thefunction. In this example, the third string is contained in a variable. The result is written to the log andthe example dataset.
data example; string1="Company"; result = choosec(3,"Magnificient","Bike", string1,"London"); put "The string found is: " result;run;
This produces the following output:
The string found is: Company
The function returns the third string in the list, which in this example is Company, the string contained inthe parameter string1.
Reference for language elementsVersion 3.3
917
CHOOSEN
Find the number at a specified location in a list of numbers.
CHOOSEN ( value , { item , … } )
Finds the number at a specified position in a list of numbers, and returns that number.
Return type: Numeric
value
Type: Numeric
The ordinal position of the number in the list of numbers. This should be an integer. For example,if there are five numbers, the leftmost is number 1, and the rightmost number 5; to select the thirdnumber in the list, specify 3 for this argument.
item
Type: Numeric
A number.
Example – returning number found at specified positionIn the following example, the function is used to find the second number in the list of numbers providedto the function. The result is written to the log and to the example dataset.
data example; var1=10; result = choosen(2, 1, 100, var1, 7, 12, 9); put "The number found is: " result;run;
This produces the following output:
The number found is: 100
Example – returning number contained in variableIn the following example, the function is used to find the fourth number in the list of numbers provided tothe function. The result is written to the log and to the example dataset.
data example; var1=10; result = choosen(4, 1, 100, var1, 7, 12, 9); put "The number found is: " result;run;
This produces the following output:
The number found is: 100
Reference for language elementsVersion 3.3
918
The function has returned the number at the fourth position in the list, which is contained in the variablevar1.
Find position of a character or substrings in a sourcestring
CHAR
Find the character at a specified position in a string.
CHAR ( string , position )
Finds the character at a specified location in a string, and returns that character.
Return type: Character
string
Type: Character
The string in which you want to find a character.
position
Type: Numeric
The position in the string at which to find the character.
ExampleIn the following example, the function examines the string at the specified position, and returns thecharacter at that position. The result is written to the log and to the example dataset.
data example; result = char("101 01adx", 8); put "The character at the specified position is: " result;run;
This produces the following output:
The character at the specified position is: a
Reference for language elementsVersion 3.3
919
FIND
Find the first occurrence of a string within a string.
FIND ( string , substring , [ modifiers ] [ , startpos ] )
FIND ( string , substring , [ startpos ] [ , modifiers ] )
Finds the first occurrence of a string within another string, and returns the position at which it wasfound. If the source string does not contain an instance of the specified search string, the functionreturns 0.
Return type: Numeric
string
Type: Character
The string in which you want to search for another string.
substring
Type: Character
The string for which you want to search in string.
modifiersOptional argument
Parameters that modify the output. The following modifiers are available:
"I"
Ignore case.
"T"
Trim spaces from the end of substring.
startposOptional argument
Type: Numeric
The position in string at which the function should start searching for substring.
Example – finding location of a stringIn the following example, the function is used to find the first occurrence of the string Bike in the sourcestring. The position at which it is found is written to the log and the example dataset.
data example; search = 'Bike'; result = find('Magnificent Bike Company A 1 2 50 (Bike) London', search); put "The string is found at character position: " result;run;
Reference for language elementsVersion 3.3
920
This produces the following output:
The string is found at character position: 13
This is the position at which the first instance of the string Bike starts.
Example – ignoring case in searchIn the following example, the function is used to find the first occurrence of the string Bike or bike(or bIke or BikE) in the source string. The position at which it is found is written to the log and theexample dataset.
data example; search = 'bike'; result = find('Magnificent Bike Company A 1 2 50 London', search, 'I'); put "The string is found at character position: " result;run;
This produces the following output:
The string is found at character position: 13
In this case, bike matches Bike because the I modifier tells the function to ignore case.
Example – starting search at specified locationIn the following example, the function is used to find the first occurrence of the string 'Bike' in thesource string from and including the character at the 20th position in the string. If the string is found, theposition at which it was found is written to the log and the example dataset.
data example; search = 'Bike'; result = find('Magnificent Bike Company A 1 2 50 London', search, 20); put "The string is found at character position: " result;run;
This produces the following output:
The string is found at character position: 0
The function starts searching the source string at the specified position, 20. The function doesn't finda match for the search string, because the search starts after the position of the only occurrence of thesearch string in the source string. The function will therefore return the value 0.
FINDC
Find the first occurrence of a character within a string.
FINDC ( string , characters , [ modifiers ] [ , startpos ] )
FINDC ( string , characters , [ startpos ] [ , modifiers ] )
Reference for language elementsVersion 3.3
921
Finds the first occurrence of a character within another string, and returns the position at which it wasfound. If the source string does not contain an instance of a specified character, the function returns 0.You can specify more than one character for the search as a string, and the function will find the firstoccurrence of any character in the string.
Return type: Numeric
string
Type: Character
The string in which you want to search for character.
characters
Type: Character
One or more characters for which you want to search in string.
modifiersOptional argument
"I"
Ignore case.
"O"
Store the list of characters to be searched for the first time the function is called. This canincrease processing efficiency if there are multiple calls to the function.
"T"
Strips any trailing spaces in characters.
"V"
Return the value 1 to indicate that at least one of the search characters exists in the string.
startposOptional argument
Type: Numeric
The position in string at which the function should start searching for characters.
Example – simple findIn the following example, the function is used to find any character in the string F5ox in the sourcestring. The position at which the first occurrence is found is written to the log and the example dataset.
data example; search = 'F5ox'; result = findc('Magnificent, Bike, Company A 1 2 50 London', search); put "The character is first found at character position: " result;run;
Reference for language elementsVersion 3.3
922
This produces the following output:
The character is first found at character position: 21
This is the position at which the first instance of a character in the search string (in this example o)occurs.
Example – ignoring case in searchIn the following example, the function is used to find any character in the string F5ox in the sourcestring, and ignores the case of the characters in the search string. The position at which the firstoccurrence of matching character is found is written to the log and the example dataset.
data example; search = 'F5ox'; result = findc('Magnificent, Bike, Company A 1 2 50 London', search, 'I'); put "The character is first found at character position: " result;run;
This produces the following output:
The character is first found at character position: 6
This is the position at which the first instance of the f character occurs; this matches the searchcharacter F because the I modifier has been set.
Example – starting search at specified locationdata example; search = 'B'; result = findc('Magnificent Bike Company A 1 2 50 London', search, 20); put "The character is first found at character position: " result;run;
This produces the following output:
The character is first found at character position: 0
Because the function starts searching the source string at the specified position, 20, the function findsno match for the search character.
Example – confirming existence of characterdata example; search = 'B'; result = findc('Magnificent Bike Company A 1 2 50 London', search, 'V'); put "The character is first found at character position: " result;run;
This produces the following output:
The character is first found at character position: 1
Because the V modifier has been specified, the function returns 1 to confirm the character exists in thestring, not the position at which it was found.
Reference for language elementsVersion 3.3
923
INDEX
Get the starting position of a string within another string.
INDEX ( string , substring )
Finds a specified substring within a string, and returns the position of that substring. If the substring isnot found, 0 (zero) is returned.
Return type: Numeric
string
Type: Character
A string to be examined for a substring.
substring
Type: Character
The substring to be found in source.
ExampleIn the following example, the function is used to find a substring in a source string. The position at whichit is first found is written to the log and to the example dataset.
data example; search='Bike'; result = index('Magnificent Bike Company Bike A 1 2 50 London', search); put "The string is found at character position: " result;run;
This produces the following output:
The string is found at character position: 13
This is the first position at which the string was found.
INDEXC
Return the first position at which a specified character occurs in a string.
INDEXC ( source , { chars , … } )
Finds a specified character within a string, and returns the position at which the character is first found.If the character is not found, 0 (zero) is returned. You can specify more than one character, in whichcase the position of the first matching character is found.
Reference for language elementsVersion 3.3
924
For example, if you specify a search for the character i in the string Bike, the function returns 2, whichis the position of the first occurrence of that character. However, if you search for iB, the functionreturns 1, which is the position of the first of the characters found, in this case B.
Return type: Numeric
source
Type: Character
A string be examined for one or more characters.
chars
Type: Character
One or more characters to be searched for in source.
ExampleIn the following example, the function is used to find one of the characters i (excerpt) in a source string.The position at which it is first found is written to the log and the example dataset.
data example; search='bko'; result = indexc('Magnificent Bike Company Bike A 1 2 50 London', search); put "The first character is found at position: " result;run;
This produces the following output:
The first character is found at position: 15
This is the first position at which a matching character was found; in this example, k. Case must match,therefore b was not matched with the B in Bike.
INDEXW
Return the first position at which a specified word occurs in a string.
INDEXW ( source , word [ , delimiter ] )
Finds a specified word within a string, and returns the position at which the first instance of the wordis found. If the word is not found, 0 (zero) is returned. By default, a word is a string delimited byspaces. You can, however, specify the delimiter that is used in the string. A word must be completelydelimited to be found; for example, Bike will not be matched in the source MagnificentBike, asMagnificentBike is the entire delimited word; see examples below for more detail.
Return type: Numeric
Reference for language elementsVersion 3.3
925
source
Type: Character
A string to be examined for an occurrence of a word.
word
Type: Character
The word to be searched for in source.
delimiterOptional argument
Type: Character
The character used as the separator in source.
Examples
The following examples show how you can use the INDEXW function.
Basic ExampleIn the following example, the function is used to find the word Bike in a source string. The position atwhich it is first found is written to the log and the example dataset.
data example; search='Bike'; result = indexw('Magnificent Bike Company (Bike)', search); put "The word is found at character position: " result;run;
This produces the following output:
The word is found at character position: 13
This is the position at which the first occurrence of the word Bike was found. Case must match; if bikehad been specified in search, it would not have matched Bike and 0 would have been returned.
Reference for language elementsVersion 3.3
926
Using a SeparatorIn the following example, the function is used to find the word Bike (excerpt) in a source string; wordsin the source are separated by commas (,). The position at which the word is first found is written to thelog and the example dataset.
data example; search='Bike'; separator=','; result = indexw('Magnificent Bike Company,Bike,London', search, separator); put "The word is found at character position: " result;run;
This produces the following output:
The word is found at character position: 26
This is the position at which the first occurrence of the word Bike was found. In this example the stringMagnificent Bike Company is delimited by a comma, and is thus seen as one word. If the stringhad been:
Magnificent Bike Company, Bike,London
no match would have been found as a word is delimited by separators, and the word Bike in this caseis preceded by a space which would be included as part of the word.
Find substring in source string
COALESCEC
Find the first string containing characters other than all spaces or null.
COALESCEC ( { string , … } )
Return the first string that does not contain only spaces, or is null, in a list of strings.
Return type: Character
string
Type: Character
A string to be examined.
Reference for language elementsVersion 3.3
927
ExampleIn the following example, the function searches the strings provided to it for the first that does notcontain only spaces or is null. The result is written to the log and the example dataset.
data example; empty=" "; result = coalescec('', ' ', empty, ' World Programming'); put "The resulting string is: " result;run;
This produces the following output:
The resulting string is: World Programming
The first string provided to the function is null, the second string is all spaces, and the variable emptyalso contains all spaces; the function therefore returns World Programming.
CONTAINS
Identify whether a specified string exists in another string.
CONTAINS ( string , find-string )
Searches a source string for a specified string, and returns 1 if the string is found in the source string, 0otherwise.
Return type: Numeric
string
Type: Character
The string to be examined.
find-string
Type: Character
The string to find in source.
Example – matching specified stringIn the following example, the function is used to find the string London in the source string. The result iswritten to the log and to the example dataset.
data example; search = 'London'; result = contains('Steve Bike Company A 1 2 50 London', search); put "The result is: " result;run;
Reference for language elementsVersion 3.3
928
This produces the following output:
The result is: 1
The string London is found in the source string, therefore 1 is returned.
Example – not matching specified stringIn the following example, the function is used to find the the string london in the source string. Theresult is written to the log and the example dataset.
data example; search='london'; result=contains('Steve Bike Company A 1 2 50 London', search); put "The result is: " result;run;
This produces the following output:
The result is: 0
The string london is not found in the source string, therefore 0 (zero) is returned.
SCAN
Find the word at a specified index position in a source string.
SCAN ( string , n , [ delimiters ] [ , modifiers ] )
Finds and returns the word at a specified position in a source string. The source string is treated as alist of words delimited by spaces (by default) or any other character you specify. Each word occupies aposition in the list from 1 through n and can be accessed using this function. Various modifiers can beused to set parameters which can specify additional delimiters and to modify the way the source stringis searched.
Return type: Character
string
Type: Character
The string to be examined. This parameter is mandatory.
n
Type: Numeric
The ordinal position of the word in the string you want to examine. This parameter is mandatory.
delimitersOptional argument
Type: Character
Reference for language elementsVersion 3.3
929
A delimiter used to separate words. This parameter is optional. You can specify more than onedelimiter.
modifiersOptional argument
Parameters that specify characters to be used as delimiters if the string contains none of thedelimiters specified in delimiter, or in addition to the specified delimiters, or to modify the searchin the string. You can specify more than one modifier. For example, you can specify 'C', or'CAS'.
The following modifiers are available:
"A"
Alphabetic characters, or a string of characters, are considered delimiters.
"B"
Examines the string from right to left rather then left to right.
"C"
Control characters are considered delimiters.
"D"
Decimal numbers (0 through 9) are considered delimiters.
"F"
Characters considered valid characters for the first position in a variable name areconsidered delimiters.
"G"
Graphical characters are considered delimiters.
"H"
All spaces including tabs are considered delimiters. As with spaces, if the H modifier isused, punctuation characters and spaces are also considered delimiters.
"I"
Ignore the case of alphabetic characters specified as delimiters. For example, this modifierwill make A equivalent to a as a delimiter.
"K"
Cause modifiers to act in the opposite way. For example, if L is set, instead of consideringall lower-case characters as delimiters, the function will instead consider all uppercasecharacters as delimiters.
"L"
Lowercase alphabetic character will be considered a delimiter.
Reference for language elementsVersion 3.3
930
"M"
Multiple adjacent separators delimit nulls. By default, multiple adjacent separators areassumed to operate as a single separator. In the following example, this option is notspecified (the default):
data _null_; result1 = scan('london,,,bike,company;;A1', 3, ',;'); put result1; run;
The function would return company, as the adjacent separators are treated as a singleseparator. However, if you specified the M modifier:
data _null_; result1 = quote(scan('london,,,bike,company;;A1', 3, ',;', 'M')); put result1; run;
the function would return "", as adjacent separators are now treated as individualseparators each delimiting a null.
Note:The QUOTE function has been used in this example so that the null can be seen in theresult written to the log.
"N"
Characters considered valid for a variable name are considered delimiters.
"O"
Store the list of separators required the first time the function is called. This can increaseprocessing efficiency if there are multiple calls to the function.
"P"
Punctuation marks are considered delimiters. Punctuation marks are as defined in thecollating sequence for the device.
"Q"
Ignore separators in strings delimited by quotation marks. For example:
data _null_; result1 = scan('"The London Bike Company" A1 London ',2,' ','q'); result2 = scan('"The London Bike Company" A1 London ',2,' '); put result1; put result2;run;
In this example, the following is written to the log:
A1London
Reference for language elementsVersion 3.3
931
In the first use of the function, the first word is The London Bike Company, as the Qmodifier ensures the spaces are not identified as separators; the second word is thereforeA1. In the second use of the function, spaces within the quoted string are identified asseparators, as the Q modifier is not specified; the second word is therefore London.
"R"
Remove opening and closing quotation marks from a string containing them.
"S"
Remove leading and trailing spaces from the returned string.
"T"
Remove trailing spaces from delimiter and from source.
"U"
Uppercase alphabetic character are considered delimiters.
"V"
Not currently available.
"W"
Printing characters are considered delimiters.
"X"
Characters that constitute a hexadecimal number (0-9, a-f, A-F) are considered delimiters.
Basic ExampleIn the following example, the function is used to find the fourth word in a string. The result is written tothe log and the example dataset. No delimiter is specified, so spaces are used as delimiters.
data example; result = scan('Steve Bike Company A 1 2 50 London',4); put "The word found is: " result;run;
This produces the following output:
The word found is: A
Example – source with comma-delimited itemsIn the following example, the function is used to find the fourth word in a string. The result is writtento the log and the example dataset. No delimiter is specified, so the commas are recognised asdelimiters.
data example; result = scan('Steve,Bike,Company,A,1,2,50,London',4); put "The word found is: " result;run;
Reference for language elementsVersion 3.3
932
This produces the following output:
The word found is: A
Example – source with various delimitersIn the following example, the function is used to find the sixth word in a string. The result is writtento the log and the example dataset. No delimiter is specified, so spaces and punctuation charactersare recognised as delimiters; the H modifier has been used to ensure that horizontal tabs are alsorecognised as delimiters.
data example; result = scan('Steve,Bike Company;A 1 2 50 London',8,,'H'); put "The word found is: " result;run;
This produces the following output:
The word found is: London
SCANQ
Return the word at a specified index position in a string, specifying the separator between words.
SCANQ ( string , n [ , delimiters ] )
Finds the word at a specified index position in a source string, and returns that word. The source stringis treated as a list of words delimited by spaces (by default) or any other character you specify. Eachword occupies a position in the list from 1-n and can be accessed using this function.
Note:This function is a similar to the SCAN function but has a simpler format; it is also, therefore, less flexiblethan SCAN. If you require more flexibility in searching the source string, see the SCAN function.
Return type: Character
string
Type: Character
The string to be examined.
n
Type: Numeric
The position of the word in the string you want to examine.
delimitersOptional argument
Reference for language elementsVersion 3.3
933
Type: Character
A delimiter used to separate words. This parameter is optional. You can specify more than onedelimiter.
If you do not set the delimiter parameter, or set it to null (''), spaces are recognised as delimiters. Tabsare not recognised as spaces.
Basic ExampleIn the following example, the function is used to find the fourth word in a string. The result is written tothe log and the example dataset. No delimiter is specified, so spaces are used as delimiters.
data example; result = scanq('Steve Bike Company A 1 2 50 London',4); put "The word found is: " result;run;
This produces the following output:
The word found is: A
As no delimiter has been specified, spaces are used as delimiters; the function returns the string A.
Example – specifying delimiterIn the following example, the function is used to find the fourth word in a string. The result is written tothe log and the example dataset.
data example; result = scanq('Steve,Bike,Company,A,1,2,50,London',4, ','); put "The word found is: " result;run;
This produces the following output:
The word found is: A
Example – specifying multiple delimitersIn the following example, the function is used to find the sixth word in a string. The result is written tothe log and the example dataset. Comma (,) and semi-colon (;) are specified as delimiters.
data example; result = scanq('Steve,Bike Company;A 1 2 50 London',3,',;'); put "The word found is: " result;run;
This produces the following output:
The word found is: A 1 2 50 London
Reference for language elementsVersion 3.3
934
VERIFY
Verifies that a character or string exists in another string.
VERIFY ( string , { substring , … } )
Searches a source string for matches to specified substrings. The function returns the position ofthe first character of the source string that does not match a specified substring. If the source stringcontains none of the specified substrings, 0 is returned.
Return type: Numeric
string
Type: Character
The string to be searched for specified substrings.
substring
Type: Character
The substring to be found in source.
Example – verifying string contains single charactersIn each of the following examples, the result is written to the log and to the example dataset.
In the following example, the function searches for the character a.
data example; result = verify('aaabbb', 'a'); put 'The character is first NOT found at position: ' result;run;
This produces the following output:
The character is first NOT found at position: 4
In the following example, the function searches for the character b.
data example; result = verify('aaabbb', 'b'); put 'The character is first NOT found at position: ' result;run;
This produces the following output:
The character is first NOT found at position: 1
In the following example, the function searches for the characters a and b .
data example; result1 = verify('aaabbb', 'a','b'); put 'The character is first NOT found at position: ' result1;run;
Reference for language elementsVersion 3.3
935
This produces the following output:
The character is first NOT found at position: 0
The function returns 0 (zero) in this instance as there is nowhere in the string where one of thecharacters does not exist.
Example – verifying string contains substringsIn each of the following examples, the result is written to the log and to the example dataset.
In the following example, the function searches for the string BigCat.
data example; result = verify('BigCatLeopard', 'BigCat'); put 'The string is first NOT found at position: ' result;run;
This produces the following output:
The string is first NOT found at position: 7
In the following example, the function searches for the strings Big and Cat.
data example; result = verify('BigCatLeopard', 'Big', 'Cat'); put 'The strings are first NOT found at position: ' result;run;
This produces the following output:
The strings are first NOT found at position: 7
Character position seven is the first at which neither of the strings Big and Cat is found.
In the following example, the function searches for the strings Big, Cat and Leopard:
data example; result = verify('BigCatLeopard', 'Big', 'Cat', 'Leopard'); put 'The strings are first NOT found at position: ' result;run;
This produces the following output:
The strings are first NOT found at position: 0
The function returns 0 as there is no position in the source strings at which one of the strings is notfound.
Finally, in the following example the function searches for the string Leopard:
data example; result = verify('BigCatLeopard', 'Leopard'); put 'The strings are first NOT found at position: ' result;run;
This produces the following output:
The string is first NOT found at position: 1
Reference for language elementsVersion 3.3
936
The function returns 1 because that is the first position at which Leopard is not found.
WHICHC
Identify the first string in a list of strings that matches a specified string.
WHICHC ( string , { comp-string , … } )
Identifies the first string in a list of strings that matches the string you specify, and returns as a numberthe ordinal position of the matched string in the list of strings. The strings for which to search arespecified as one or more comma-separated strings. For example, if the list of strings has four items,and the third string matches, then 3 is returned. If no matching string is found, 0 is returned.
Return type: Numeric
string
Type: Character
The string you want to find in a list of other strings.
comp-string
Type: Character
A string to be matched with string.
ExampleIn the following example, the function is used to find the string Bike in a list of strings. The result iswritten to the log and to the example dataset.
data example; result1 = whichc('Bike','Bice', 'Boke', 'Bike'); put "The string is number " result1 "in the list";run;
This produces the following output:
The string is number 3 in the list
CALL SCAN
Return the position and/or length of the substring at the specified index position in a source string.
CALL SCAN ( string , n , position , length , [ delimiters ] [ , modifiers ] );
Reference for language elementsVersion 3.3
937
Finds the substring at a specified ordinal position in a source string, and returns the length andcharacter position for that substring. The source string is treated as a list of substrings delimited byspaces (by default) or any other character you specify. Each word occupies a position in the list from1 through n and can be accessed using this function. Various modifiers can be used to set parameterswhich can specify additional delimiters and to modify the way the source string is seached.
string
Type: Character
The string to be examined. This parameter is mandatory.
n
Type: Numeric
The position of the word you want to examine in the string. This parameter is mandatory.
position
Type: Numeric
The parameter into which the character position of the substring in the source string is returned.
Note:The delimiters are included in the character count for position.
length
Type: Numeric
The parameter into which the length of the substring is returned. The length is the number ofcharacters it comprises from its first character to the next delimiter.
delimitersOptional argument
Type: Character
A delimiter used to separate words. This parameter is optional. You can specify more than onedelimiter.
modifiersOptional argument
Parameters that specify characters to be used as delimiters if the string contains none of thedelimiters specified in delimiter, or in addition to the specified delimiters, or to modify the searchin the string. You can specify more than one modifier. For example, you can specify 'C', or'CAS'.
The following modifiers are available:
"A"
Alphabetic characters, or a string of characters, are considered delimiters.
Reference for language elementsVersion 3.3
938
"B"
Examines the string from right to left rather then left to right.
"C"
Control characters are considered delimiters.
"D"
Decimal numbers (0 through 9) are considered delimiters.
"F"
Characters considered valid characters for the first position in a variable name areconsidered delimiters.
"G"
Graphical characters are considered delimiters.
"H"
All spaces including tabs are considered delimiters. As with spaces, if the H modifier isused, punctuation characters and spaces are also considered delimiters.
"I"
Ignore the case of alphabetic characters specified as delimiters. For example, this modifierwill make A equivalent to a as a delimiter.
"K"
Cause modifiers to act in the opposite way. For example, if L is set, instead of consideringall lower-case characters as delimiters, the function will instead consider all uppercasecharacters as delimiters.
"L"
Lowercase alphabetic character will be considered a delimiter.
"M"
Multiple adjacent separators delimit nulls. By default, multiple adjacent separators areassumed to operate as a single separator. In the following example, this option is notspecified (the default):
data _null_; result1 = scan('london,,,bike,company;;A1', 3, ',;'); put result1; run;
The function would return company, as the adjacent separators are treated as a singleseparator. However, if you specified the M modifier:
data _null_; result1 = quote(scan('london,,,bike,company;;A1', 3, ',;', 'M')); put result1; run;
Reference for language elementsVersion 3.3
939
the function would return "", as adjacent separators are now treated as individualseparators each delimiting a null.
Note:The QUOTE function has been used in this example so that the null can be seen in theresult written to the log.
"N"
Characters considered valid for a variable name are considered delimiters.
"O"
Store the list of separators required the first time the function is called. This can increaseprocessing efficiency if there are multiple calls to the function.
"P"
Punctuation marks are considered delimiters. Punctuation marks are as defined in thecollating sequence for the device.
"Q"
Ignore separators in strings delimited by quotation marks. For example:
data _null_; result1 = scan('"The London Bike Company" A1 London ',2,' ','q'); result2 = scan('"The London Bike Company" A1 London ',2,' '); put result1; put result2; run;
In this example, the following is written to the log:
A1London
In the first use of the function, the first word is The London Bike Company, as the Qmodifier ensures the spaces are not identified as separators; the second word is thereforeA1. In the second use of the function, spaces within the quoted string are identified asseparators, as the Q modifier is not specified; the second word is therefore London.
"R"
Remove opening and closing quotation marks from a string containing them.
"S"
Remove leading and trailing spaces from the returned string.
"T"
Remove trailing spaces from delimiter and from source.
"U"
Uppercase alphabetic character are considered delimiters.
Reference for language elementsVersion 3.3
940
"V"Not currently available.
"W"
Printing characters are considered delimiters.
"X"
Characters that constitute a hexadecimal number (0-9, a-f, A-F) are considered delimiters.
If you do not specify a delimiter, spaces and punctuation characters are recognised as delimiters; in thiscase, spaces and punctuation characters can be mixed in the source string and will be recognised asdelimiters. Tabs are not recognised as spaces, so if the source includes tab delimiters you need to usethe H modifier; as with spaces, if the H modifier is used, punctuation characters and spaces will also berecognised as delimiters.
Basic ExampleIn the following example, the function is used to find to find the position and length of the third substringin a string. The result is written to the log and to the example dataset. No delimiter is specified, sospaces are used as delimiters.
data example; pos=0; len=0; call scan('Magnificent Bike Company A 1 2 50 London',3,pos,len); put "The position of the third substring is " pos; put "The length of the third substring is " len;run;
This produces the following output:
The position of the third substring is 18The length of the third substring is 7
The third substring in the source is Company
Example – source with comma-delimited itemsIn the following example, the function is used to find the position and length of the eighth substring ina string. The result is written to the log and to the example dataset. No delimiter is specified, so thecommas in the source are recognised as delimiters.
data example; pos=0; len=0; call scan('Magnificent,Bike,Company,A,1,2,50,London',8,pos,len); put "The position of the eighth substring is " pos; put "The length of the eighth substring is " len;run;
Reference for language elementsVersion 3.3
941
This produces the following output:
The position of the eighth substring is 35 The length of the eighth substring is 6
The eighth substring in the source is London.
Example – source with various delimitersIn the following example, the function is used to find the sixth word in a string delimited by tabs.The result is written to the log and the example dataset. No delimiter is specified, so spaces andpunctuation characters are recognised as delimiters; the H modifier has been used to ensure thathorizontal tabs are also recognised as delimiters.
data example; pos=0; len=0; call scan('Magnificent,Bike,Company A 1 2 50 London', 8, pos, len,,'H'); put "The position of the eighth substring is " pos; put "The length of the eighth substring is " len;run;
This produces the following output:
The position of the eighth substring is 39The length of the eighth substring is 6
The eighth substring in the source is London (as commas, spaces and tabs have been recognised asdelimiters).
CALL SCANQ
Return the position and/or length of the substring at the specified index position in a source string,specifying the separator between substrings.
CALL SCANQ ( source , n , position , length [ , delimiters ] );
Finds the word at a specified ordinal position in a source string, and returns the length and characterposition for that word to parameters in the routine. The source string is treated as a list of wordsdelimited by spaces (by default) or any other character you specify. Each word occupies a position inthe list from 1 through n and can be accessed using this function.
source
Type: Character
The string to be examined.
n
Type: Numeric
The position of the word you want to examine in the string. This parameter is mandatory.
Reference for language elementsVersion 3.3
942
position
Type: Numeric
The parameter into which the character position of the substring in the source string is returned.
Note:The delimiters are included in the character count for position.
length
Type: Numeric
The parameter into which the length of the substring is returned. The length is the number ofcharacters it comprises from its first character to the next delimiter.
delimitersOptional argument
Type: Character
A delimiter used to separate words. This parameter is optional. You can specify more than onedelimiter.
If you do not set the delimiter parameter, or set it to null (''), spaces are recognised as delimiters. Tabsare not recognised as spaces.
Basic ExampleIn the following example, the function is used to find to find the position and length of the third substringin a string. The result is written to the log and to the example dataset. No delimiter is specified, sospaces are used as delimiters.
data example; pos=0; len=0; call scan('Magnificent Bike Company A 1 2 50 London',3,pos,len); put "The position of the third substring is " pos; put "The length of the third substring is " len;run;
This produces the following output:
The position of the third substring is 18The length of the third substring is 7
The third substring in the source is Company
Reference for language elementsVersion 3.3
943
Example – specifying delimiterIn the following example, the function is used to find the position and length of the third substring in thesource string. The result is written to the log and the example dataset.
data example; pos=0; len=0; call scanq('Magnificent,Bike,Company A 1 2 50 London',3,pos,len,','); put "The position of the third substring is " pos; put "The length of the third substring is " len;run;
This produces the following output:
The position of the third substring is 18The length of the third substring is 23
As the delimiter has been specified as the comma, spaces are not used as delimiters. The thirdsubstring in the source is, therefore, Company A 1 2 50 London.
Example – specifying multiple delimitersIn the following example, the function is used to find the position and length of the fifth substring ina source string delimited using various punctuation marks. The result is written to the log and theexample dataset. In this example, hyphen (-), full stop (.) and colon (:) are specified as delimiters.
data example; pos=0; len=0; call scanq('Magnificent-Bike-Company.A:1:2:50.London',5,pos,len,'-:.'); put "The position of the fifth substring is " pos; put "The length of the fifth substring is " len;run;
This produces the following output:
The position of the fifth substring is 28The length of the fifth substring is 1
In this example, the specified delimiters have the effect of delimiting each 'word' in the source string.The fifth substring in the source is, therefore, the number 1.
Modify strings, characters and numerics
BYTE
Convert a decimal value to a character.
BYTE ( n )
Reference for language elementsVersion 3.3
944
Converts a decimal value to the equivalent character byte. You might need to do this if, for example,data contains decimal values for characters rather than the characters themselves.
Return type: Character
n
Type: Numeric
An unsigned decimal number. If <varname>n</varname> is not a decimal number, an erroroccurs.
ExampleIn this example, SUBSTR searches the string for a number at the specified location, and returns theresult to NUM. The BYTE function is then used to convert that number; the result is written to the log andto the example dataset.
data example; num=substr("101 01adx", 1,3); result = byte(num); put "Converted value is: " result;run;
This produces the following output:
Converted value is: e
The function converts the value found in num, which is 101, to a character, which will be e in the USEnglish ASCII code page.
COMPRESS
Remove specified characters from a string.
COMPRESS ( sring , [ characters-to-remove ] [ , modifiers ] )
Removes occurrences of specified characters from a string, and returns the modified string. Thisfunction can be used to remove spaces, separators, tabs, numbers, and so on, depending on modifiersto the function you can specify.
Return type: Character
sring
Type: Character
The string to be examined.
characters-to-removeOptional argument
Reference for language elementsVersion 3.3
945
Type: Character
A list of characters to be removed from the string. For example, setting this parameter to'aeiou' would remove all vowels from the string. If you omit this parameter, nothing is removedfrom the string except what is specified by by a modifier. If you set it to null (''), all spaces (butnot tabs) are removed. If you omit this parameter and want to specify the modifiers parameter,you must insert the associated separator.
modifiersOptional argument
Parameters that modify the output. You can specify more than one modifier. For example, youcan specify 'C', or 'CAS'. The following modifiers are available:
"A"
All alphabetic characters will be removed
"C"
All control characters are removed.
"D"
All decimal numbers (0 through 9) are removed.
"F"
All characters considered a valid character for the first position in a variable name will beremoved.
"G"
All graphics characters are removed.
"H"
All spaces including tabs are removed.
"I"
Ignore case of characters to remove. For example, if you specify B in characters-to-remove, and then specify this modifier, both B and b will be removed.
"K"
Causes modifiers to act in the opposite way. So, for example, if L is set, instead ofremoving all lower-case characters, the function will instead remove all uppercasecharacters.
"L"
Removes all lower-case alphabetic characters.
"N"
A character considered a valid character for a variable name will be considered a delimiter.
Reference for language elementsVersion 3.3
946
"O"
Store the list of characters to be removed the first time the function is called. This canincrease processing efficiency if there are multiple calls to the function.
"P"
Removes all punctuation marks.
"S"
Removes all spaces, including tabs.
"T"
If you specify characters-to-remove other than spaces (the default), any trailing spacesat the end of the source are retained. To remove these spaces, use this modifier. Forexample:
data _null_; result = quote(compress('London ','L','T')); put result;run;
returns "ondon"; without the modifier, "ondon " would have been returned.
"U"
Removes all upper-case alphabetic characters.
"W"
Removes all printing characters.
"X"
Removes all strings/characters that comprise hexadecimal numbers (0-9, a-f and A-F).
Example – removing spacesIn the following example, the function is used to find to find the position and length of the third substringin a string. The result is written to the log and to the example dataset. No delimiter is specified, sospaces are used as delimiters.
data example; pos=0; len=0; call scan('Magnificent Bike Company A 1 2 50 London',3,pos,len); put "The position of the third substring is " pos; put "The length of the third substring is " len;run;
This produces the following output:
The position of the third substring is 18The length of the third substring is 7
The third substring in the source is Company
Reference for language elementsVersion 3.3
947
In the following example, the function is used to compress multiple spaces to nulls. The result is writtento the log and to the example dataset.
data example; result = compress('Steve Bike Company A 1 2 50 London', ' '); put "The string returned is: " result;run;
This produces the following output:
The string returned is: SteveBikeCompany A 1250 London
Spaces have been removed, but tabs have been retained.
Example – removing spaces and hexadecimal numbersIn the following example, the function is used to compress multiple spaces to nulls, and to removecharacters that might represent hexadecimal numbers. The result is written to the log and to theexample dataset.
data example; result = compress('Steve Bike Company A 1 2 50 London', ' ', 'X'); put "The string returned is: " result;run;
This produces the following output:
The string returned is: Stvikompny Lonon
The function has removed spaces (but retained tabs) and characters that might represent hexadecimalnumbers.
Example – upper-case charactersIn the following example, the function is used to compress one or more spaces to nulls, and to removeupper-case characters. The result is written to the log and to the example dataset.
data example; result = compress('Steve Bike Company A 1 2 50 London',, 'U'); put "The string returned is: " result;run;
This produces the following output:
The string returned is: teve ike ompany 1 2 50 ondon
All upper-case characters have been removed. No other characters were removed, because the secondargument (characters-to-remove) is not specified.
Reference for language elementsVersion 3.3
948
Example – removing specified alphabetic and upper-case charactersIn the following example, the function is used to remove lower-case letter e and upper-case characters.The result is written to the log and to the example dataset.
data example; result = compress('Steve Bike Company A 1 2 50 London','e', 'U'); put "The string returned is: " result;run;
This produces the following output:
The string returned is: tv ik ompany 1 2 50 ondon
All occurrences of the letter e have been removed, and all upper-case characters as specified by the Uoption.
Example – removing multiple specified charactersIn the following example, the function is used to remove all vowels and all numeric characters. Theresult is written to the log and the example dataset.
data example; result = compress('Steve Bike Company A 1 2 50 London','aeio', 'D'); put "The string returned is: " result;run;
This produces the following output:
The string returned is: Stv Bk Cmpny A Lndn
The letters a, e, i and o have been removed. All numeric characters have also been removed, asspecified by the D option.
DEQUOTE
Strip quotation marks from a string.
DEQUOTE ( string )
Strips the opening and closing quotation marks from a string, and returns the modified string.
Return type: Character
string
Type: Character
The string to be stripped.
Reference for language elementsVersion 3.3
949
ExampleIn the following example, the function is used to strip the opening and closing quotation marks from thesource string to the function. The modified string is written to the log and the example dataset.
data example; result = dequote("'Magnificent Bike Company A 1 2 50 London'"); put result;run;
This produces the following output:
Magnificent Bike Company A 1 2 50 London
This is the original string with the quotation marks removed.
MD5
Create an MD5 hash for a string.
MD5 ( string )
Creates and returns an MD5 hash for a string. The hash is created as a hexadecimal value.
Return type: Character
string
Type: Character
The string for which an MD5 hash is required.
ExampleIn the following example, the function is used to create an MD5 hash for a supplied string. The result iswritten to the log and the example dataset.
data example; result = md5('Magnificent Bike Company A 1 2 50 London '); s=input(result, $phex8.); put 'The MD5 hash is ' s;run;
This produces the following output:
The MD5 hash is 1573DBE56B4595D
The value is returned as a hexadecimal, which is then converted to a string by the informat.
Reference for language elementsVersion 3.3
950
MISSING
Flag whether a string is missing a value.
MISSING ( argument )
Examines the argument provided, which can be a number, string or variable, and flags whether it isor contains something other than null or spaces. You can use this function, for example, to ensurean observation or variable contains meaningful data. If a string contains null ('') or only spaces, 1 isreturned. If a string contains any other characters, 0 is returned.
Return type: Numeric
argument
Type: Character or numeric value
The string to be examined.
ExampleIn the following example, the function is used to examine various strings. The results are written to thelog and to the example dataset.
data example; num=num2-3; result1 = missing(''); result2 = missing(' '); result3 = missing(' h '); result4 = missing(5); result5 = missing(num); put result1; put result2; put result3; put result4; put result5;run;
This produces the following output:
11001
In this example:
• result1 is 1, as the first string is null.• result2 is 1, as the second string consists entirely of spaces.• result3 is 0, as the string contains a character that is not null or space.• result4 is 0, as the value is numeric.
Reference for language elementsVersion 3.3
951
• result5 is 1, as the value is missing because uninitialised num2 was used in the expression.
NLITERAL
Convert a string to a name literal.
NLITERAL ( string )
Converts a string to a name literal. If resulting literal does not have the format of a variable name, thesource string is wrapped in double quotation marks and appended with the N character.
Return type: Character
string
Type: Character
The string to be converted.
ExampleIn the following example, the function converts two strings; the result is written to the log and theexample dataset.
data example; result1 = nliteral('text'); result2 = nliteral('1text'); put result1; put result2;run;
This produces the following output:
text"1text"N
QUOTE
Add quotation marks to a string.
QUOTE ( string [ , type ] )
Adds quotation marks to a specified string, and returns the quoted string. By default, double quotationmarks are added to the string. You can specify single quotation marks if required.
Return type: Character
Reference for language elementsVersion 3.3
952
string
Type: Character
The string to which quotation marks will be applied.
typeOptional argument
Type: Character
Specifies the type of quotation mark. Enter "'" for single quotation marks. This parameter isoptional.
Example – using default quotation marksIn the following example the string is wrapped in default double quotation marks; the result is written tothe log and the example dataset.
data example; sentence='London Bikes'; result=quote(sentence); put "Quoted string: " result;run;
This produces the following output:
Quoted string: "London Bikes"
Example – using single quotation marksIn the following example the string is wrapped in single double quotation marks; the result is written tothe log and the example dataset.
data example; sentence='London Bikes'; result=quote(sentence, "'"); put "Quoted string: " result;run;
This produces the following output:
Quoted string: 'London Bikes'
REPEAT
Repeat provided character or string.
REPEAT ( string , n )
Takes the character or string provided to the function and repeats it. You must specify the number oftimes it should be repeated; there is no default value.
Reference for language elementsVersion 3.3
953
Return type: Character
string
Type: Character
A character or a string to be repeated.
n
Type: Numeric
An integer that specifies the number of repetitions.
The result returned is a string containing the specified number n of instances of the character or string,plus the initial character or string. Therefore, if n is 2, for example, there will be three instances of thecharacter or string. The characters or strings returned are concatenated with the original. See theexample below for more detail.
ExampleIn the following example a string is repeated three times; the result is written to the log and theexample dataset.
data example; sentence='London Calling'; result=repeat(sentence, 3); put "Resulting string is: " result;run;
This produces the following output:
Resulting string is: London CallingLondon CallingLondon CallingLondon Calling
There are three repeated strings concatenated with the original string, giving a total of four instances ofthe original string.
REVERSE
Reverse a string.
REVERSE ( string )
Reverses a string supplied to it and returns the result.
Return type: Character
string
Type: Character
The string to be reversed.
Reference for language elementsVersion 3.3
954
ExampleIn the following example a string is reversed and the result written to the log and the example dataset.
data example; sentence='London Calling'; result=reverse(sentence); put "Reversed string is: " result;run;
This produces the following output:
Reversed string is: gnillaC nodnoL
SOUNDEX
Convert a string to its soundex equivalent.
SOUNDEX ( string )
Converts a string to the equivalent soundex form, and returns the result. Soundex is an algorithm thatenables words that sound alike to be represented in a similar way, despite differences in spelling. Forexample, Smith, Smyth and Smythe can all be represented by the soundex value, S53.
The soundex algorithm retains the first letter of a word (converting it to upper case, if necessary), dropsall other occurrences of the letters AEIOUYHW, and then assigns a numeric value to other letters. Ifthere are two or more adjacent letters with the same number only the first number is retained; letterswith the same number separated by H or W are coded as a single number; letters with the samenumber separated by a vowel are coded twice. For more information on the soundex algorithm, see thesoundex coding rules at the National Archives and Records Administration Web site.
Note:The soundex algorithm truncates the result at four characters, and pads results shorter than fourcharacters with zeros. The SOUNDEX function returns all characters formed by the algorithm through tothe end of the string, and does not pad returned values shorter than four characters with zeros; if youneed to make the value returned by SOUNDEX match the soundex algorithm, you will have to performfurther operations, such as using SUBSTR to return the first four characters.
Return type: Character
string
Type: Character
The source string.
Reference for language elementsVersion 3.3
955
Basic ExampleIn the following example, the function is used to convert various strings to soundex form. The result iswritten to the log and to the example dataset.
data example; result1 = soundex('Bike'); result2 = soundex('Boke'); result3 = soundex('Orange'); result4 = soundex('Oranj'); result5 = soundex('Orange Juice'); put result1; put result2; put result3; put result4;run;
This produces the following output:
B2B2O652O652O65222
Example – results converted to standard soundexIn the following example, the function is used to convert various strings to soundex form. Any resultsthat don't match the standard soundex four-character length are transformed to match that standard.The results are written to the log and to the example dataset.
data example; INFILE DATALINES; input a $ 20.; in = soundex(a); result=trim(in); if length(result) > 4 then do; ss = substr(result,1,4); end; if length(result) < 4 then do; if length(result) = 1 then do; ss = catt(result, '000'); end; if length(result) = 2 then do; ss = catt(result, '00'); end; if length(result) = 3 then do; ss = catt(result,'0'); end; end;
res=put(cat(put(a, $char20.),'SOUNDEX result = ', put(result, $char12.), '...make standard: ', ss),$char350.); put res;datalines;SmithSmythe
Reference for language elementsVersion 3.3
956
DeweyDewiCholmondley-Warner;
This produces the following output:
Smith SOUNDEX result = S53 ...make standard: S530Smythe SOUNDEX result = S53 ...make standard: S530Dewey SOUNDEX result = D ...make standard: D000Dewi SOUNDEX result = D ...make standard: D000Cholmondley-Warner SOUNDEX result = C45534656 ...make standard: C455
TRANSLATE
Change a character in a string to another character.
TRANSLATE ( string , to , { from , … } )
Finds all instances of a specified character in a string, changes (translates) them to another specifiedcharacter, and returns the modified string. You can change more than one character.
Return type: Character
string
Type: Character
The string in which character changes are required.
to
Type: Character
One or more characters to convert (translate) to.
from
Type: Character
One or more characters to convert (translate) from.
Note:
You can also specify multiple characters to change as pairs of to/from parameters; for example:
translate("Bike Company', 'a', 'o', 'u', 'i')
Reference for language elementsVersion 3.3
957
ExampleIn the following example, the function is used to convert the letters a and i into o and u. The result iswritten to the log and to the example dataset.
data example; result=translate("Magnificent Bike Company", 'ou', 'ai'); put result;run;
This produces the following output:
Mognufucent Buke Compony
The function returns the result: Magnufucent Buke Campany.
TRANSTRN
Replace a substring in a source string with another substring.
TRANSTRN ( string , from , to )
Finds a specified substring in a source string, changes (translates) all instances of it to a specifiedsubstring, and returns the modified source string.
Return type: Character
string
Type: Character
The string which contains one or more substrings to be changed.
from
Type: Character
The substring to replace.
to
Type: Character
The replacement substring. A null (zero length string) can be used as the replacement string.
Note:The only difference between TRANWRD and TRANSRTN is in how they handle a null (empty) stringspecified in the to parameter. With TRANSWRD, if to is null a space is used instead.
The string provided in from must match a substring in the source string exactly for a replacement to bemade.
Reference for language elementsVersion 3.3
958
ExampleIn the following example, the substring Bike is replaced with Car. The result is written to the log and tothe example dataset.
data example; result1=transtrn('Magnificent Bike Company', 'Bike', 'Car'); result2=transtrn('Magnificent Bike Company', 'Bike', trimn('')); put result1; put result2; run;
The first use of the function returns the result:
Magnificent Car Company
Note:If you had specified bike as the from string, no changes would have been made, as bike would notmatch Bike.
The second use of the function returns the result:
Magnificent Company
In this case, Bike has been replaced with the null string ('').
Note:The example uses TRIMN to ensure any spaces are removed from the null string, as null strings areexpanded to a space in the DATA step.
TRANTAB
Use translation tables to modify strings.
TRANTAB ( string , trantab-name [ , table-number ] )
Modifies strings using translation tables, and returns the results.
Return type: Character
string
Type: Character
The string to be modified
trantab-name
Type: Character
The name of a catalog containing the translation table.
Reference for language elementsVersion 3.3
959
table-numberOptional argument
Type: Numeric
The number of a specific table within catalogue.
ExampleIn the following example, the function is used to modify a string using tables. The tables are first set upusing PROC TRANTAB and PROC CATALOG. The TRANTAB function is then used to modify a string. Theresult is written to the log and to the example dataset.
/* Create an example TRANTAB. Table 1 decrements every byte. Table 2 increments every byte.*/proc trantab table=WPSTEST;replace 0 'FF000102030405060708090A0B0C0D0E'x '0F101112131415161718191A1B1C1D1E'x '1F202122232425262728292A2B2C2D2E'x '2F303132333435363738393A3B3C3D3E'x '3F404142434445464748494A4B4C4D4E'x '4F505152535455565758595A5B5C5D5E'x '5F606162636465666768696A6B6C6D6E'x '6F707172737475767778797A7B7C7D7E'x '7F808182838485868788898A8B8C8D8E'x '8F909192939495969798999A9B9C9D9E'x '9FA0A1A2A3A4A5A6A7A8A9AAABACADAE'x 'AFB0B1B2B3B4B5B6B7B8B9BABBBCBDBE'x 'BFC0C1C2C3C4C5C6C7C8C9CACBCCCDCE'x 'CFD0D1D2D3D4D5D6D7D8D9DADBDCDDDE'x 'DFE0E1E2E3E4E5E6E7E8E9EAEBECEDEE'x 'EFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFE'x;swap;replace 0 '0102030405060708090A0B0C0D0E0F10'x '1112131415161718191A1B1C1D1E1F20'x '2122232425262728292A2B2C2D2E2F30'x '3132333435363738393A3B3C3D3E3F40'x '4142434445464748494A4B4C4D4E4F50'x '5152535455565758595A5B5C5D5E5F60'x '6162636465666768696A6B6C6D6E6F70'x '7172737475767778797A7B7C7D7E7F80'x '8182838485868788898A8B8C8D8E8F90'x '9192939495969798999A9B9C9D9E9FA0'x 'A1A2A3A4A5A6A7A8A9AAABACADAEAFB0'x 'B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0'x 'C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0'x 'D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0'x 'E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0'x 'F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF00'x;swap;save both;run;
/* Modify the catalog description of the new trantab */
Reference for language elementsVersion 3.3
960
proc catalog c=wpsuser.profile entrytype=trantab;modify WPSTEST(description='Decrement/Increment order');run;
/* Modify a string using the tables of the trantab. */data example;s = '123456789BCDEFGbcdefg';s1 = trantab(s, 'WPSTEST', 1);s2 = trantab(s, 'WPSTEST', 2);s3 = trantab(s1, 'WPSTEST', 2);put "All characters decreased one step from original: " s1; put "All characters increased one step from original: " s2; put "Modified string decreased one step (back to original): " s3; ;run;
This produces the following output:
All characters decreased one step from original: 012345678ABCDEFabcdefAll characters increased one step from original: 23456789:CDEFGHcdefghModified string decreased one step (back to original): 123456789BCDEFGbcdefg
TRANWRD
Replace a word in a source string with another word.
TRANWRD ( string , from , to )
Replace a word in a source string with another word.
Finds a specified word in a source string, changes all instances of it to a specified word, and returns themodified source string.
Note:The only difference between TRANWRD and TRANSRTN is in how they handle a null (empty) stringspecified in the to parameter. With TRANSTRN, to can be zero length (null).
Return type: Character
string
Type: Character
The string which contains one or more word to be changed.
from
Type: Character
The word to replace.
to
Type: Character
Reference for language elementsVersion 3.3
961
The replacement word. If this parameter is null, a space is used as the replacement string.
The word provided in from must match a substring in the source string exactly for a replacement to bemade.
ExampleIn the following example, the word Bike is replaced with other strings. The result is written to the logand to the example dataset.
data example; a=''; result1=tranwrd('Magnificent Bike Company', 'Bike', 'Car'); result2=tranwrd('Magnificent Bike Company', 'Bike', trimn(a)); put result1; put result2; run;
The first use of the function returns the result:
Magnificent Car Company
Note:If you had specified bike as the from string, no changes would have been made, as bike would notmatch Bike.
The second use of the function returns the result:
Magnificent Company
In this case, Bike has been replaced with a ('').
Note:TRIMN is used to ensure any spaces are removed from the null string; this example demonstrates thatthe null string is replaced by a null in the result of the TRANWRD function.
CALL MISSING
Replace data with equivalent missing values.
CALL MISSING ( [ { value , … } ] );
Assigns numeric missing values (represented by a full stop (.)) to numeric values, and spaces to stringvalues. String values are replaced with the same number of spaces as there are characters in theoriginal string.
valueOptional argument
Type: Character or numeric value
Reference for language elementsVersion 3.3
962
The argument to which a missing value is to be applied.
ExampleIn the following example, the function is used to set various values with a corresponding missing value.The results are written to the log and the example dataset.
data example; a = 5; b = 6; call missing(a,b); put a; put b; c = 'London'; d = 'Bike'; call missing(c,d); result1=quote(c); result2=quote(d); put result1; put result2;run;
This produces the following output:
.
." "" "
In the first CALL MISSING, the numeric values 5 and 6 are both replaced by the numeric missingvalue . (full stop). In the second CALL MISSING, the string values London and and Bike have beenreplaced by spaces; these strings have the same length as the orginal string. The QUOTE function hasbeen used to wrap the strings in quotation marks, so that the spaces can be seen.
CALL SORTC
Sorts a list of strings.
CALL SORTC ( [ { string , … } ] );
Sorts a list of strings, presented as arguments, into alphabetic order. The contents of the arguments arechanged to match the sort order.
stringOptional argument
Type: Character
An argument containing a string to be sorted.
Reference for language elementsVersion 3.3
963
Basic exampleIn the following example, the function is used to sort the strings in an array. The result is written to thelog and to the example dataset.
data example; length c1 c2 c3 $ 11; c1 = 'Magnificent'; c2 = 'London'; c3 = 'Bikes'; call sortc(c1,c2,c3); put c1 " " c2 " " c3;run;
This produces the following output:
Bikes London Magnificent
Example – sorting array of stringsIn the following example, the function is used to sort a list of strings. The result is written to the log andto the example dataset.
data example; array jj(12) $10 ('jack' 'jill' 'janet' 'john' 'humpty' 'dumpty' 'tom' 'jerry' 'captain' 'pugwash' 'black' 'pig'); call sortc(of jj(*)); put jj(*);run;
This produces the following output:
black captain dumpty humpty jack janet jerry jill john pig pugwash tom
Remove spaces from a source string
COMPBL
Remove multiple spaces from a string.
COMPBL ( string )
Removes multiple consecutive spaces from a string, replaces them with a single space, and returns themodified string. Tabs are unaffected.
Return type: Character
Reference for language elementsVersion 3.3
964
string
Type: Character
The string to be examined.
ExampleIn the following example, the function is used to replace multiple consecutive spaces with singlespaces. The result is written to the log and to the example dataset.
data example; result = compbl("Steve Bike Company 0 1 2 50"); put "The string returned is: " result;run;
This produces the following output:
The string returned is: Steve Bike Company 0 1 2 50
LEFT
Remove leading (left-hand) spaces from a string.
LEFT ( string )
Removes any leading spaces at the left-hand of a source string, and returns the modified string. Thespaces will be appended to the right of the source string. Whether the appended spaces are retainedwith the string depends on subsequent functions and actions; see section below for examples.
Return type: Character
string
Type: Character
A string from which leading spaces will be removed.
Reference for language elementsVersion 3.3
965
ExampleIn the following example, the function is used to remove the leading spaces from a source string,and the results written to the log and to the example dataset. The QUOTE function is used to applyquotes to the returned string, enabling you to see that spaces have been moved to the trailing (right-hand) position. The PUT statements add the word Metal; the second PUT shows how, in this instance,the appended spaces are lost. The third PUT statement shows the result of concatenating the LEFTresult with the string Metal; again, this demonstrates that the leading spaces have been removed andappended as trailing spaces.
data example; text=' Bike Pedals'; result = quote(left(text)); result2 = left(text); result3 = cat(left(text),'Metal'); put result 'Metal'; put result2 'Metal'; put result3;run;
This produces the following output:
"Bike Pedals " MetalBike Pedals MetalBike Pedals Metal
RIGHT
Remove trailing (right-hand) spaces from string.
RIGHT ( string [ , length ] )
Removes any trailing spaces at the right-hand of a source string. The spaces will be prepended to theleft-hand side of the source, becoming leading spaces; whether the prepended spaces are retaineddepends on subsequent functions and actions; see the section below for examples.
Return type: Character
string
Type: Character
The string from which trailing spaces are to be removed.
lengthOptional argument
Type: Numeric
Not yet available.
Reference for language elementsVersion 3.3
966
ExampleIn the following example, the function is used to remove the trailing spaces from a source string, andthe result written to the log and to the example dataset. The second PUT statement adds the wordMetal; this second example shows how the prepended spaces are lost. The third PUT statementshows the result of concatenating the RIGHT result with the string Metal; this demonstrates that thetrailing spaces have been removed and prepended as leading spaces.
data example; text='Bike Pedals '; result1 = right(text); result2 = cat('Metal', right(text)); put result1; put 'Metal ' result; put result2;run;
This produces the following output:
Bike PedalsMetal Bike PedalsMetal Bike Pedals
STRIP
Strip leading and trailing spaces from a string.
STRIP ( string )
Removes the leading and trailing spaces from a source string, and returns the resulting string. No otherspaces are stripped.
Return type: Character
string
Type: Character
The string to be stripped of leading and trailing spaces.
In the following example, the function is used to strip leading and trailing spaces from a string. Theresult is written to the log and the example dataset.
data example; result = strip(' London Bike Company '); put 'The space-stripped string is: ' result;run;
This produces the following output:
The space-stripped string is: London Bike Company
Reference for language elementsVersion 3.3
967
TRIM
Trim trailing spaces from a string.
TRIM ( string )
Return type: Character
Removes trailing spaces from a source string, and returns the modified string. No other spaces arestripped.
string
Type: Character
The string to be stripped of trailing spaces.
ExampleIn the following example, the function is used to strip spaces from a string. The QUOTE function has alsobeen used to wrap the result in quotations marks so the resulting spaces can be seen. The result iswritten to the log and to the example dataset.
data example; result= quote(trim(" Magnificent Bike Company A 1 2 50 London ")); put result;run;
This produces the following output:
" Magnificent Bike Company A 1 2 50 London"
TRIM has removed all trailing spaces, while retaining leading spaces. QUOTE has wrapped the string indouble quotation marks, enabing the leading spaces to be seen.
Note:A horizontal tab is not recognised as a space, and so will not be trimmed.
TRIMN
Trim trailing spaces from a string, including from a null string.
TRIMN ( string )
Removes trailing spaces from a source string, and returns the modified string. No other spaces arestripped. If the string is a null string, ensures that the string is not expanded to a space in the DATAstep.
Reference for language elementsVersion 3.3
968
Note:A horizontal tab is not recognised as a space, so is not be trimmed.
Return type: Character
string
Type: Character
The string to be stripped of trailing spaces.
ExampleIn the following example, the function is used to strip spaces from a string. The QUOTE function hasalso been used to wrap the result in quotations marks so the resulting spaces can be seen. The result iswritten to the log and to the example dataset.
data _null_; a=''; result1 = quote(trimn(' Bike ')); result2 = quote(trim(a)); result3 = quote(trimn(a)); put result1; put result2; put result3; run;
This produces the following output:
" Bike"" """
In the first result, the trailing spaces have been removed, while leading spaces. have been retained
The second and third results compare the use of TRIM and TRIMN on a null. For TRIM, a space isreturned. For TRIMN, a null is returned.
Trunc functions and call routines
CEIL
CEIL ( value )
Return type: Numeric
Reference for language elementsVersion 3.3
969
value
Type: Numeric
CEILZ
CEILZ ( value )
Return type: Numeric
value
Type: Numeric
FLOOR
FLOOR ( value )
Return type: Numeric
value
Type: Numeric
FLOORZ
FLOORZ ( value )
Return type: Numeric
value
Type: Numeric
Reference for language elementsVersion 3.3
970
FUZZ
FUZZ ( value )
Return type: Numeric
value
Type: Numeric
INT
INT ( value )
Return type: Numeric
value
Type: Numeric
INTZ
INTZ ( value )
Return type: Numeric
value
Type: Numeric
ROUND
ROUND ( value [ , unit ] )
Return type: Numeric
Reference for language elementsVersion 3.3
971
value
Type: Numeric
unitOptional argument
Type: Numeric
ROUNDE
ROUNDE ( value [ , unit ] )
Return type: Numeric
value
Type: Numeric
unitOptional argument
Type: Numeric
ROUNDZ
ROUNDZ ( value [ , unit ] )
Return type: Numeric
value
Type: Numeric
unitOptional argument
Type: Numeric
Reference for language elementsVersion 3.3
972
TRUNC
TRUNC ( value , length )
Return type: Numeric
value
Type: Numeric
length
Type: Numeric
Variable functions and call routines
VARRAY
VARRAY ( name )
Return type: Numeric
name
Type: Var
VARRAYX
VARRAYX ( name )
Return type: Numeric
name
Type: Character
Reference for language elementsVersion 3.3
973
VFORMAT
VFORMAT ( variable )
Return type: Character
variable
Type: Var
VFORMATD
VFORMATD ( variable )
Return type: Numeric
variable
Type: Var
VFORMATDX
VFORMATDX ( variable )
Return type: Numeric
variable
Type: Character
VFORMATN
VFORMATN ( variable )
Return type: Character
Reference for language elementsVersion 3.3
974
variable
Type: Var
VFORMATNX
VFORMATNX ( variable )
Return type: Character
variable
Type: Character
VFORMATW
VFORMATW ( variable )
Return type: Numeric
variable
Type: Var
VFORMATWX
VFORMATWX ( variable )
Return type: Numeric
variable
Type: Character
Reference for language elementsVersion 3.3
975
VFORMATX
VFORMATX ( variable )
Return type: Character
variable
Type: Character
VINARRAY
VINARRAY ( variable )
Return type: Numeric
variable
Type: Var
VINARRAYX
VINARRAYX ( variable )
Return type: Numeric
variable
Type: Character
VINFORMAT
VINFORMAT ( variable )
Return type: Character
Reference for language elementsVersion 3.3
976
variable
Type: Var
VINFORMATD
VINFORMATD ( variable )
Return type: Numeric
variable
Type: Var
VINFORMATDX
VINFORMATDX ( variable )
Return type: Numeric
variable
Type: Character
VINFORMATN
VINFORMATN ( variable )
Return type: Character
variable
Type: Var
Reference for language elementsVersion 3.3
977
VINFORMATNX
VINFORMATNX ( variable )
Return type: Character
variable
Type: Character
VINFORMATW
VINFORMATW ( variable )
Return type: Numeric
variable
Type: Var
VINFORMATWX
VINFORMATWX ( variable )
Return type: Numeric
variable
Type: Character
VINFORMATX
VINFORMATX ( variable )
Return type: Character
Reference for language elementsVersion 3.3
978
variable
Type: Character
VLABEL
VLABEL ( variable )
Return type: Character
variable
Type: Var
VLABELX
VLABELX ( variable )
Return type: Character
variable
Type: Character
VLENGTH
VLENGTH ( variable )
Return type: Numeric
variable
Type: Var
Reference for language elementsVersion 3.3
979
VLENGTHX
VLENGTHX ( variable )
Return type: Numeric
variable
Type: Character
VNAME
VNAME ( variable )
Return type: Character
variable
Type: Var
VNAMEX
VNAMEX ( variable )
Return type: Character
variable
Type: Character
VTRANSCODE
VTRANSCODE ( variable )
Return type: Numeric
Reference for language elementsVersion 3.3
980
variable
Type: Var
VTRANSCODEX
VTRANSCODEX ( variable )
Return type: Numeric
variable
Type: Character
VTYPE
VTYPE ( variable )
Return type: Character
variable
Type: Var
VTYPEX
VTYPEX ( variable-or-expression )
Return type: Character
variable-or-expression
Type: Character
Reference for language elementsVersion 3.3
981
VVALUE
VVALUE ( variable )
Return type: Character
variable
Type: Var
VVALUEX
VVALUEX ( variable )
Return type: Character
variable
Type: Character
CALL LABEL
CALL LABEL ( variable , result );
variable
Type: Var
result
Type: Character
CALL VNAME
CALL VNAME ( variable , result );
Reference for language elementsVersion 3.3
982
variable
Type: Var
result
Type: Character
CALL VNEXT
CALL VNEXT ( varname , [ vartype ] [ , varlength ] );
varname
Type: Character
vartypeOptional argument
Type: Character
varlengthOptional argument
Type: Numeric
Web functions and call routines
HTMLDECODE
HTMLDECODE ( expression )
Return type: Character
expression
Type: Character
Reference for language elementsVersion 3.3
983
HTMLENCODE
HTMLENCODE ( expression [ , options ] )
Return type: Character
expression
Type: Character
optionsOptional argument
Type: Character
URLDECODE
URLDECODE ( string-to-encode )
Return type: Character
string-to-encode
Type: Character
URLENCODE
URLENCODE ( string-to-encode )
Return type: Character
string-to-encode
Type: Character
Reference for language elementsVersion 3.3
984
Zipcode functions and call routines
FIPNAME
FIPNAME ( argument )
Return type: Character
argument
Type: Numeric
FIPNAMEL
FIPNAMEL ( argument )
Return type: Character
argument
Type: Numeric
FIPSTATE
FIPSTATE ( argument )
Return type: Character
argument
Type: Numeric
Reference for language elementsVersion 3.3
985
GEODIST
GEODIST ( latitude1 , longitude1 , latitude2 , longitude2 [ , modifiers ] )
Return type: Numeric
latitude1
Type: Numeric
longitude1
Type: Numeric
latitude2
Type: Numeric
longitude2
Type: Numeric
modifiersOptional argument
Type: Character
STFIPS
STFIPS ( argument )
Return type: Numeric
argument
Type: Character
STNAME
STNAME ( argument )
Reference for language elementsVersion 3.3
986
Return type: Character
argument
Type: Character
STNAMEL
STNAMEL ( argument )
Return type: Character
argument
Type: Character
ZIPCITY
ZIPCITY ( zipcode )
Return type: Character
zipcode
Type: Character or numeric value
ZIPCITYDISTANCE
ZIPCITYDISTANCE ( zipcode1 , zipcode2 )
Return type: Numeric
zipcode1
Type: Character or numeric value
Reference for language elementsVersion 3.3
987
zipcode2
Type: Character or numeric value
ZIPFIPS
ZIPFIPS ( zipcode )
Return type: Numeric
zipcode
Type: Character or numeric value
ZIPNAME
ZIPNAME ( zipcode )
Return type: Character
zipcode
Type: Character or numeric value
ZIPNAMEL
ZIPNAMEL ( zipcode )
Return type: Character
zipcode
Type: Character or numeric value
Reference for language elementsVersion 3.3
988
ZIPSTATE
ZIPSTATE ( zipcode )
Return type: Character
zipcode
Type: Character or numeric value
Dataset Options
BUFNOBUFNO = [ n | nK | nM | nG ]
Valid for:
• Input:• Output:
yesno
BUFSIZEBUFSIZE = [ n | nK | nM | nG ]
Valid for:
• Input:• Output:
yesno
COMPRESSCOMPRESS = [ YES | Y | ON | NO | N | CHAR | BINARY ]
Valid for:
Reference for language elementsVersion 3.3
989
• Input:• Output:
yesyes
DROPDROP = variable-list i
i See Variable Lists.
Valid for:
• Input:• Output:
yesyes
FILECLOSEFILECLOSE =
[ DISP |FREE |LEAVE |REREAD |REWIND
]
Valid for:
• Input:• Output:
yesno
FIRSTOBSFIRSTOBS = n
Valid for:
• Input:• Output:
nono
Reference for language elementsVersion 3.3
990
ININ = variable
Valid for:
• Input:• Output:
yesno
INDEXINDEX = ( { index-name
[ ( variables i)[ / UNIQUE ]] … } )
i See Variable Lists.
Valid for:
• Input:• Output:
noyes
KEEPKEEP = variable-list i
i See Variable Lists.
Valid for:
• Input:• Output:
yesyes
LABELLABEL = "dataset label"
Valid for:
Reference for language elementsVersion 3.3
991
• Input:• Output:
noyes
OBSOBS = [ n | MAX ]
Valid for:
• Input:• Output:
yesno
OBSBUFOBSBUF = [ n | MAX ]
This dataset option is only valid for views and determines the number of observations that can bebuffered when executing a view in parallel. If specified, it overrides the VBUFSIZE system option.
OUTREPOUTREP =
[ ALPHA_OSF |ALPHA_TRU64 |ALPHA_VMS |ALPHA_VMS_32 |ALPHA_VMS_64 |INTEL_ABI |LINUX |LINUX_32 |MVS |MVS_32 |OS2 |HP_UX |HP_UX_32 |MIPS_ABI |RS_6000_AIX |RS_6000_AIX_32 |SOLARIS |
Reference for language elementsVersion 3.3
992
SOLARIS_32 |HP_IA64 |HP_ITITANIUM |HP_UX_64 |RS_6000_AIX_64 |SOLARIS_64 |WINDOWS |WINDOWS_32 |WINDOWS_64
]
Valid for:
• Input:• Output:
yesno
POINTOBSPOINTOBS = [ YES | NO ]
Valid for:
• Input:• Output:
yesyes
RENAMERENAME = ( { old-name = new-name … } )
Valid for:
• Input:• Output:
yesyes
REPLACEREPLACE = [ YES | NO ]
Valid for:
Reference for language elementsVersion 3.3
993
• Input:• Output:
noyes
SPILLSPILL = [ YES | NO ]
This dataset option is only valid for views and specifies if the view gets spilled to disk or executed inparallel.
WHEREWHERE = ( SQL expression i)
i See SQL Expressions.
Valid for:
• Input:• Output:
yesno
Procedures
ACCESS Procedure
Supported statements• PROC ACCESS• ASSIGN• CREATE• DROP• FORMAT• LIST• RENAME
Reference for language elementsVersion 3.3
994
• RESET• SELECT• SUBSET• TABLE• UNIQUE
PROC ACCESSPROC ACCESS
{ |ACCDESC = access-descriptor-name i |DBMS = database-engine-name |OUT = output-data-set-with-options ii |VIEWDESC = view-descriptor-name iii
… } ;
i See Access Descriptors.ii See Output dataset.iii See View Descriptors.
ASSIGNASSIGN = [ Y | YES | N | NO ] ;
CREATE
CREATE [ access-descriptor-namei | view-descriptor-nameii ] ;
i See Access Descriptors.ii See View Descriptors.
DROPDROP [ integer | column-name ] ;
FORMATFORMAT [ integer | column-name ] = format-name ;
Reference for language elementsVersion 3.3
995
LISTLIST
[ ALL |VIEW |integer |column-name
] ;
RENAMERENAME [ integer | column-name ] = name ;
RESETRESET [ integer | column-name | ALL ] ;
SELECTSELECT [ integer | column-name | ALL ] ;
SUBSETSUBSET dbms-specific-subset-clause ;
TABLETABLE
[ string-literal |[ schema-name . ] table-name
] ;
Reference for language elementsVersion 3.3
996
UNIQUEUNIQUE = [ Y | YES | N | NO ] ;
Connection optiondatabase-specific-option-dependent-on-dbms-option = database-specific-value ;
APPEND Procedure
Supported statements• PROC APPEND• WHERE
PROC APPENDPROC APPEND
{ |BASE = data-set-name i |DATA = input-data-set-with-options ii |FORCE
… } ;
i See Dataset.ii See Input dataset.
WHEREWHERE condition ;
Reference for language elementsVersion 3.3
997
APPSRV ProcedureThe APPSRV procedure configures and launches an Application Server with settings passed througharguments, options and statements. An Application Server is a long-running WPS daemon process thataccepts requests to execute programs written in the language of SAS.
Supported statements• PROC APPSRV• ADMINLIBS• ALLOCATE• DATALIBS• LOG• PROGLIBS• SESSIONLIBS• SESSIONWORKLIBS• REQUEST• STATISTICS• REQUEST• WORKLIBS
PROC APPSRVPROC APPSRV PORT = [ port | "service_name" ]
[ { [ ADMINPW = password |
ALLOW_BACKGROUND |CHARSET = charset |LOCALIP = IP-address |NETBUFFK = n |NOCHARSET |UNSAFE = "string" |WEBOUT_ENCODING = "encoding-name" |NOCLEANWORK |NOCLEANSESSION |NOCLEANSESSIONWORK
] … }] ;
Reference for language elementsVersion 3.3
998
ADMINPWThe ADMINPW option specifies the password that will be required to run programs in the ADMINLIBSlibraries and special administrative programs such as stop. To avoid displaying a plain text passwordin the source code of an Application Server launch program, the wpswebpassword program should beused to generate an obfuscated version to be used as the ADMINPW option.
The following example shows how to set the ADMINPW option, albeit with a plain text password:
PROC APPSRV PORT=5001 ADMINPW="password"; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
ALLOW_BACKGROUNDThe ALLOW_BACKGROUND option enables Application Servers that are members of a pool service to beplaced in a background state. If this option is not present, attempts to place an Application Server into abackground state will fail.
This example shows how to set the ALLOW_BACKGROUND option:
PROC APPSRV PORT=5001 ALLOW_BACKGROUND; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
CHARSETThe CHARSET option is used to pass the encoding type applied to the HTTP content-type header asgenerated by the WPS Web automatic header system. If the CHARSET option is not set, it will be setto the same encoding as is applied to the _WEBOUT fileref. If, rather than the CHARSET option, theNOCHARSET option is set, then no encoding information will be written by the automatic header system.CHARSET and NOCHARSET cannot both be set at the same time.
This example sets the CHARSET option to latin1:
PROC APPSRV PORT=5001 CHARSET='latin1'; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
With the above APPSRV invocation, the automatic header system might emit an HTTP header formedas below:
Content-type: text/html; charset='latin1'
LOCALIPThe LOCALIP option can be used to specify the IP address to which the Application Server should bindwhen it starts up. This is useful when a host has multiple addresses assigned to it - a situation knownas a multi-homed host.
Reference for language elementsVersion 3.3
999
This example launches an Application Server that binds to the socket address 192.168.0.1:5001:
PROC APPSRV PORT=5001 LOCALIP=192.168.0.1; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
NETBUFFKThe NETBUFFK option specifies the number of kilobytes an Application Server should reserve for a netbuffer. A net buffer is used to buffer the number of data transfers between the server and the Brokeras a program generates output. If the option is not specified, the Application Server will not use a netbuffer.
Validation4 <= NETBUFFK <= 128
The following APPSRV invocation specifies an 8K net buffer:
PROC APPSRV PORT=5001 NETBUFFK=8; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
NOCHARSETThe NOCHARSET option is used to suppress the generation of an encoding type by the automaticheader system.
This example sets the NOCHARSET option:
PROC APPSRV PORT=5001 NOCHARSET; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
With the above APPSRV invocation, the automatic header system might emit an HTTP header formedas below:
Content-type: text/html
NOCLEANSESSIONThe NOCLEANSESSION option is used to prevent the cleanup of the SAVE libraries which are created forany session generated by the Application Server. This option is useful for debugging but should not beused in production systems.
NOCLEANSESSIONWORKThe NOCLEANSESSIONWORK option is used to prevent the cleanup of the WORK library used when aSESSION INIT or TERM program is executed (refer to the INIT and TERM options on the SESSIONstatement).
Reference for language elementsVersion 3.3
1000
NOCLEANWORKThe NOCLEANWORK option is used to prevent the cleanup of the WORK library which is allocated when aprogram is executed in response to a WPS Web request.
PORT (required)The PORT option specifies the TCP port number that the Application Server should bind to whenopening a communication socket. This can be provided as a number or a service name as specified inthe /etc/services file on most UNIX-style operating systems.
Validation1 <= PORT <= 65535
Note that some operating systems require special user privileges to use port numbers below 1024. Thefollowing example starts an Application Server bound to port 5001:
PROC APPSRV PORT=5001; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
By contrast, the next example starts an Application Server bound to the port number associated withthe wpsweb service definition:
PROC APPSRV PORT='wpsweb'; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
If the port number is not specified or the service name cannot be resolved to a port number, theApplication Server will fail to start and an error will be returned.
UNSAFEThe UNSAFE option is used to filter unsafe characters from user input. Parameters are passed as macrovariables to the program to be executed, and to reduce the opportunities for a code-injection attack,unsafe characters are removed from parameter values before they are assigned to macro-variablevalues (although the raw value can always be accessed via the APPSRV_UNSAFE() function).
The default unsafe character list contains the language of SAS characters:
• ' - single quote• " - double quote• ; - semi-colon• & - ampersand
The unsafe character list can be changed via the UNSAFE option - but note that any custom list shouldinclude the default characters unless there is a very good reason not to.
Reference for language elementsVersion 3.3
1001
The following example starts an Application Server that removes control characters before they areassigned to macro variables. Note that this example usage of the UNSAFE option simply adds thedefault unsafe character list, and so has no practical effect:
PROC APPSRV PORT=5001 UNSAFE="'"";&"; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
The next example adds spaces and vowels to the list of unsafe characters:
PROC APPSRV PORT=5001 UNSAFE="'"";& aeiou"; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
WEBOUT_ENCODINGThe WEBOUT_ENCODING option sets the encoding of the _WEBOUT fileref that an Application Serverprovides to the programs it executes. Program output written to _WEBOUT is returned via the Broker tothe user.
This option is particularly important if an Application Server runs in EBCDIC environments such as z/OS. Most web browsers do not recognise EBCDIC encodings.
UTF-8 is often a good, practical choice, since this is understood by many browsers and web clients andsupports the display of multi-byte characters.
This option does not affect the _GRPHOUT fileref, which has no encoding, nor does it affect theautomatic header generation system, which always emits headers in ASCII.
The following example sets the encoding of the _WEBOUT fileref to latin1:
PROC APPSRV PORT=5001 WEBOUT_ENCODING='latin1'; ALLOCATE FILE demo 'C:\wpswebapp \wpsdemoapp\server'; PROGLIBS demo; RUN;
ADMINLIBSThe ADMINLIBS statement of the APPSRV procedure specifies a list of libraries or directories fromwhich programs can be executed by an Application Server if a valid password is provided via the_ADMINPW parameter. ADMINLIBS can be used to distinguish administrative programs from generalprograms in an application. The relevant libraries or directories must have been allocated using theALLOCATE statement.
ADMINLIBS { [ libref | libref . catalog | fileref ] … } ;
All ADMINLIBS arguments are the names of librefs, catalogs or filerefs.
Reference for language elementsVersion 3.3
1002
This example program starts an Application Server that permits programs in the C:\wpswebapp\wpsdemoapp\admin directory to be executed if a valid _ADMINPW parameter is provided.
PROC APPSRV PORT=5001 ADMINPW="foo";ALLOCATE FILE demo "C:\wpswebapp\wpsdemoapp\server";ALLOCATE FILE admin "C:\wpswebapp\wpsdemoapp\admin";PROGLIBS demo;ADMINLIBS admin;RUN;
ALLOCATEThe ALLOCATE statement of the APPSRV procedure defines libraries, directories and files as availablefor use by an Application Server. These definitions can be passed as parameters to other statementslike PROGLIBS to enable further functionality.
ALLOCATE
[ FILE [ device-type ] "directory-or-PDS-path" [ host-options ] |LIBRARY [ engine ] "data-library" [ options ]
] ;
ALLOCATE LIBRARY and ALLOCATE FILE are similar to the global statements LIBNAME andFILENAME in the language of SAS, but scope is restricted to the Application Server only.
The example below allows programs stored as files in C:\wpswebapp\wpsdemoapp\server tobe executed, passing an extra library reference to each program which maps to the C:\wpswebapp\wpsdemoapp\data directory:
PROC APPSRV PORT=5001 ADMINPW="foo";ALLOCATE FILE demo "C:\wpswebapp\wpsdemoapp\server";ALLOCATE LIBRARY data "C:\wpswebapp\wpsdemoapp\data";PROGLIBS demo;DATALIBS data;RUN;
DATALIBSThe DATALIBS statement of the APPSRV procedure defines a space-separated list of allocated libraryreferences that are passed to programs executed by an Application Server. This allows data to bestored globally between requests or permanently as required. This facility is particularly useful as theAPSWORK library is cleared when the server is stopped and is therefore only suitable for temporary dataused during program execution.
DATALIBS { [ libref | fileref ] … } ;
All DATALIBS arguments are the names of librefs or filerefs, which have to be allocated with theALLOCATE statement.
Reference for language elementsVersion 3.3
1003
Warning:Creating a library using DATALIBS which is called SAVE may interfere with the SAVE library used byApplication Server sessions. Therefore, this name should be avoided.
The following example starts an Application Server that passes three libraries to the programs itexecutes:
PROC APPSRV PORT=5001 ADMINPW="foo";ALLOCATE FILE demo "C:\wpswebapp\wpsdemoapp\server";ALLOCATE LIBRARY seta "C:\wpswebapp\wpsdemoapp\seta";ALLOCATE LIBRARY setb "C:\wpswebapp\wpsdemoapp\setb";ALLOCATE LIBRARY setc "C:\wpswebapp\wpsdemoapp\setc";PROGLIBS demo;DATALIBS seta setb setc;RUN;
LOGThe LOG statement of the APPSRV procedure is used to configure logging of the requests that anApplication Server receives.
LOG
[ { [ DISPLAY = [ NONE | ERRORS | ALL ] |
SYMBOLS = [ NONE | ERRORS | ALL ] |FILE = [ allocated-fileref | "path" ] |APPEND |REPLACE
] … }] ;
APPEND and REPLACEThe APPEND and REPLACE options of the LOG statement define how logs are opened. If APPEND isspecified, then log output is appended to an existing log file. If REPLACE is specified, then a log file isalways replaced. If neither is specified, then the behaviour is operating-system dependent. On z/OS thelog file is always appended to, whereas on other operating systems, the log file is replaced if it is olderthan six days.
DISPLAYThe DISPLAY option of the LOG statement controls whether the Application Server records theexecution log for each requested program.
If it is set to NONE, then the execution log is never included. If it is set to ERRORS, then the execution logis recorded if there is an error. If set to ALL then the execution log is always recorded. By default, it isset to NONE.
Reference for language elementsVersion 3.3
1004
The example below configures an Application Server to include the execution log for every request:
PROC APPSRV PORT=5001; ALLOCATE FILE logfile "C:\wpswebapps\wpsdemoapp\appsrv-%Y-%m-%d.log"; LOG FILE=logfile DISPLAY=ALL; ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server"; PROGLIBS demo;RUN;
FILEThe FILE option of the LOG statement is used to specify a fileref or a string containing a filename.The name may include patterns which are expanded as the Application Server writes the log. This isuseful, for example, if you need to embed creation dates within the names of log files. The SubstitutionCharacters Table details the formatting patterns that can be used.
In the example below, we specify a log file using a file path string:
PROC APPSRV PORT=5001; LOG FILE="C:\wpswebapps\wpsdemoapp\appsrv.log"; ALLOCATE FILE demo 'C:\wpswebapp\wpsdemoapp\server'; PROGLIBS demo;RUN;
Here, we specify a file path using an allocated fileref:
PROC APPSRV PORT=5001; ALLOCATE FILE logfile "C:\wpswebapps\wpsdemoapp\appsrv.log"; LOG FILE=logfile; ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server"; PROGLIBS demo;RUN;
Below, we configure logging so that it produces files with names such as appsrv-2013-08-01.login the wpsdemoapp directory:
PROC APPSRV PORT=5001; ALLOCATE FILE logfile "C:\wpswebapps\wpsdemoapp\appsrv-%Y-%m-%d.log"; LOG FILE=logfile; ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server"; PROGLIBS demo;RUN;
SYMBOLSThe SYMBOLS option of the LOG statement controls whether the Application Server logs input symbols/parameters from incoming requests. The values of symbols whose names begin with _NOLOG_ havetheir values obfuscated in the log file.
If set to NONE, no logging is performed. If set to ERRORS then symbols are logged if there is an errorprocessing the request. Setting it to ALL logs symbols for all requests. By default, this value is set toNONE.
Reference for language elementsVersion 3.3
1005
In the following example, an Application Server is configured to record all symbols for all requests:
PROC APPSRV PORT=5001; ALLOCATE FILE logfile "C:\wpswebapps\wpsdemoapp\appsrv-%Y-%m-%d.log"; LOG FILE=logfile SYMBOLS=ALL; ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server"; PROGLIBS demo;RUN;
PROGLIBSThe PROGLIBS statement of the APPSRV procedure defines a space-separated list of allocated library,catalog or file references that contain programs which can be executed by an Application Server.Specifying the catalog name after the library name ensures that only programs in that catalog areaccessible.
PROGLIBS { [ libref | libref . catalog | fileref ] … } ;
All PROGLIBS arguments are the names of librefs, filerefs or catalogs.
This example allows execution of:
• All programs in the server directory using the prefix demo• All programs contained in any catalog in the proglib library• All programs contained in the catalog1 and catalog2 catalogs of the adlib library
PROC APPSRV PORT=5001;ALLOCATE FILE demo "C:\wpswebapp\wpsdemoapp\server";ALLOCATE LIBRARY proglib "C:\wpswebapp\wpsdemoapp\proglib";ALLOCATE LIBRARY adlib "C:\wpswebapp\wpsdemoapp\admin";PROGLIBS demo proglib adlib.catalog1 adlib.catalog2;RUN;
Reference for language elementsVersion 3.3
1006
REQUESTThe REQUEST statement of the APPSRV procedure is used to configure aspects of Application Serverrequest processing.
REQUEST
[ { [ INIT = program |
TERM = program |READ = seconds |TIMEOUT = seconds |MAXTIMEOUT = seconds |FROMADR = ( { "IP-address" … } )
] … }] ;
FROMADRThe FROMADR option of the REQUEST statement is used to enhance security by providing a white-list ofIP addresses from which a Broker will accept requests. All other requests will be denied with an errormessage and the Application Server will stop processing the request. The FROMADR list is a space-separated list of strings contained in parentheses.
This example specifies that the Broker should only accept requests from the local host:
PROC APPSRV PORT=5001; REQUEST FROMADR=('127.0.0.1'); ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server"; PROGLIBS demo;RUN;
INITThe INIT option of the REQUEST statement specifies the name of a program to execute before theprogram requested by the Application Server is executed. This is implemented via the use of the%INCLUDE macro in the language of SAS.
By default, no INIT program is executed.
This option does not affect special programs like stop, ping, replay, status or the programexecuted when there is an invalid session as specified by the INVSESS option of the SESSIONstatement.
The example below illustrates how to configure an Application Server to execute the init.sasprogram before any requested program:
PROC APPSRV PORT=5001;ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server";REQUEST INIT="demo.init.sas";PROGLIBS demo;RUN;
Reference for language elementsVersion 3.3
1007
MAXTIMEOUTThe MAXTIMEOUT option of the REQUEST statement specifies the maximum TIMEOUT value that can beset for a program. This value overrides the value of the TIMEOUT option if the TIMEOUT option is set toa value higher than the MAXTIMEOUT value.
MAXTIMEOUT should be set to a value greater than zero and less than or equal to INT_MAX which isthe largest integer representable on the specific operating system concerned. By default, it is set to 900seconds or 15 minutes.
READThe READ option of the REQUEST statement specifies the maximum duration allowed for the reading ofa request from a Broker in seconds. If a request cannot be read within this time, the server will respondwith an HTTP message containing the status header 408 - Request Timed Out.
READ must be set to a value greater than zero and less than or equal to INT_MAX which is the largestinteger it is possible to represent on the specific operating system concerned. By default, READ is set to30 seconds.
TERMThe TERM option of the REQUEST statement specifies the name of a program to execute after a programrequested by the user. This is implemented via the %INCLUDE macro in the language of SAS.
By default, no program is executed.
This option does not affect special programs like stop, ping, replay, status or the programexecuted when there is an invalid session as specified by the INVSESS option of the SESSIONstatement.
This example shows an Application Server that executes the term.sas program after any requestedprogram:
PROC APPSRV PORT=5001;ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server";REQUEST TERM="demo.term.sas";PROGLIBS demo;RUN;
TIMEOUTThe TIMEOUT option of the REQUEST statement specifies the maximum duration allowed for theexecution of a request including extensions prepended and appended by the INIT and TERM options ofthe SESSION or REQUEST statements.
When the duration of a request has exceeded the timeout value, the program is cancelled. It is possiblethat this will leave an Application Server in an unexpected state.
A program can increase the time it is allowed to execute for using the APPSRV_SET() function. Themaximum timeout which a program can set for a request is limited by the MAXTIMEOUT option of theREQUEST statement.
Reference for language elementsVersion 3.3
1008
This value is overridden by the value set in MAXTIMEOUT if the TIMEOUT value is set to a value higherthan MAXTIMEOUT.
The value set in TIMEOUT must be greater than zero and less than or equal to that set in MAXTIMEOUT.The default value for TIMEOUT is 300 seconds.
The following program starts an Application Server which allows programs to execute for at most 120seconds:
PROC APPSRV PORT=5001;ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server";REQUEST TIMEOUT=120;PROGLIBS demo;RUN;
SESSIONThe SESSION statement is used to configure an Application Server's session functionality. The optionslisted are not mandatory.
SESSION
[ { [ INIT = program |
TERM = program |INVSESS = program |TIMEOUT = seconds |MAXTIMEOUT = seconds |VERIFY = ( { variable … } )
] … }] ;
INITThe INIT option of the SESSION statement specifies the name of a program to be executed when asession is created. The program defined by the INIT option can access:
• The session SAVE library• Libraries created through the DATALIBS statement• The _SESSIONID macro variable• A unique WORK library that is terminated at the end of the program
The program cannot access:
• The _WEBOUT or _GRPHOUT filerefs• User-provided parameters or macro variables created by the program that launched the session• The APSWORK library
By default, no program is executed.
Reference for language elementsVersion 3.3
1009
This example launches an Application Server which executes the session_init.sas programwhenever sessions are created:
PROC APPSRV PORT=5001;ALLOCATE FILE demo "C:\wpswebapp\wpsdemoapp\server";SESSION INIT="demo.session_init.sas";PROGLIBS demo;RUN;
INVSESSThe INVSESS option of the SESSION statement specifies the name of a program when a request isreceived with an invalid _SESSIONID parameter. This can be used to override the default responsefrom an application server, which in its raw form, resembles the image below:
The specified INVSESS program can access the APSWORK and DATALIBS libraries and inputs throughmacro variables just like a regular program. However, the _PROGRAM macro variable becomes thevalue of INVSESS and a macro variable called _USERPROGRAM is created and holds the name of theprogram that was attempted to be executed.
In this example, an Application Server executes the session_invalidsession.sas program whenan invalid _SESSIONID parameter is received:
PROC APPSRV PORT=5001;ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server";SESSION INVSESS="demo.session_invalidsession.sas";PROGLIBS demo;RUN;
MAXTIMEOUTThe MAXTIMEOUT option of the SESSION statement specifies the maximum duration of sessions inseconds. It overrides the value set by the TIMEOUT option if the TIMEOUT value is set to a higher valuethan MAXTIMEOUT.
MAXTIMEOUT should be set to a value greater than zero and less than or equal to INT_MAX which isthe maximum value an integer can take in the language of SAS on that specific platform. By default,MAXTIMEOUT is set to INT_MAX.
TERMThe TERM option of the SESSION statement specifies the name of a program to be executed when asession terminates - either explicitly or if the timeout period is exceeded. This program can access:
• The session SAVE library• Libraries created through the DATALIBS statement
Reference for language elementsVersion 3.3
1010
• The _SESSIONID macro variable• A unique WORK library that is terminated at the end of the program
The program cannot access:
• The _WEBOUT or _GRPHOUT filerefs• User-provided parameters or macro variables created by the program that launched the session• The APSWORK library
By default, no TERM program will be executed, and the program name is not validated until the firstsession is removed.
This example executes the session_term.sas program when sessions end:
PROC APPSRV PORT=5001;ALLOCATE FILE demo "C:\wpswebapp\wpsdemoapp\server";SESSION TERM="demo.session_term.sas";PROGLIBS demo;RUN;
TIMEOUTThe TIMEOUT option of the SESSION statement specifies the maximum duration of sessions inseconds, and can only be used once per SESSION statement. The value is overridden by the value ofMAXTIMEOUT if it has been set higher than MAXTIMEOUT.
TIMEOUT must be set to a value greater than zero and less than or equal to the value set asMAXTIMEOUT. The default is 900 seconds - 15 minutes.
VERIFYThe VERIFY option of the SESSION statement defines a space-separated list of parameter names.When a session is created, the values of these parameters are recorded, so that, when an attempt ismade to reconnect to the same session, these values can be verified against the parameter values ofthe new request to ensure that they are the same.
This example instructs the Application Server to verify the values of FOO, BAR and BAZ:
PROC APPSRV PORT=5001; ALLOCATE FILE demo "C:\wpswebapp\wpsdemoapp\server"; PROGLIBS demo; SESSION VERIFY=(FOO BAR BAZ);RUN;
SESSIONLIBSThis statement controls the location of the SAVE library for each request.
SESSIONLIBS " path " [ / fileref-options ]
Reference for language elementsVersion 3.3
1011
The Substitution Characters Table can be used with this option. For an example of its use, refer to theFILE option of the LOG statement.
SESSIONWORKLIBSThis statement controls the location of the WORK library for the session INIT and TERM programs thatare executed when the session is created or destroyed.
SESSIONWORKLIBS " path " [ / fileref-options ]
The Substitution Characters Table can be used with this option. For an example of its use, refer to theFILE option of the LOG statement.
STATISTICSThe STATISTICS statement of the APPSRV procedure instructs an Application Server to generate adataset that records requests received. This dataset can be accessed via special macro variables byprograms executed by the Application Server.
STATISTICS
[ CREATE = data-set i |DATA = data-set i
[ { [ ADDPORT |
EXITONERROR |TEMPLATE = data-set i |WRITECOUNT = |WRITEEVERY =
] … }]
] ;
i See Dataset.
ADDPORTThe ADDPORT keyword option of the STATISTICS statement determines whether the port number ofthe Application Server should be appended to the name specified in the DATA option to form the nameof the dataset used to log statistics.
Reference for language elementsVersion 3.3
1012
CREATEThe CREATE option of the STATISTICS statement is used to create a blank dataset with columns set tothe defaults for Application Server statistics recording. The option prevents PROC APPSRV from bindingto a socket and acting as a normal socket. The only resulting action is the creation of a blank datasetwith the required columns for recording statistics.
The default columns of the statistics dataset are described in the table below:
Column Column type Description
Obstype Character Type of request
Okay Character 1 if request ran OK, else 0
Duplex Character
Http Character
Program Character Name of program executed bythe Application Server
Peeraddr Character
Hostname Character
Username Character
Entry Character Name of the item that wasreplayed if the replay programwas used
SessionId Character ID of the session, if there wasone
Service Character Name of the service theApplication Server was part of
Starttime Numeric Date-time the request began
Runtime Numeric Number of seconds taken toprocess the request
Port Numeric Port number of the ApplicationServer
Bytesin Numeric Size of the request in bytes
Bytesout Numeric Size of the response in bytes
Cputime Numeric Milliseconds of CPU time spenthandling the request
DATAThe DATA option of the STATISTICS statement specifies the dataset used to record statistics and mustbe in a library that is allocated by the Application Server.
Reference for language elementsVersion 3.3
1013
If the specified dataset does not exist already, then it is created and given a set of columns according tothose specified in the TEMPLATE option.
In the following example, the dataset requests in the stats library is assigned to statistics-recordingduties:
PROC APPSRV PORT=5001;ALLOCATE LIBRARY stats "C:\wpswebapps\wpsdemoapp\stats";ALLOCATE FILE demo "C:\wpswebapps\wpsdemoapp\server";PROGLIBS demo;STATISTICS DATA=stats.requests;RUN;
STARTTIMEMILLISThe STARTTIMEMILLIS option of the STATISTICS statement specifies that the starttime will berecorded in milliseconds, rather than the default seconds.
TEMPLATEThe TEMPLATE option of the STATISTICS statement specifies the name of a dataset whose variablesdetermine which statistics are recorded by the Application Server in the statistics dataset. These mustbe a subset of the full set as described in the CREATE option. If the TEMPLATE option is used, then for avariable to be included in the statistics dataset, there must be a column with the same name and type inthe template dataset. If the TEMPLATE option is not used, then all statistics variables will be captured.
WRITECOUNTThe WRITECOUNT option of the STATISTICS statement specifies the number of requests that must bereceived before statistics are flushed from memory into the dataset.
This value should be greater than or equal to zero and less than or equal to INT_MAX which is thelargest integer representable on the specific operating system in use. By default, it is set to zero.
WRITEEVERYThe WRITEEVERY option of the STATISTICS statement determines the number of minutes after whichstatistics are flushed from memory into the dataset.
The value of this option should be greater than zero and less than or equal to INT_MAX which is thelargest integer representable on the specific operating system in use. By default it is set to 5 minutes.
WORKLIBSThis statement controls the location of the WORK library for each request.
WORKLIBS " path " [ / fileref-options ]
Reference for language elementsVersion 3.3
1014
The Substitution Characters Table can be used with this option. For an example of its use, refer to theFILE option of the LOG statement.
Substitution Characters TableThis table details the formatting patterns that can be included when specifying filerefs or stringscontaining filenames.
The patterns are expanded as the Application Server writes the log. This is useful, for example, if youneed to embed creation dates within the names of log files.
Format Description Range
%a Day of week Sun-Sat
%b Month Jan-Dec
%d Number of day in month 01-31
%H Hour 00-23
%m Month 01-12
%w Day of week 1-Sunday to 7-Saturday
%Y Full year - e.g. 2015
%y Two-digit year 00-99
%p Port number of Application Server
%n Hostname/node name
%r Request number 00001-99999
%s Session number
CATALOG Procedure
Supported statements• PROC CATALOG• CHANGE• CONTENTS• COPY• DELETE• EXCHANGE• EXCLUDE
Reference for language elementsVersion 3.3
1015
• MODIFY• SAVE• SELECT
PROC CATALOGPROC CATALOG
{ |[ CATALOG | CAT | C ] = [ libname . ] catalog |[ ENTRYTYPE | ET ] = entry-type |KILL
… } ;
CHANGECHANGE { old-entry-name [ . old-entry-type ] = new-entry-name [ . new-entry-type ] … }
[ / [ ENTRYTYPE | ET ] = entry-type] ;
CONTENTSCONTENTS
[ |[ CATALOG | CAT | C ] = [ libname . ] catalog |OUT = [ libname . ] data-set
] ;
COPYCOPY
{ [ ENTRYTYPE | ET ] = entry-type |IN = [ libname . ] catalog |MOVE |NEW |OUT = [ libname . ] catalog
… } ;
Reference for language elementsVersion 3.3
1016
DELETEDELETE { entry-name [ . entry-type ] … }
[ / [ ENTRYTYPE | ET ] = entry-type] ;
EXCHANGEEXCHANGE { entry-name-1 [ . entry-type-1 ] = entry-name-2 [ . entry-type-2 ] … }
[ / [ ENTRYTYPE | ET ] = entry-type] ;
EXCLUDEEXCLUDE { entry-name [ . entry-type ] … }
[ / [ ENTRYTYPE | ET ] = entry-type] ;
MODIFYMODIFY { entry-name [ . entry-type ] ( [ DESC | DESCRIPTION ] = [ description ] ) … }
[ / [ ENTRYTYPE | ET ] = entry-type] ;
SAVESAVE { entry-name [ . entry-type ] … }
[ / [ ENTRYTYPE | ET ] = entry-type] ;
SELECTSELECT { entry-name [ . entry-type ] … }
[ / [ ENTRYTYPE | ET ] = entry-type] ;
Reference for language elementsVersion 3.3
1017
CDISC Procedure
Supported statements• PROC CDISC• ODM• STUDY• GLOBALVARIABLES• USER• LOCATION• SIGNATURE• CLINICALDATA• CONTENTS• DATASETS• SDTM• DOMAINDATA
PROC CDISCPROC CDISC
[ MODEL = "SDTM" |MODEL = "ODM"
{ READ = fileref |WRITE = fileref |FORMATACTIVE = [ YES | NO ] |FORMATLIBRARY = fileref |FORMATNOREPLACE = [ YES | NO ] |LANGUAGE = "language"
… } ] ;
ODMODM
{ LONGNAMES = [ YES | NO ] |ODMMAXIMUMOIDLENGTH = n |ODMMINIMUMKEYSET = [ YES | NO ] |ORDERNUMBER = [ YES | NO ] |USENAMEASLABEL = [ YES | NO ] |
Reference for language elementsVersion 3.3
1018
ODMVERSION = "1.2" |FILEOID = "fileidentifier" |FILETYPE = [ "SNAPSHOT" | "TRANSACTIONAL" ] |DESCRIPTION = "desc" |GRANULARITY =
[ ALL |METADATA |ADMINDATA |REFERENCEDATA |ALLCLINICALDATA |SINGLESITE |SINGLESUBJECT
] |ARCHIVAL = YES |CREATIONADATETIME = "ISO8601 datetime" |PRIORFILEOID = "filename" |ASOFDATETIME = "ISO8601 datetime" |ORIGINATOR = "name" |SOURCESYSTEM = "string" |SOURCESYSTEM = "version-string" |DATA = member.name
… } ;
STUDYSTUDY { STUDYOID = "odm-id" | DATA = member.name … } ;
GLOBALVARIABLESGLOBALVARIABLES
{ STUDYNAME = "name" |STUDYDESCRIPTION = "desc" |PROTOCOLNAME = "name" |DATA = member.name
… } ;
USERUSER DATA = member.name ;
Reference for language elementsVersion 3.3
1019
LOCATIONLOCATION DATA = member.name ;
SIGNATURESIGNATURE DATA = member.name ;
CLINICALDATACLINICALDATA
{ OUT = member.name |SASDATASETNAME = "name" |DATA = member.name |NAME = "string" |DOMAIN = "domain" |ORIGIN = "string" |PURPOSE = "string" |COMMENT = "string" |INVESTIGATORREF = [ YES | NO ] |SITEREF = [ YES | NO ]
… } ;
CONTENTSCONTENTS TABLE = name ;
DATASETSDATASETS ;
SDTMSDTM SDTMVersion = "version" ;
Reference for language elementsVersion 3.3
1020
DOMAINDATADOMAINDATA
{ DATA = member.name |DOMAIN =
[ DM |CO |CM |EX |SU |AE |DS |MH |EG |IE |LB |PE |QS |SC |VS
] |CATEGORY =
[ special |interventions |events |findings
] … } ;
CHART Procedure
Supported statements• PROC CHART• HBAR• VBAR• BY• WHERE
Reference for language elementsVersion 3.3
1021
PROC CHARTPROC CHART
[ DATA = input-data-set-with-options iGOUT = value] ;
i See Input dataset.
HBARHBAR bar-variable [ / { options … } ] ;
options[ AXIS =
[ { value … } |a to b [ by c ]
] |DISCRETE |FREQ = num-variable |GROUP = group-variable |GSPACE = n |LEVELS = n |MEAN |MIDPOINTS =
[ { "char-value" … } |{ num-value … } |a to b [ by c ]
] |MISSING |NOSTATS |NOSYMBOL |REF = { value … } |SPACE = n |SUBGROUP = sub-variable |SUM |SUMVAR = num-variable |TYPE =
[ CFREQ |CPERCENT |FREQ |MEAN |PERCENT |SUM
Reference for language elementsVersion 3.3
1022
] |WIDTH = n
]
VBARVBAR bar-variable [ / { options … } ] ;
options[ AXIS =
[ { value … } |a to b [ by c ]
] |DISCRETE |FREQ = num-variable |GROUP = group-variable |GSPACE = n |LEVELS = n |MIDPOINTS =
[ { "char-value" … } |{ num-value … } |a to b [ by c ]
] |MISSING |NOSYMBOL |REF = { value … } |SPACE = n |SUBGROUP = sub-variable |SUMVAR = num-variable |TYPE =
[ CFREQ |CPERCENT |FREQ |MEAN |PERCENT |SUM
] |WIDTH = n
]
Reference for language elementsVersion 3.3
1023
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
WHEREWHERE condition ;
CIMPORT Procedure
Supported statements• PROC CIMPORT• EXCLUDE• SELECT
PROC CIMPORTPROC CIMPORT [ { option … } ] ;
option[ [ CATALOG |
CAT |C |DATA |DS |D |LIBRARY |LIB |L
] = [ libname . ] file name |EET = entry-type |ET = entry-type |EXTENDSN = [ YES | NO ] |INFILE = file |[ MEMTYPE | MT ] = [ ALL | CATALOG | CAT | DATA | DS ] |NEW
]
Reference for language elementsVersion 3.3
1024
EXCLUDEEXCLUDE { file name | catalog name … } [ { option … } ]
option[ ENTRYTYPE = type |
[ MEMTYPE | MTYPE | MT ] = [ ALL | CATALOG | CAT | DATA | DS ] ]
SELECTSELECT { file name | catalog name … } [ { option … } ]
option[ ENTRYTYPE = type |
[ MEMTYPE | MTYPE | MT ] = [ ALL | CATALOG | CAT | DATA | DS ] ]
COMPARE Procedure
Supported statements• PROC COMPARE• BY• EXCLUDEVAR• ID• VAR• WITH• WHERE
PROC COMPAREPROC COMPARE [ { option … } ] ;
Reference for language elementsVersion 3.3
1025
option[ BASE = input-data-set-with-options i |
BRIEF |BRIEFSUMMARY |[ COMPARE | COMP | C ] = input-data-set-with-options ii |CRITERION = value |DATA |ERROR |FUZZ = fuzz |LISTBASEVAR |LISTCOMPVAR |LISTEQUALVAR |LISTVAR |MAXPRINT =
[ ( overall-limit , per-variable-limit ) |overall-limit
] |METHOD =
[ absolute |exact |percent |relative [ ( delta ) ] |Ivey
] |NOPRINT |NOSUMMARY |NOTE |OUT = output-data-set-with-options iii |OUTALL |OUTBASE |OUTCOMP |OUTDIF |OUTNOEQUAL |OUTPERCENT |WARNING
]
i See Input dataset.ii See Input dataset.iii See Output dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
Reference for language elementsVersion 3.3
1026
EXCLUDEVAREXCLUDEVAR { variable … } ;
IDID { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
VARVAR { variable-name … } ;
WITHWITH { variable … } ;
WHEREWHERE condition ;
CONTENTS Procedure
Supported statements• PROC CONTENTS
PROC CONTENTSPROC CONTENTS [ { option … } ] ;
option[ DATA = data-set i |
[ DETAILS | NODETAILS ] |
Reference for language elementsVersion 3.3
1027
DIRECTORY |FMTLEN [ MEMTYPE | MT ] = [ DATA | VIEW | ALL ] |NODS |OUT = output-data-set-with-options ii |OUT2 = output-data-set-with-options iii |[ NOPRINT | PRINT ] |SHORT |VARNUM |POSITION
]
i See Dataset.ii See Output dataset.iii See Output dataset.
COPY Procedure
Supported statements• PROC COPY• EXCLUDE• SELECT
PROC COPYPROC COPY [ IN | INDD | INLIB ] = library-name-to-copy-from [ OUT | OUTDD | OUTLIB ] = library-
name-to-copy-to [ { option … } ] ;
option[ [ CLONE | NOCLONE ] |
[ MEMTYPE | MTYPE | M ] = [ DATA | VIEW | CATALOG | ALL ] |MOVE |INDEX = [ YES | NO ]
]
EXCLUDEEXCLUDE { data-set … } [ / option ] ;
Reference for language elementsVersion 3.3
1028
data-setdata-set-name
[ ( [ MEMTYPE | MTYPE | M ] = [ DATA | VIEW | CATALOG ] )]
optionMEMTYPE = [ DATA | VIEW | CATALOG | ALL ]
SELECTSELECT { data-set … } [ / { option … } ] ;
data-setdata-set-name
[ ( [ MEMTYPE | MTYPE | M ] = [ DATA | VIEW | CATALOG ] )]
optionMEMTYPE = [ DATA | VIEW | CATALOG | ALL ]
CORR Procedure
Supported statements• PROC CORR• BY• FREQ• PARTIAL• VAR• WEIGHT• WHERE• WITH
Reference for language elementsVersion 3.3
1029
PROC CORRPROC CORR [ { option … } ] ;
option[ ALPHA |
BEST = n |COV |CSSCP |DATA = data-set i |EXCLNWGT |FISHER [ ( { FisherOptions … } ) ] |HOEFFDING |KENDALL |NOCORR |NOMISS |NOPRINT |NOPROB |NOSIMPLE |OUTH = output-data-set |OUTK = output-data-set |OUTP = output-data-set |OUTS = output-data-set |PEARSON |PLOTS [ MAXPOINTS= [ NONE | n ] ] =
[ PlotRequest |( { PlotRequest … } )
] |POLYSERIAL [ ( { PolyserialOptions … } ) ] |RANK |SINGULAR = p |SPEARMAN |SSCP |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
i See Input dataset.
FisherOptions[ ALPHA = a |
BIASADJ = [ YES | NO ] |RHO0 = rho |TYPE = [ LOWER | UPPER | TWOSIDED ]
]
Reference for language elementsVersion 3.3
1030
PolyserialOptions[ CONVERGE = p |
MAXITER = number |NGROUPS = [ ALL | n ] |ORDINAL = [ WITH | VAR ]
]
PlotRequest[ ALL |
MATRIX [ ( { MatrixOptions … } ) ] |NONE |SCATTER [ ( { ScatterOptions … } ) ]
]
MatrixOptions[ HISTOGRAM |
NVAR = [ ALL | n ] |NWITH = [ ALL | n ]
]
ScatterOptions[ ALPHA = a |
ELLIPSE = [ PREDICTION | CONFIDENCE | NONE ] |NOINSET |NVAR = [ ALL | n ] |NWITH = [ ALL | n ]
]
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1031
PARTIALPARTIAL { variable-name … }
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
WHEREWHERE condition ;
WITHWITH { variable-name … } ;
CPORT Procedure
Supported statements• PROC CPORT• EXCLUDE• SELECT
PROC CPORTPROC CPORT [ { option … } ] ;
Reference for language elementsVersion 3.3
1032
option[ [ CATALOG |
CAT |C |DATA |DS |D |LIBRARY |LIB |L
] = [ libname . ] file name |AFTER = date |ASIS |CONSTRAINT = [ YES | NO | TRUE | FALSE ] |DATACOPY |EET = entry-type |ET = entry-type |FILE = file name |INDEX = [ YES | NO ] |[ MEMTYPE | MT ] = [ ALL | CATALOG | CAT | DATA | DS ] |NOCOMPRESS |TRANSLATE = value-1 to value-2
]
EXCLUDEEXCLUDE { file name | catalog name … } [ { option … } ]
option[ ENTRYTYPE = type |
[ MEMTYPE | MTYPE | MT ] = [ ALL | CATALOG | CAT | DATA | DS ] ]
SELECTSELECT { file name | catalog name … } [ { option … } ]
Reference for language elementsVersion 3.3
1033
option[ ENTRYTYPE = type |
[ MEMTYPE | MTYPE | MT ] = [ ALL | CATALOG | CAT | DATA | DS ] ]
DATASETS Procedure
Supported statements• PROC DATASETS• AGE• APPEND• CHANGE• CONTENTS• COPY• DELETE• EXCLUDE• EXCHANGE• FORMAT• INDEX CREATE• INDEX DELETE• INFORMAT• LABEL• MODIFY• RENAME• REPAIR• SELECT
PROC DATASETSPROC DATASETS [ { option … } ] ;
Reference for language elementsVersion 3.3
1034
option[ [ DETAILS | NODETAILS ] |
KILL |[ LIBRARY | LIB | DDNAME | DD ] = library-name |[ MEMTYPE | MTYPE | MT ] =
[ ALL |CATALOG |DATA |PROGRAM |VIEW
] |NOLIST |NOWARN
]
AGEAGE current-data-set { related-data-set … }
[ { [ MEMTYPE | MTYPE | MT ] =[ CATALOG |
DATA |PROGRAM |VIEW
] … }] ;
APPENDAPPEND
{ BASE = data-set i |DATA = data-set ii |NEW = data-set iii |FORCE |OUT |WHERE sub-set condition ;
… } ;
i See Input dataset.ii See Input dataset.iii See Input dataset.
Reference for language elementsVersion 3.3
1035
CHANGECHANGE { old-name = new-name … } [ / change-option ] ;
change-option[ MEMTYPE | MTYPE | MT ] =
[ ALL |CATALOG |DATA |PROGRAM |VIEW
]
CONTENTSCONTENTS
{ DATA = data-set i |[ DETAILS | NODETAILS ] |DIRECTORY |FMTLEN |[ MEMTYPE | MTYPE | MT ] = [ ALL | DATA | VIEW ] |NODS |OUT = output-data-set-with-options ii |OUT2 = output-data-set-with-options iii |[ PRINT | NOPRINT ] |SHORT |VARNUM |POSITION
… } ;
i See Input dataset.ii See Output dataset.iii See Output dataset.
COPYCOPY [ IN | INDD | INLIB ] = library-name [ OUT | OUTDD | OUTLIB ] = library-name [ { option … } ]
;
Reference for language elementsVersion 3.3
1036
option[ [ CLONE | NOCLONE ] |
INDEX = [ YES | NO ] |[ MEMTYPE | MTYPE | MT ] = [ ALL | CATALOG | DATA | VIEW ] |MOVE
]
DELETEDELETE { data-set … }
[ / MEMTYPE =[ ALL |
CATALOG |DATA |PROGRAM |VIEW
] ]
EXCLUDEEXCLUDE { data-set … } [ / option ] ;
data-setdata-set-name
[ ( MEMTYPE =[ CATALOG |
DATA |PROGRAM |VIEW
] )]
Reference for language elementsVersion 3.3
1037
option[ MEMTYPE | MTYPE | MT ] =
[ ALL |CATALOG |DATA |PROGRAM |VIEW
]
EXCHANGEEXCHANGE { name-1 = name-2 … } [ / exchange-option ] ;
exchange-optionMEMTYPE =
[ ALL |CATALOG |DATA |PROGRAM |VIEW
]
FORMAT
FORMAT { variable-list i[ format ] … } ;
i See Variable Lists.
INDEX CREATEINDEX CREATE
{ simple-index-name |composite-index-name = ( { name … } )
… } [ UNIQUE ] ;
Reference for language elementsVersion 3.3
1038
INDEX DELETEINDEX DELETE [ { index-name … } | _ALL_ ] ;
INFORMAT
INFORMAT { variable-list i[ informat ] … } ;
i See Variable Lists.
LABELLABEL { variable = [ format ] … } ;
MODIFYMODIFY data-set-name
[ (
[ LABEL = [ "data-set-label" ]] )
] ;
RENAMERENAME { old-name = new-name … } ;
REPAIRREPAIR data-set-name
[ [ MEMTYPE | MTYPE | MT ] = [ CATALOG | DATA | VIEW ] ] ;
Reference for language elementsVersion 3.3
1039
SELECTSELECT { data-set … } [ / { option … } ] ;
data-setdata-set-name
[ ( [ MEMTYPE | MTYPE | MT ] =[ CATALOG |
DATA |PROGRAM |VIEW
] )]
option[ MEMTYPE | MTYPE | MT ] =
[ ALL |CATALOG |DATA |PROGRAM |VIEW
]
DBLOAD Procedure
Supported statements• PROC DBLOAD• ACCDESC• COLUMN• COMMIT• DELETE• ERRLIMIT• LABEL• LIMIT• LIST• LOAD• NULL• RENAME
Reference for language elementsVersion 3.3
1040
• RESET• SQL• TABLE• TYPE• WHERE
PROC DBLOADPROC DBLOAD
{ |DATA = input-data-set-with-options i |DBMS = database-engine-name |APPEND
… } ;
i See Input dataset.
ACCDESC
ACCDESC = access-descriptor-name i;
i See Access Descriptors.
COLUMNCOLUMN = integer ;
COMMITCOMMIT = integer ;
DELETEDELETE [ integer | column-name ] ;
Reference for language elementsVersion 3.3
1041
ERRLIMITERRLIMIT = integer ;
LABELLABEL ;
LIMITLIMIT = integer ;
LISTLIST
[ ALL |FIELD |integer |column-name
] ;
LOADLOAD ;
NULLNULL [ integer | column-name ] = [ Y | N | D ] ;
RENAMERENAME [ integer | column-name ] = name ;
Reference for language elementsVersion 3.3
1042
RESETRESET [ integer | column-name | ALL ] ;
SQLSQL database-specific-sql-not-returning-a-rowset ;
TABLETABLE
[ string-literal |[ schema-name . ] table-name
] ;
TYPETYPE [ integer | column-name ] = string-literal ;
WHEREWHERE condition ;
Connection optiondatabase-specific-option-dependent-on-dbms-option = database-specific-value ;
DELETE Procedure
Supported statements• PROC DELETE
Reference for language elementsVersion 3.3
1043
PROC DELETEPROC DELETE DATA = { data-set-name … } ;
EXPORT Procedure
Supported statements• PROC EXPORT• DATABASE• DBLIBOPTS• DBPASSWORD• DELIMITER• MSENGINE• NEWFILE• PASSWORD• PUTNAMES• SHEET• USER• WGDB
PROC EXPORTPROC EXPORT [ { option … } ] ;
option[ DATA = data-set |
DBMS =[ ACCESS |
ACCESS97 |ACCESS2000 |ACCESS2002 |ACCESS2003 |ACCESS2007 |ACCESS2010 |CSV |DLM |DBF |
Reference for language elementsVersion 3.3
1044
EXCEL |EXCEL97 |EXCEL2000 |EXCEL2002 |EXCEL2003 |EXCEL2007 |EXCEL2010 |DBF |TAB |SPSS |SAV
] |LABEL |OUTFILE = "file-name" |OUTTABLE = table-name |REPLACE
]
DATABASEDATABASE [ = ] "database-name" ;
DBLIBOPTSDBLIBOPTS [ = ] "database-specific-options" ;
DBPASSWORDDBPASSWORD [ = ] "password" ;
DELIMITERDELIMITER [ = ] [ "character" | "hh"x ] ;
MSENGINEMSENGINE [ = ] [ ACE | JET ] ;
Reference for language elementsVersion 3.3
1045
NEWFILENEWFILE [ = ] [ YES | NO ] ;
PASSWORDPASSWORD [ = ] "password" ;
PUTNAMESPUTNAMES [ = ] [ YES | NO ] ;
SHEETSHEET [ = ] "Excel sheet name" ;
USERUSER [ = ] "user name" ;
WGDBWGDB [ = ] "Access system file" ;
FMTLIB Procedure
Supported statements• PROC FMTLIB• EXCLUDE• INVALUE• PICTURE• SELECT
Reference for language elementsVersion 3.3
1046
• VALUE
PROC FMTLIBPROC FMTLIB [ { option … } ] ;
option[ CNTLIN = input-data-set-with-options i |
CNTLOUT = output-data-set-with-options ii |LIBRARY = library [ . catalog ] |NOREPLACE |FMTLIB |LIB |MAXLABLEN = n |MAXSELEN = n |PAGE
]
i See Input dataset.ii See Output dataset.
EXCLUDEEXCLUDE { catalog-entry … } ;
INVALUEINVALUE format-name [ ( { option … } ) ] { mapping … } ;
option[ DEFAULT = length |
MAX = length |MIN = length |NOTSORTED
]
Reference for language elementsVersion 3.3
1047
mapping[ { invalue-range, … } = informatted-value |
{ invalue-range, … } = [ existing-informat ] |_SAME_
]
invalue-range[ value |
inclusivestart - inclusiveend |exclusive <- rangeend |inclusivestart -< exclusiveend |exclusivestart <-< exclusiveend |OTHER
]
PICTUREPICTURE format-name [ ( { option … } ) ] { mapping … } ;
option[ DATATYPE = [ DATE | DATETIME | TIME ] |
DEFAULT = length |FUZZ = tolerance |MAX = length |MIN = length |NOTSORTED |ROUND
]
mapping{ value |
[ start - end |start <- end |start -< end |start <-< end
] |OTHER
,… } = "picture-string"[ (
{ FILL = "fill-character" |MULTIPLIER = multiplier |
Reference for language elementsVersion 3.3
1048
PREFIX = "prefix-string" |NOEDIT
… } )]
SELECTSELECT { entry … } ;
VALUEVALUE format-name [ ( { option … } ) ] { mapping … } ;
option[ DEFAULT = length |
FUZZ = tolerance |MAX = length |MIN = length |NOTSORTED
]
mapping[ { value-range, … } = "formatted-value" |
{ value-range, … } = [ existing-format ]]
value-range[ value |
start - end |start <- end |start -< end |start <-< end |OTHER
]
Reference for language elementsVersion 3.3
1049
FORMAT Procedure
Supported statements• PROC FORMAT• EXCLUDE• INVALUE• PICTURE• SELECT• VALUE
PROC FORMATPROC FORMAT [ { option … } ] ;
option[ CNTLIN = input-data-set-with-options i |
CNTLOUT = output-data-set-with-options ii |[ LIBRARY | LIB ] = library [ . catalog ] |NOREPLACE |FMTLIB |MAXLABLEN = n |MAXSELEN = n |PAGE
]
i See Input dataset.ii See Output dataset.
EXCLUDEEXCLUDE { catalog-entry … } ;
INVALUEINVALUE format-name [ ( { option … } ) ] { mapping … } ;
Reference for language elementsVersion 3.3
1050
option[ DEFAULT = length |
MAX = length |MIN = length |NOTSORTED
]
mapping[ { invalue-range, … } = informatted-value |
{ invalue-range, … } = [ existing-informat ] |_SAME_
]
invalue-range[ value |
inclusivestart - inclusiveend |exclusive <- rangeend |inclusivestart -< exclusiveend |exclusivestart <-< exclusiveend |OTHER
]
PICTUREPICTURE format-name [ ( { option … } ) ] { mapping … } ;
option[ DATATYPE = [ DATE | DATETIME | TIME ] |
DEFAULT = length |FUZZ = tolerance |MAX = length |MIN = length |NOTSORTED |ROUND
]
mapping{ value |
[ start - end |start <- end |
Reference for language elementsVersion 3.3
1051
start -< end |start <-< end
] |OTHER
,… } = "picture-string"[ (
{ FILL = "fill-character" |MULTIPLIER = multiplier |PREFIX = "prefix-string" |NOEDIT
… } )]
SELECTSELECT { entry … } ;
VALUEVALUE format-name [ ( { option … } ) ] { mapping … } ;
option[ DEFAULT = length |
FUZZ = tolerance |MAX = length |MIN = length |NOTSORTED
]
mapping[ { value-range, … } = "formatted-value" |
{ value-range, … } = [ existing-format ]]
Reference for language elementsVersion 3.3
1052
value-range[ value |
start - end |start <- end |start -< end |start <-< end |OTHER
]
FORMS Procedure
Supported statements• PROC FORMS• BY• FREQ• LINE• WHERE
PROC FORMSPROC FORMS [ { option … } ] ;
option[ ACROSS = n |
ALIGN = n |BETWEEN = n |COPIES = n |CC |DATA = input-data-set-with-options i |DOWN = n |FILE = fileref |INDENT = n |LINES = n |NDOWN = n |PAGESIZE = n |SETS = n |SKIP = n |WIDTH = n
Reference for language elementsVersion 3.3
1053
]
i See Input dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
FREQFREQ variable-name ;
LINELINE line-number { variable … }
[ /
[ indent = n |lastname |pack |remove
] ] ;
WHEREWHERE condition ;
FREQ Procedure
Supported statements• PROC FREQ• EXACT• OUTPUT• TABLES• WEIGHT
Reference for language elementsVersion 3.3
1054
• BY• WHERE
PROC FREQPROC FREQ [ { option … } ] ;
option[ DATA = input-data-set-with-options i |
FC(1,2,7) = formchar-string |FORMCHAR(1,2,7) = formchar-string |NLEVELS |NOPRINT |ORDER =
[ DATA |EXTERNAL |FMT |FORMATTED |FREQ |INTERNAL |UNFMT |UNFORMATTED
] ]
i See Input dataset.
EXACTEXACT { statistic-options … } [ / { computation-options … } ] ;
statistic-options[ BARNARD |
CHISQ |COMOR |EQOR |FISHER |KENTB |LRCHI |MEASURES |
Reference for language elementsVersion 3.3
1055
MHCHI |OR |PCHI |PCORR |RELRISK
[ (
{ COLUMN = [ 1 | 2 | BOTH ] |[ METHOD = ] [ FMSCORE | SCORE ]
… } )] |
RISKDIFF [ ( COLUMN = [ 1 | 2 | BOTH ] ) ] |SCORR |SMDCR |SMDRC |STUTC |ZELEN
]
computation-options[ ALPHA = value |
MAXTIME = value |MC |N = n |POINT |SEED = number
]
OUTPUTOUTPUT [ { options … } ] ;
options[ OUT = data-set i |
AJCHI |ALL |BD |BDCHI |CHISQ |CMH |CMH1 |CMH2 |CMHCOR |
Reference for language elementsVersion 3.3
1056
CMHGA |CMHRMS |COMOR |CONTGY |CRAMV |EQOR |FISHER |GAILSIMON |GAMMA |GS |KENTB |LAMCR |LAMDAS |LAMRC |LGOR |LGRRC1 |LGRRC2 |LRCHI |MEASURES |MHCHI |MHOR |MHRRC1 |MHRRC2 |N |NMISS |OR |PCHI |PCORR |PHI |PLCORR |RDIF1 |RDIF2 |RELRISK |RELRISK1 |RELRISK2 |RISK1 |RISK11 |RISK12 |RISK2 |RISK21 |RISK22 |RISKDIFF |RISKDIFF1 |RISKDIFF2 |RRC1 |RRC2 |
Reference for language elementsVersion 3.3
1057
RSK1 |RSK11 |RSK12 |RSK2 |RSK21 |RSK22 |SCORR |SMDCR |SMDRC |STUTC |TAUB |TAUC |U |UCR |URC |ZELEN
]
i See Output dataset.
TABLESTABLES table-list [ / { options … } ] ;
options[ OUT = data-set i |
ALL |ALPHA = value |BDT |CELLCHI2 |CHISQ |CL |CMH cmh-options |CMH1 cmh-options |CMH2 cmh-options |CONVERGE = value |DEVIATION |EXACT |EXPECTED |FISHER |FORMAT = format |GAILSIMON gailsimon-options |GS gailsimon-options |LIST |
Reference for language elementsVersion 3.3
1058
MANTELFLEISS |MAXITER = n |MEASURES |MF |MISSING |MISSPRINT |NOCOL |NOCUM |NOFREQ |NOPCT |NOPERCENT |NOPRINT |NOROW |NOSPARSE |OR |OUTCUM |OUTEXPECT |OUTPCT |PLCORR |PRINT |RELRISK |RISKDIFF riskdiff-options |RISKDIFFC riskdiff-options |SCORES =
[ MODRIDIT |RANK |RIDIT |TABLE
] |SCOROUT |SPARSE |TESTF = ( { value … } ) |TESTP = ( { value … } ) |V5FMT
]
i See Output dataset.
table-list{ type-term { * type-term … } … }
type-term[ variable |
( table-list )]
Reference for language elementsVersion 3.3
1059
cmh-options[ (
{ BDT |GAILSIMON gailsimon-options |GS gailsimon-options |MANTELFLEISS |MF
… } )]
gailsimon-options[ ( COLUMN = [ 1 | 2 ] ) ]
riskdiff-options[ (
{ CL =[ cl-option |
( { cl-option … } )] |
COLUMN = [ 1 | 2 | BOTH ] |CORRECT |EQUAL |EQUIV |EQUIVALENCE |MARGIN =
[ value |( lower , upper )
] |METHOD =
[ FM |HA |NEWCOMBE |SCORE |WILSON |WALD
] |NONINF |NONINFERIORITY |NORISKS |SUP |SUPERIORITY |VAR = [ SAMPLE | NULL ]
… } )]
Reference for language elementsVersion 3.3
1060
cl-option[ AC |
AGRESTICAFFO |EXACT |FM [ ( NULL = value ) ] |HA |MN [ ( CORRECT = [ MEE | NO ] ) ] |NEWCOMBE [ ( CORRECT ) ] |SCORE [ ( CORRECT ) ] |WALD
[ (
{ CORRECT |NULL [ = value ]
… } )] |
WILSON [ ( CORRECT ) ]]
WEIGHTWEIGHT weight-variable ;
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
WHEREWHERE condition ;
HADOOP Procedure
Supported statements• PROC HADOOP• HDFS• MAPREDUCE
Reference for language elementsVersion 3.3
1061
• PIG
PROC HADOOPPROC HADOOP [ { server_option … } ] ;
server option[ OPTIONS = [ file-ref | 'external file' ] |
PASSWORD = password |USERNAME = 'ID' |VERBOSE
]
HDFSHDFS
[ { server_option … } { command_option … }] ;
command option[ COPYFROMLOCAL = 'local file' |
COPYTOLLOCAL = 'hdfs file' |DELETE = 'hdfs file' |DELETESOURCE |MKDIR = 'hdfs-path' |OUT = 'output-location' |OVERWRITE |RENAME = 'hdfs-file' |RECURSIVE
]
MAPREDUCEMAPREDUCE
[ { server_option … } { command_option … }] ;
Reference for language elementsVersion 3.3
1062
command option[ COMBINE = class-name |
GROUPCOMPARE = class-name |INPUT = hdfs path |INPUTFORMAT = class-name |JAR = 'external jar files' |MAP = class-name |OUTPUT = 'hdfs-path' |OUTPUTFORMAT = class-name |OUTPUTKEY = class-name |OUTPUTVALUE = class-name |PARTITIONER = class-name |REDUCE = class-name |REDUCETASKS = integer |SORTCOMPARE = class-name |WORKINGDIR = hdfs-path
]
PIGPIG
[ { server_option … } { command_option … }] ;
command option[ CODE = [ file-ref | 'external file' ] |
PARAMETERS = [ file-ref | 'external file' ] |REGISTERJAR = 'external jar files'
]
HTTP Procedure
Supported statements• PROC HTTP
PROC HTTPPROC HTTP URL = url [ { option … } ] ;
Reference for language elementsVersion 3.3
1063
option[ HEADERIN = file-ref |
HEADEROUT = file-ref |IN = file-ref |OUT = file-ref |CT = content-type |METHOD = http-method |PROXYPASSWORD = proxy-password |PROXYPORT = proxy-port |WEBPASSWORD = http-auth-password |PROXYHOST = proxy-host |PROXYUSERNAME = proxy-username |WEBDOMAIN = ntlm-auth-domain |WEBUSERNAME = http-auth-username
]
IMPORT Procedure
Supported statements• PROC IMPORT• DATABASE• DATAROW• DBLIBOPTS• DBPASSWORD• DELIMITER• GETDELETED• GETNAMES• GUESSINGROWS• MEMOSIZE• MIXED• MSENGINE• PASSWORD• RANGE• SCANMEMO• SCANTEXT• SCANTIME• SHEET
Reference for language elementsVersion 3.3
1064
• TEXTSIZE• USEDATE• USER• WGDB
PROC IMPORTPROC IMPORT [ { option … } ] ;
option[ DATAFILE = "data-file" |
DATATABLE = table name |DBMS =
[ ACCESS |ACCESS97 |ACCESS2000 |ACCESS2002 |ACCESS2003 |ACCESS2007 |ACCESS2010 |CSV |DLM |DBF |EXCEL |EXCEL95 |EXCEL97 |EXCEL2000 |EXCEL2002 |EXCEL2003 |EXCEL2007 |EXCEL2010 |SPSS |SAV |TAB
] |IGNOREDOSEOF |OUT = data-set |REPLACE
]
Reference for language elementsVersion 3.3
1065
DATABASEDATABASE [ = ] "database-name" ;
DATAROWDATAROW [ = ] integer ;
DBLIBOPTSDBLIBOPTS [ = ] "database-specific-options" ;
DBPASSWORDDBPASSWORD [ = ] "password" ;
DELIMITERDELIMITER [ = ] [ "character" | "hh"x ] ;
GETDELETEDGETDELETED [ = ] [ YES | NO ] ;
GETNAMESGETNAMES [ = ] [ YES | NO ] ;
GUESSINGROWSGUESSINGROWS [ = ] number ;
Reference for language elementsVersion 3.3
1066
MEMOSIZEMEMOSIZE [ = ] integer ;
MIXEDMIXED [ = ] [ YES | NO ] ;
MSENGINEMSENGINE [ = ] [ ACE | JET ] ;
PASSWORDPASSWORD [ = ] "password" ;
RANGERANGE [ = ] "spreadsheet-range" ;
SCANMEMOSCANMEMO [ = ] [ YES | NO ] ;
SCANTEXTSCANTEXT [ = ] [ YES | NO ] ;
SCANTIMESCANTIME [ = ] [ YES | NO | ANY ] ;
Reference for language elementsVersion 3.3
1067
SHEETSHEET [ = ] "spreadsheet-name" ;
TEXTSIZETEXTSIZE [ = ] integer ;
USEDATEUSEDATE [ = ] [ YES | NO ] ;
USERUSER [ = ] "user name" ;
WGDBWGDB [ = ] "Access system file" ;
JSON Procedure
Supported statements• PROC JSON• EXPORT• WRITE
PROC JSONPROC JSON OUT = [ "file-name" | fileref ]
{ |PRETTY |
Reference for language elementsVersion 3.3
1068
NOPRETTY |FMTDATETIME |NOFMTDATETIME |FMTNUMERIC |NOFMTNUMERIC |FMTCHARACTER |NOFMTCHARACTER |SCAN |NOSCAN |TRIMBLANKS |NOTRIMBLANKS
… } ;
EXPORT[ EXPORT | EX ] data-set
[ /
{ TABLENAME = "name" |FMTDATETIME |NOFMTDATETIME |FMTNUMERIC |NOFMTNUMERIC |FMTCHARACTER |NOFMTCHARACTER |SCAN |NOSCAN |TRIMBLANKS |NOTRIMBLANKS
… } ] ;
Reference for language elementsVersion 3.3
1069
WRITE[ [ WRITE OPEN | W O ] [ ARRAY | OBJECT ] |
[ WRITE VALUES | W V ] { "string-value" |
N |NULL |T |TRUE |F |FALSE |number |name
… } [ /
[ SCAN |NOSCAN |TRIMBLANKS |NOTRIMBLANKS
] ]
]
JAVAINFO Procedure
Supported statements• PROC JAVAINFO
PROC JAVAINFOPROC JAVAINFO [ { option … } ] ;
option[ ALL |
CLASSPATHS |HELP |JREOPTIONS |OS |VERSION
]
Reference for language elementsVersion 3.3
1070
MEANS Procedure
Supported statements• PROC MEANS• BY• CLASS• FREQ• ID• OUTPUT• TYPES• VAR• WAYS• WEIGHT• WHERE
Statistic keywordsThe following keywords are used within several statements of this procedure.
[ CSS |CLM |CV |KURTOSIS |LCLM |MAX |MEAN |MIN |N |NMISS |P1 |P5 |P10 |P20 |P30 |P40 |P60 |P70 |P80 |[ P25 | Q1 ] |[ P50 | MEDIAN ] |
Reference for language elementsVersion 3.3
1071
[ P75 | Q3 ] |P90 |P95 |P99 |[ PROBT | PRT ] |QRANGE |RANGE |SKEW |[ STD | STDEV ] |STDERR |SUM |SUMWGT |T |UCLM |USS |VAR
]
PROC MEANS
PROC MEANS [ { option … } ] [ { statistic-keyword i … } ] ;
i See Statistic keywords.
option[ ALPHA = value |
CHARTYPE |COMPLETETYPES |DATA = data-set ii |EXCLNPWGTS |FW = width |IDMIN |MAXDEC = decimals |MISSING |NONOBS |NWAY |ORDER =
[ DATA |EXTERNAL |FORMATTED |FMT |FREQ |INTERNAL |
Reference for language elementsVersion 3.3
1072
UNFORMATTED |UNFMT
] |PCTLDEF |PRINT |NOPRINT |PRINTALL |PRINTALLTYPES |QMARKERS = marker count |QMETHOD = [ OS | P2 | HIST ] |QNTLDEF = [ 1 | 2 | 3 | 4 | 5 ] |SUMSIZE = memory amount |THREADS |NOTHREADS |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
ii See Input dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable-name … } [ / { option … } [ / { option … } ] ] ;
option[ ASCENDING |
DESCENDING |GROUPINTERNAL |MISSING |MLF |ORDER =
[ DATA |FORMATTED |FREQ |UNFORMATTED
] |PREFLOADFMT
]
Reference for language elementsVersion 3.3
1073
FREQFREQ variable-name ;
IDID { variable-name … } ;
OUTPUT
OUTPUT [ OUT = output-data-set i ][ { output-statistic-specification … }] [ / [ { option … } ] ] ;
i See Output dataset.
output-statistic-specificationstatistic-keyword ii
[ ( { input-variable-name … } )] = [ { output-name … } ]
ii See Statistic keywords.
option[ AUTOLABEL |
AUTONAME |KEEPLEN |LEVELS |NOINHERIT |WAYS
]
TYPESTYPES type-list ;
Reference for language elementsVersion 3.3
1074
type-list{ type-factor* … }
type-factor[ variable |
( type-list )]
VARVAR { variable-name … }
[ / WEIGHT = variable-name] ;
WAYSWAYS ways-item [ { [ , ] ways-item … } ] ;
ways-item[ integer |
integer TO integer [ BY integer ]]
WEIGHTWEIGHT variable-name ;
WHEREWHERE condition ;
Reference for language elementsVersion 3.3
1075
OPTIONS Procedure
Supported statements• PROC OPTIONS
PROC OPTIONSPROC OPTIONS [ { option … } ] ;
option[ DEFINE |
EXPAND |HEXVALUE |HOST |LISTGROUPS |LOGNUMBERFORMAT |NOLOGNUMBERFORMAT |LONG |NOHOST |PORT |RESTRICT |SHORT |VALUE |OPTION = "option" |GROUP =
[ group-name |( { group-name … } )
] ]
OPTLOAD Procedure
Supported statements• PROC OPTLOAD
Reference for language elementsVersion 3.3
1076
PROC OPTLOADPROC OPTLOAD DATA = libref.dataset ;
OPTSAVE Procedure
Supported statements• PROC OPTSAVE
PROC OPTSAVEPROC OPTSAVE OUT = libref.dataset ;
PDS Procedure
Supported statements• PROC PDS• DELETE• CHANGE• EXCHANGE
PROC PDSPROC PDS [ { option … } ] ;
option[ DDNAME = DDName |
NOLIST |KILL |REFRESH |NOREFRESH |STRICT
]
Reference for language elementsVersion 3.3
1077
DELETEDELETE { name [ : ] … } ;
CHANGECHANGE { name [ : ] = name [ : ] … } ;
EXCHANGEEXCHANGE { name [ : ] = name [ : ] … } ;
PDSCOPY Procedure
Supported statements• PROC PDSCOPY• DELETE• SELECT• EXCLUDE
PROC PDSCOPYPROC PDSCOPY [ { option … } ] ;
option[ INDD = DDName | OUTDD = DDName ]
DELETEDELETE { name [ : ] … } ;
Reference for language elementsVersion 3.3
1078
SELECTSELECT name [ : ] [ | - | name [ : ] ] ;
EXCLUDEEXCLUDE name [ : ] [ | - | name [ : ] ] ;
PLOT Procedure
Supported statements• PROC PLOT• PLOT• BY• WHERE
PROC PLOTPROC PLOT
[ DATA = input-data-set-with-options i
] [ NOLEGEND ] ;
i See Input dataset.
PLOTPLOT {
[ y-var |( { y-var … } )
] *[ x-var |
( { x-var … } )] [ = [ z-var | "char-value" ] ] … } [ / { options … } ] ;
Reference for language elementsVersion 3.3
1079
options[ HAXIS =
[ { value … } |a to b [ by c ]
] |HREF =
[ { value … } |a to b [ by c ]
] |OVERLAY |VAXIS =
[ { value … } |a to b [ by c ]
] |VREF =
[ { value … } |a to b [ by c ]
] ]
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
WHEREWHERE condition ;
PRINT Procedure
Supported statements• PROC PRINT• ID• PAGEBY• SUM• SUMBY• VAR
Reference for language elementsVersion 3.3
1080
• BY• WHERE
PROC PRINTPROC PRINT [ { option … } ] ;
option[ DATA = input-data-set-with-options i |
DOUBLE |HEADING = [ "horizontal" | "vertical" ] |[ LABEL | L ] |[ LABELANDNAME | LN ] |N
[ = "subtotal label" [ , "total label" ]] |
[ NOOBS | OBS = "obs" ] |ROUND |ROWS = "page" |[ SPLIT | S ] = "split" |[ UNIFORM | U ] |WIDTH =
[ "UNIFORM" |"UNIFORMBY" |"FULL" |"MINIMUM"
] |style
]
i See Input dataset.
Reference for language elementsVersion 3.3
1081
styleSTYLE
[ (
{ BYLABEL |DATA |GRANDTOTAL |HEADER |N |OBS |OBSHEADER |TABLE |TOTAL
… } )] = [ element-name ] { { style-attribute-name = [ valid-value | "valid-string" ] … } }
IDID { variable … } [ / { style … } ] ;
PAGEBYPAGEBY by-variable ;
SUMSUM { variable … } [ / { style … } ] ;
SUMBYSUMBY by-variable ;
VARVAR { variable … } [ / { style … } ] ;
Reference for language elementsVersion 3.3
1082
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
WHEREWHERE condition ;
PRINTTO Procedure
Supported statements• PROC PRINTTO
PROC PRINTTOPROC PRINTTO [ { option … } ] ;
option[ LOG = [ LOG | "external-file" | fileref ] |
NEW |[ PRINT | FILE | NAME ] = [ "external-file" | fileref ] |UNIT = n
]
PWENCODE Procedure
Supported statements• PROC PWENCODE
Reference for language elementsVersion 3.3
1083
PROC PWENCODEPROC PWENCODE IN = "password-string"
[ OUT = fileref-name [ METHOD = sas001 ]] ;
R ProcedureThe R procedure is invoked by the PROC R statement and allows execution of program code written inR.
Supported statements• PROC R• ASSIGN• EXECUTE• EXPORT• IMPORT• LOAD• SAVE• SUBMIT
PROC RPROC R [ { option … } ] ;
option[ GMTOFFSET = "+/-HH:MM" |
TIMESASCHRON |LIB = default-library |KEEP |TERMINATE |TERM
]
Reference for language elementsVersion 3.3
1084
GMTOFFSET="+/-HH:MM"Sets the offset to GMT to be applied when moving date-time values between WPS and R using theASSIGN, EXPORT or IMPORT statements. Date-time values in WPS do not have an implied time-zone, whereas date-time values in R are represented in UTC (Coordinated Universal Time) with anassociated time zone.
TIMESASCHRONControls whether time values are represented in R using the chron class. By default, time values arerepresented in R using a count of seconds from midnight, but optionally the chron package can beused. However, this package is not part of the standard R installation.
The option affects the ASSIGN and EXPORT statements.
LIB=default-librarySpecifies the default library used by the EXPORT, IMPORT, LOAD and SAVE statements. Thedescriptions of these statements provide more details of the impact of this option.
KEEPSpecifies that the R application should be kept alive at the end of the procedure step and used forsubsequent PROC R invocations. The default behaviour is to terminate the R application at the end ofthe procedure, although this can be altered using the RKEEP system option.
TERMINATESpecifies that the R application should be terminated at the end of the procedure step. This is thedefault behaviour, although it can be changed using the RKEEP system option.
TERMTERM is an alias for TERMINATE.
An example invocation of PROC Rproc r; submit; R.version endsubmit;run;
Reference for language elementsVersion 3.3
1085
ASSIGNThe ASSIGN statement can be used to assign a value to an R vector value.
ASSIGN r-object-name =[ value |
( { value, … } )] ;
value[ int-literal |
float-literal |date-literal |datetime-literal |time-literal |string-literal
]
Note:All of the values on the right hand side of the assignment must be of the same type. For example, theymust be all integers, or all strings.
The type of R vector created depends on the types of the values supplied:
Types of values supplied Type of R vector created
Integers Integer
Floating point Real
Date Real with a class of Date
Datetime Real with a class of POSIXct, adjusted according to theGMTOFFSET option supplied to the PROC R statement
Time Real with a class of times
String String
Typically, this statement would be used to pass parameters into an R program. Often the values on theright of the assignment would be generated using macro variable expansion, or macro execution. Withthis facility, the need to perform macro expansion within the SUBMIT block itself is greatly reduced.
The name of the R object is specified as a normal identifier in the WPS language. Case is preservedwhen creating the R object. If necessary, a name literal can be used (as in "r.object.name"n) tocreate R objects having names that would not otherwise be valid in the language of SAS.
Reference for language elementsVersion 3.3
1086
An example assignment of a value to an R object%let parm=15;proc r; assign parm=&parm; submit; x<-sample(1:3, parm, replace=TRUE) print(x); endsubmit;run;
EXECUTEThe EXECUTE statement of the R procedure allows the execution of an R program stored in a file.
EXECUTE "filename" ;
Note:Using the EXECUTE statement is an alternative to using the SUBMIT statement. It allows the R code tobe placed into a separate file. This is useful because it allows the same program code to be executeddirectly in an interactive R environment. Where relevant, any relative path names are resolved relativeto the current directory of the WPS process.
An example of executing an R program stored in a fileContents of model.r source file:
model <- lm(source$y ~ source$x) print(model) par(mfrow=c(2, 2)) plot(model)
Sample R procedure invocation:
data source; do x=1 to 10; y=ranuni(-1); output; end;
PROC R; export data=source; execute "model.r";run;
Reference for language elementsVersion 3.3
1087
EXPORTThe EXPORT statement of the R procedure creates an R data frame from a WPS dataset.
EXPORT { option … } ;
option[ DATA = wps-data-set |
[ R | FRAME ] = r-object-name]
DATASpecifies the name of the dataset to export, along with any required dataset options. This option isrequired.
R or FRAMEOptionally specifies the name to give the object in the R environment. If omitted, the name of the Robject is taken from the member name of the dataset.
Dataset options can be specified on the input dataset in the normal way, but it might be useful to applya WHERE clause or a DROP list to the dataset before exporting it to R.
Note:Applying a WHERE clause, or exporting a dataset from a sequential library or view (in other words, whenthe number of observations in the dataset is not known) requires additional resources as the datasetmust first be spooled so as to calculate the exact number of observations before the R data frame canbe created.
There are two types of variable in a WPS dataset: numeric and character. In addition, a numericcolumn can have a format associated with it that may be used to infer further type information. The typeof R vector created is as follows:
WPS variable type Type of R vector created
Character Standard string.
Numeric variable with dateformat applied
Real R vector assigned a class of Date.
Numeric variable with a datetimeformat applied
A real R vector will be created and assigned a class of POSIXct.Values of this class represent a count of seconds since 1st Jan1970 (Coordinated Universal Time). The values are adjusted basedon the GMTOFFSET option passed to the PROC R invocation to takeaccount of the fact that datetime values in the language of SAS arelocal time, whereas the values of the POSIXct class in R have tobe in UTC.
Reference for language elementsVersion 3.3
1088
WPS variable type Type of R vector created
Numeric variable with a timeformat applied
There are two options based on whether the TIMESASCHRONoption is specified by the PROC R invocation. By default, a normalreal R vector is created and no special class is assigned to thevector. However, if the TIMESASCHRON option is specified,then the vector is assigned a class of times. The R chronpackage (that provides the times class) is not part of a standard Rinstallation but provides utilities for handling time-of-day values.
Other numeric variables A normal real R vector is created and no special class assigned.
When passing numeric values from WPS to R, the EXPORT statement interprets the special missingvalues .I and .M and creates the R values Inf and -Inf accordingly. Any other missing value ispassed to R as the NaN value.
An example of exporting data from WPS to RThis example creates a dataset containing two numeric columns and exports it to R.
data source; do x=1 to 10; y=ranuni(-1); output; end;
proc r; export data=source; submit; str(source) endsubmit;run;
The resulting data frame:
'data.frame': 10 obs. of 2 variables: $ x: num 1 2 3 4 5 6 7 8 9 10 $ y: num 0.371 0.924 0.59 0.434 0.962 ...
IMPORTThe IMPORT statement of the R procedure creates a WPS dataset from an R object.
IMPORT { option … } ;
option[ DATA = wps-data-set |
[ R | FRAME ] = r-object-name]
Reference for language elementsVersion 3.3
1089
DATAOptionally specifies the location into which the dataset should be saved. This can include datasetoptions. If omitted, the dataset is saved in the default library (either WORK, or the library named on theLIB= option on the PROC R invocation).
R or FRAMESpecifies the name of the R object to import. This must be in the form of an identifier, not a quotedstring literal. A name literal can be used here to specify a name that is not normally valid for an identifierin the language of SAS. This option is required.
IMPORT conversion rules
Any object can be imported that can be coerced into a data frame using the as.data.frame Rfunction.
If the specified R object cannot be coerced into a data frame then an error is produced. WPS can importcolumns that have the R logical, integer, real, and character types. In addition it can import factors.Columns with type logical, integer or real are converted into numeric columns in the WPS dataset.Columns of type character, and factors, are converted into string columns. The following notes providemore detail on these conversion rules.
Logical valuesThe values of vectors of type logical are converted as follows:
R Value WPS Value
TRUE 1
FALSE 0
NA .
Integer valuesThe special value NA in R, which is represented in R as the minimum integer value (-2147483648) isconverted to the language of SAS missing value.
Real valuesThere are three special real numeric values in the R language, NA, NaN, and Inf. In R, NA is used torepresent an absent value (Not Available), Inf denotes infinity (divide by zero for example), and NaNrepresents not-a-number (the result of 0/0 for example). These values are converted as follows:
Reference for language elementsVersion 3.3
1090
R Value WPS Value
NA .
NaN .
+Inf .I
-Inf .M
Date valuesInteger or real columns that have an R class of Date have special processing applied to them. Thevariable in the WPS dataset is given a format of DATE9 and when imported the values are adjustedto take account of the difference in the epoch used in R and WPS. Values of class Date in R arerepresented as a count of days since 1st Jan 1970, whereas, in the language of SAS, the epoch is 1stJan 1960.
Date-time valuesWPS will apply special handling to real columns that have class POSIXct. Values of this class in Rrepresent a count of seconds since 1st Jan 1970 in UTC. When columns of this class are imported, thevalues are adjusted to take account of the difference in epoch between SAS and R. The column in theWPS dataset is given the format DATETIME19. The values are also adjusted according to the value ofthe GMTOFFSET option on the PROC R invocation to take into account that the values in R are in UTC,whereas, in the language of SAS, datetime values are in local time.
Time valuesWPS will apply special handling to real columns that have class times. The column in the WPSdataset is given the format TIME8.
Character valuesWPS will scan the values in the character column to find the longest value, and will assign the lengthof the WPS column to that value. Individual values in a character column can be Not Available (NA) inR, and these will be converted to the missing character value in WPS (that is the value will consist of allblanks). There will be no difference therefore between the values " " and NA when imported into WPS.
Factor valuesA factor in R is a special form of integer column, where the values of the integer in the column areindexes into a list of unique values that is stored as an attribute on the column (these are called thelevels in R). When imported into WPS these are converted into character variables in the dataset. Thecolumn is given a length equal to the longest string in the levels list.
Reference for language elementsVersion 3.3
1091
An example of importing data from R to WPSproc r; submit; x<-sample(1:3, 15, replace=TRUE) endsubmit;import r=x data=demo_import;run;proc print data=demo_import;run;
LOADThe LOAD and SAVE statements allow R objects to be serialised and stored temporarily or permanentlyin a WPS data library and later deserialised in the same or a subsequent WPS session. The LOADstatement deserialises an R object that was previously saved with the SAVE statement.
LOAD { option … } ;
option[ [ CATALOG | CAT | C ] = [ libname . ] catalog . entry |
[ R | FRAME ] = r-object-name]
CATALOG or CAT or CGives the location in which the R object will be saved. This option is required. If the library isn't specifiedon the CATALOG option, then the default library is given by the LIB= option on the PROC R invocation,or otherwise, the USER or WORK library is used as normal.
R or FRAMEThe R object name can be specified using name literal syntax (for example, "r.object.name"n) ifthe name of the R object doesn't comply with the normal rules for identifiers in the language of SAS.The case of the name is preserved when creating the R object. This option is required.
An example of using the LOAD statementproc r; load cat=catalog.entry r='target.object'n;run;
Reference for language elementsVersion 3.3
1092
SAVEThe LOAD and SAVE statements allow R objects to be serialised and stored temporarily or permanentlyin a WPS data library and later deserialised in the same or a subsequent WPS session. The SAVEstatement serialises an R object and stores it in an entry in a catalog.
SAVE { option … } ;
option[ [ CATALOG | CAT | C ] = [ libname . ] catalog . entry |
[ R | FRAME ] = r-object-name |DESCRIPTION = "Catalog entry description"
]
CATALOG or CAT or CThis option, which is mandatory, gives the location in which the R object will be saved. If the libraryis not specified on the CATALOG option, then the default library is supplied by the LIB= option on thePROC R invocation : otherwise the USER or WORK library is used as normal.
R or FRAMESpecifies the name of the R object to save. This can be specified using name literal syntax (for example"r.object.name"n) if the name of the R object doesn’t comply with the normal rules for identifiers inthe SAS language. Since R is a case sensitive language, the case of the name must match that of theR object. This option is required.
DESCRIPTIONGives a description string that is saved in the catalog entry. This description will be displayed in theoutput from the PROC CATALOG CONTENTS statement.
Note:The catalog entry will have a type of ROBJECT.
An example of saving an R object to a WPS catalogproc r; save cat=catalog.entry r=’source.object’n;run;
Reference for language elementsVersion 3.3
1093
SUBMITThe SUBMIT statement for the R procedure allows in-line program code in the R language to beexecuted.
SUBMIT
[ { symbol = "substitution-value" … }] ; { R-language-statement … } ENDSUBMIT ;
Note:No changes to R program code are necessary. It is possible to copy and paste normal R languageprogram code, surround it with SUBMIT and ENDSUBMIT statements, and invoke it from within the Rprocedure.
The R source code must start on a new line after the SUBMIT statement, and the ENDSUBMITstatement must appear at the beginning of a line on its own.
Multiple SUBMIT blocks can exist within a single PROC R invocation. Each SUBMIT block is executed asit is encountered. SUBMIT blocks can be interleaved with other statements as required.
Macro processingThe nature of the R language means that the lines between the SUBMIT and ENDSUBMIT statementsare copied verbatim and passed to the R environment. Macro processing is suspended between theSUBMIT and ENDSUBMIT statements. There are a number of reasons why this is the case:
• The R language uses the & and % characters as part of its syntax. Attempting to macro process theR source code may result in legitimate R syntax being misinterpreted as language of SAS macroinvocations or macro variable wps-references.
• The R language allows line-end style comments, the contents of which may, for example, containunmatched apostrophes. This would make it difficult to tokenise the R syntax using the regularlanguage of SAS parsing rules, which is what would be necessary to allow macro processing of theR source code.
Also, due to the way the macro processor works and the way it handles source lines, it is not possibleto generate a SUBMIT block using a macro. That is, a SUBMIT block cannot appear within a languageof SAS macro. However, it is permitted that the SUBMIT block can appear in a file that is identifiedvia an %INCLUDE statement. So, if it is necessary to generate a PROC R, invocation with the macroprocessor, it is necessary to either use the EXECUTE statement or put the contents of the SUBMIT blockin a separate file that is then identified via an %INCLUDE statement.
Reference for language elementsVersion 3.3
1094
Text substitutionIn place of the macro processor, a simple text substitution facility is provided. Before being passedto R, the lines between SUBMIT and ENDSUBMIT can have a limited set of substitutions applied. Thesubstitutions are given on the SUBMIT statement. The syntax for the substitutions is similar to thatfor normal macro variable substitution. However, there is no rescanning, and only simple single-levelmacro variable style syntax is allowed.
&symbol&symbol.
Even with this simple syntax and only substituting symbols explicitly listed on the SUBMIT statement,it is possible that unintended substitutions may occur. To avoid this, it is recommended that symbolnames are chosen that are different from any R object names wps-referenced in the submitted R code.The ampersand symbol (& and &&) is used in R as the logical and operator. Consider the case of aSUBMIT statement containing the following R code:
a>b&c<d
If c is defined as a substitution symbol, this will result in the unintended substitution of c within thisexpression. Including space around the ampersand will prevent this, as will choosing the substitutionsymbol names so that they are less likely to clash with R object names.
There is no escape syntax and there is no way to prevent a symbol from being substituted. Considerthe following case:
proc r; submit Goodbye="hello"; A <- "Hello&Goodbye" endsubmit;run;
It is not possible to prevent substitution in this case, other than by choosing a different name for thesymbol: the ampersand is not a special symbol as it is used as a logical operator within R.
It is possible to generate substitution values using normal macro processor facilities, as in the followingexample:
proc r; submit Goodbye="hello"; A<-"&sym"endsubmit;run;
Example of submitting in-line R codeproc r; submit; x <- (1:10) print(x) endsubmit;run;
Reference for language elementsVersion 3.3
1095
RANK Procedure
Supported statements• PROC RANK• BY• RANKS• VAR• WHERE
PROC RANKPROC RANK [ { option … } ] ;
option[ DATA = dataset i |
[ DESCENDING | DESC ] |[ FRACTION | F ] |GROUPS = group count |NORMAL = [ BLOM | TUKEY | VW ] |[ NPLUS1 | FN1 | N1 ] |OUT = dataset ii |[ PERCENT | P ] |SAVAGE |TIES = [ DENSE | HIGH | LOW | MEAN ]
]
i See Input dataset.ii See Output dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
RANKSRANKS { variable-name … } ;
Reference for language elementsVersion 3.3
1096
VARVAR { variable-name … } ;
WHEREWHERE condition ;
RELEASE Procedure
Supported statements• PROC RELEASE
PROC RELEASEPROC RELEASE [ { option … } ] ;
option[ [ DDNAME | DD ] = [ DDname | "DSname" ] |
BOUNDARY =[ DATASET |
DSCB |CYLINDERS |CYLINDER |CYLS |CYL |TRACKS |TRACK |TRKS |TRK |ALLOC |DD |JCL
] ]
Reference for language elementsVersion 3.3
1097
REPORT Procedure
Supported statements• PROC REPORT• BREAK• BY• COLUMN• COMPUTE• DEFINE• FREQ• RBREAK• WEIGHT
PROC REPORTPROC REPORT [ { option … } ] ;
option[ BOX |
CENTER |COMPLETECOLS |COMPLETEROWS |DATA = data-set i |EXCLNPWGT |FORMCHAR
[ ( character positions )] = "formatting characters" |
HEADLINE |HEADSKIP |LIST |LS = line size |MISSING |NAMED |NOCENTER |NOCOMPLETECOLS |NOCOMPLETEROWS |NOEXEC |NOHEADER |NOTHREADS |
Reference for language elementsVersion 3.3
1098
NOWINDOWS |OUT = output-data-set-with-options ii |OUTREPT = catalog-entry |PS = page size |QMARKERS = number |QMETHOD = [ os | p2 | hist ] |QNTLDEF = number |REPORT = catalog-entry |REPLACE |SHOWALL |SPACING = number |SPLIT = " character " |THREADS |VARDEF = [ DF | N | WDF | WEIGHT | WGT ] |style
]
i See Input dataset.ii See Output dataset.
styleSTYLE
[ (
{ CALLDEF |COLUMN |HEADER |LINES |REPORT |SUMMARY
… } )] = [ element-name ] { { style-attribute-name = [ valid-value | "valid-string" ] … } }
BREAKBREAK [ | BEFORE | AFTER ] variable name
[ /
[ PAGE |SKIP |SUMMARIZE |SUPPRESS |STYLE
] ] ;
Reference for language elementsVersion 3.3
1099
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
COLUMNCOLUMN { [ variable-name | variable-list ] , … } ;
COMPUTECOMPUTE
[ |BEFORE variable-name |AFTER variable-name |variable-name
[ / [ CHAR | LENGTH = number ] ] |
CALL DEFINE
] [ STYLE ] ; { valid-data-step-statements … } ENDCOMPUTE;
DEFINEDEFINE variable-name
[ / option [ "Heading string literal" ]] ;
option[ ACROSS |
ANALYSIS |CENTER |COMPUTED |CSS |CV |DESCENDING |DISPLAY |EXCLUSIVE |FLOW |FORMAT = format |GROUP |
Reference for language elementsVersion 3.3
1100
ORDER =[ DATA |
EXTERNAL |FORMATTED |FREQ |INTERNAL
] |LEFT |MAX |MEAN |MEDIAN |MIN |MISSING |N |NMISS |NOPRINT |NOZERO |P1 |P5 |P10 |P25 |P50 |P75 |P90 |P95 |P99 |PAGE |PCTN |PCTSUM |PRELOADFMT |PRT |Q1 |Q3 |QRANGE |RANGE |RIGHT |SPACING = number |STD |STDERR |STYLE |SUM |SUMWGT |T |USS |VAR |WEIGHT = variable-name |
Reference for language elementsVersion 3.3
1101
WIDTH = number]
FREQFREQ variable-name ;
RBREAKRBREAK [ | BEFORE | AFTER ] variable-name
[ /
[ PAGE |SKIP |STYLE |SUMMARIZE
] ] ;
WEIGHTWEIGHT variable-name ;
SOAP Procedure
Supported statements• PROC SOAP
PROC SOAPPROC SOAP URL = soap-url [ { option … } ] ;
option[ IN = file-ref |
OUT = file-ref |ENVELOPE |
Reference for language elementsVersion 3.3
1102
MUSTUNDERSTAND |PROXYPASSWORD = proxy-password |PROXYPORT = proxy-port |WEBPASSWORD = http-auth-password |WSSPASSWORD = wss-password |SOAPACTION = soap-action |PROXYHOST = proxy-host |PROXYUSERNAME = proxy-username |WEBDOMAIN = ntlm-auth-domain |WEBUSERNAME = http-auth-username |WSSUSERNAME = wss-username
]
SORT Procedure
Supported statements• PROC SORT• BY• WHERE
PROC SORTPROC SORT [ { option … } ] ;
option[ DATA = input-data-set-with-options i |
ASCII |DANISH |EBCDIC |[ EQUALS | EQ | NOEQUALS | NOEQ ] |FINNISH |FORCE |ITALIAN |NATIONAL |[ NODUPKEY | NODUPKEYS ] |
[ NODUP |NODUPS |NODUPREC |NODUPRECS |NODUPLICATES
Reference for language elementsVersion 3.3
1103
] |NORWEGIAN |OUT = output-data-set-with-options ii |DUPOUT = output-data-set-with-options iii |REVERSE |SORTSIZE =
[ integer |integer K |integer M |integer G
] |SORTSEQ =
[ ascii |danish |ebcdic |finnish |italian |national |norwegian |reverse |spanish |swedish |user-sortseq
] |SPANISH |SWEDISH |TAGSORT |[ THREADS | NOTHREADS ]
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
WHEREWHERE condition ;
Reference for language elementsVersion 3.3
1104
SOURCE Procedure
Supported statements• PROC SOURCE• SELECT• EXCLUDE• FIRST• LAST• AFTER• BEFORE
PROC SOURCEPROC SOURCE [ { option … } ] ;
option[ DIRDD = DDName |
INDD = DDName |OUTDD = DDName |NOALIAS |NODATA |PRINT |NOPRINT |NOSUMMARY |NOTSORTED |PAGE
]
SELECTSELECT name [ : ] [ | - | name [ : ] ] ;
EXCLUDEEXCLUDE name [ : ] [ | - | name [ : ] ] ;
Reference for language elementsVersion 3.3
1105
FIRSTFIRST string-literal ;
LASTLAST string-literal ;
AFTERAFTER string-literal
[ |ALIAS |integer |NOBLANK |RIGHT
] ;
BEFOREBEFORE string-literal
[ |ALIAS |integer |NOBLANK |RIGHT
] ;
SQL Procedure
Supported statements• PROC SQL• ALTER• CONNECT• CREATE INDEX• CREATE TABLE
Reference for language elementsVersion 3.3
1106
• CREATE VIEW• DELETE• DESCRIBE• DISCONNECT• DROP• EXECUTE• INSERT• RESET• SELECT• UPDATE• VALIDATE
PROC SQL
PROC SQL [ { options i … } ] ;
i See PROC SQL options.
ALTERALTER TABLE table-name { command … } ;
command[ ADD { column definition i, … } |
DROP { column name ii, … } |MODIFY { column definition iii, … }
] ;
i See Column Definition.ii See Column Name.iii See Column Definition.
CONNECTCONNECT TO dbms-name [ AS dbms-alias ] [ ( dbms-options ) ] ;
Reference for language elementsVersion 3.3
1107
CREATE INDEX
CREATE [ UNIQUE ] INDEX index-name ON table-name ( { column name i, … } );
i See Column Name.
CREATE TABLECREATE TABLE table-name command ;
command[ ( { column definition i, … } ) |
LIKE table-name2 |AS query expression ii[ ORDER BY expression ] iii
] ;
i See Column Definition.ii See Query expression.iii See ORDER BY expression.
CREATE VIEW
CREATE VIEW proc-sql-view AS query expression i[ ORDER BY expression ] ii[ USING{ libname , … } ] ;
i See Query expression.ii See ORDER BY expression.
DELETE
DELETE FROM table-name [ AS alias ] [ WHERE SQL expression i ] ;
i See SQL expression.
DESCRIBEDESCRIBE
[ TABLE { table-name , … } |VIEW { view-name , … }
] ;
Reference for language elementsVersion 3.3
1108
DISCONNECTDISCONNECT FROM [ dbms-name | dbms-alias ] ;
DROPDROP
[ TABLE { table-name , … } |VIEW { view-name , … } |INDEX { index-name , … } FROM table-name
] ;
EXECUTEEXECUTE ( sql-command-string )BY [ dbms-name | dbms-alias ] ;
INSERTINSERT INTO table-name
[ ( { column name i, … } )] command ;
i See Column Name.
command[ { SET { column name ii= SQL expression iii, … } … } |
{ VALUES ( { constant-value , … } ) … } |query expressioniv
]
ii See Column Name.iii See SQL expression.iv See Query expression.
Reference for language elementsVersion 3.3
1109
RESET
SELECT
SELECT [ DISTINCT ] SELECT expression i[ FROM expression ] ii[ INTO expression ] iii[ WHERE SQL expression iv ] [ GROUP BY expression ] v[ HAVING SQL expression vi ] [ ORDER BY expression ] vii;
i See SELECT expression.ii See FROM expression.iii See INTO expression.iv See SQL expression.v
See GROUP BY expression.vi See SQL expression.vii See ORDER BY expression.
UPDATE
UPDATE table-name [ AS table-alias ] SET { set-expression, … } WHERE SQL expression i;
i See SQL expression.
set-expressioncolumn name ii= SQL expression iii
ii See Column Name.iii See SQL expression.
VALIDATE
VALIDATE query expression i
i See Query expression.
Component Dictionary
PROC SQL options
[ BUFFERSIZE = [ n | nK | nM | nG ] |[ CONSTDATETIME | NOCONSTDATETIME ] |[ DOUBLE | NODOUBLE ] |
Reference for language elementsVersion 3.3
1110
[ ERRORSTOP | NOERRORSTOP ] |[ EXEC | NOEXEC ] |[ FEEDBACK | NOFEEDBACK ] |INOBS = n |[ IPASSTHRU | NOIPASSTHRU ] |LOOPS = n |[ NUMBER | NONUMBER ] |OUTOBS = n |[ PRINT | NOPRINT ] |[ REMERGE | NOREMERGE ] |[ SORTMSG | NOSORTMSG ] |SORTSEQ =
[ "ascii" |"ebcdic" |"danish" |"finnish" |"italian" |"norwegian" |"spanish" |"swedish" |"national" |"reverse"
] |[ STIMER | NOSTIMER ] |[ THREADS | NOTHREADS ]
]
Conditions
ALL condition
SQL expression irelational expression iiALL ( query expression iii)
i See SQL expression.ii See Relational expression.iii See Query expression.
ANY condition
SQL expression irelational expression iiANY ( query expression iii)
i See SQL expression.ii See Relational expression.iii See Query expression.
Reference for language elementsVersion 3.3
1111
BETWEEN condition
[ NOT ] BETWEEN SQL expression iAND SQL expression ii
i See SQL expression.ii See SQL expression.
BTRIM condition
( [ LEADING | TRAILING | BOTH ] single-char-value [ FROM SQL expression i ] )
i See SQL expression.
CALCULATED condition
CALCULATED SQL expression i
i See SQL expression.
CONTAINS condition
SQL expression i[ NOT ] CONTAINS SQL expression ii
i See SQL expression.ii See SQL expression.
EXISTS condition
SQL expression i[ NOT ] EXISTS ( query expression ii)
i See SQL expression.ii See Query expression.
IN condition
[ NOT ] IN ([ { constant , … } |
query expressioni
] )
Reference for language elementsVersion 3.3
1112
i See Query expression.
IS condition
SQL expression iIS [ NOT ] [ NULL | MISSING ]
i See SQL expression.
LIKE condition
SQL expression i[ NOT ] LIKE SQL expression ii
i See SQL expression.ii See SQL expression.
Expressions
CASE expression
CASE [ operand ] { WHEN SQL expression iTHEN SQL expression ii … } [ ELSE SQLexpression iii ] END
i See SQL expression.ii See SQL expression.iii See SQL expression.
SELECT expression
{ item, … }
Reference for language elementsVersion 3.3
1113
item[ * |
column name i[ AS alias ] |table-name .* |table-alias .* |view-name .* |view-alias .* |SQL expression ii[ AS alias ] [ { column modifier iii … } ] |CASE expressioniv
]
i See Column Name.ii See SQL expression.iii See Column Modifier.iv See CASE expression.
FROM expression
FROM [ integer | column namei | SQL expressionii ] { table-name [ AS alias ] |
view-name [ AS alias ] |( query expression iii[ [ AS ] alias [ ( { column , … } ) ] ] ) |joined tableiv |connection tov
… }
i See Column Name.ii See SQL expression.iii See Query expression.iv See Joined Table.v SeeCONNECTION-TO.
INTO expression
INTO { macro-variable-specification, … }
macro-variable-specification[ : macro-variable
[ SEPARATED BY "char" [ NOTRIM ]] |
: macro-variable-a - : macro-variable-n [ NOTRIM ]]
Reference for language elementsVersion 3.3
1114
GROUP BY expression
GROUP BY
{ integer |column namei |SQL expressionii
,… }
i See Column Name.ii See SQL expression.
ORDER BY expression
ORDER BY { item, … }
item[ integer | column namei | SQL expressionii ] [ | ASC | DESC ]
i See Column Name.ii See SQL expression.
Relational expression
conditional-expression { [ < | LT | <= | LE | = | EQ | >= | GE | > | GT | ¬= | NE | <> ] conditional-expression … }
conditional-expressionconcat-expression
[ [ NOT ] BETWEEN concat-expression AND concat-expression |IS [ NOT ] NULL |IS [ NOT ] MISSING |LIKE concat-expression |[ ? | CONTAINS ] concat-expression |=* concat-expression |IN ( { concat-expression, … } )
]
concat-expression{ multiplicative-expression { [ + | - ] multiplicative-expression … } || … }
Reference for language elementsVersion 3.3
1115
multiplicative-expressionpower-expression { [ * | / ] power-expression … }
power-expression[ + | - ] primary-expression { ** power-expression … }
primary-expression[ constant |
column namei |[ CALCULATED ] expression-alias |( SQL expression ii)
]
i See Column Name.ii See SQL expression.
Query expression
table expression i
[ { [ EXCEPT |
INTERSECT |OUTER UNION |UNION
] [ | CORRESPONDING | ALL ] table expression ii … }]
i See TABLE expression.ii See TABLE expression.
SQL expression
[ | ^ | ~ | not ] or-expression
or-expressionand-expression { [ | | ! | OR ] and-expression … }
and-expressionrelational expression i{ [ & | AND ] relational expression ii … }
Reference for language elementsVersion 3.3
1116
i See Relational expression.ii See Relational expression.
Functions
LOWER function
LOWER ( SQL expression i)
i See SQL expression.
SUBSTRING function
SQL expression iSUBSTRING ( SQL expression ii)
i See SQL expression.ii See SQL expression.
SUMMARY function
[ [ AVG | MEAN ] |[ COUNT | FREQ | N ] |CSS |CV |MAX |MEDIAN |MIN |NMISS |PRT |RANGE |STD |STDERR |SUM |SUMWGT |T |USS |VAR
] ( [ | DISTINCT | ALL ] SQL expression i)
i See SQL expression.
Reference for language elementsVersion 3.3
1117
UPPER function
UPPER ( SQL expression i)
i See SQL expression.
Tables
DICTIONARY tables
DICTIONARY .[ CATALOGS |
COLUMNS |DICTIONARIES |EXTFILES |INDEXES |LIBNAMES |MACROS |MEMBERS |OPTIONS |TABLES |TITLES |VIEWS
]
Column Definition
column[ [ CHARACTER | VARCHAR ] [ ( column-width ) ] |
[ INTEGER | SMALLINT ] |[ DECIMAL | FLOAT | NUMERIC ]
[ ( column-width [ , number-of-decimals ] )] |
[ DOUBLE PRECISION | REAL ] |DATE
] [ { column modifier i … } ]
i See Column Modifier.
Reference for language elementsVersion 3.3
1118
Column Modifier
[ INFORMAT = informat w.d |FORMAT = format w.d |LABEL = "label" |LENGTH = length
]
Column Name
[ column |table-name.column |table-alias.column |view-name.column |view-alias.column
]
Joined Table
{ table-name [ AS alias ] , … }[ [ NATURAL ] [ INNER ] |
[ MATCH | SPRINGFIELD ] |[ NATURAL ] [ LEFT | RIGHT | FULL ] [ OUTER ] |UNION
] JOIN table-name ON SQL expression i
i See SQL expression.
TABLE expression
SELECT [ DISTINCT ] SELECT expression i[ INTO expression ] iiFROM expression iii[ WHERESQL expression iv ] [ GROUP BY expression ] v[ HAVING SQL expression vi ]
i See SELECT expression.ii See INTO expression.iii See FROM expression.iv See SQL expression.v
See GROUP BY expression.vi See SQL expression.
Reference for language elementsVersion 3.3
1119
Connections
CONNECTION-TO
CONNECTION-TO [ dbms-name | alias ] ( dbms-query )
STANDARD Procedure
Supported statements• PROC STANDARD• BY• FREQ• VAR• WEIGHT
PROC STANDARDPROC STANDARD [ { option … } ] ;
option[ DATA = data-set i |
EXCLNPWGT |MEAN = meanvalue |NOPRINT |OUT = output-data-set-with-options ii |PRINT |REPLACE |STD = stdvalue |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
i See Input dataset.ii See Output dataset.
Reference for language elementsVersion 3.3
1120
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
FREQFREQ variable-name ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
SUMMARY Procedure
Supported statements• PROC SUMMARY• BY• CLASS• FREQ• ID• OUTPUT• TYPES• VAR• WAYS• WEIGHT• WHERE
Reference for language elementsVersion 3.3
1121
Statistic keywordsThe following keywords are used within several statements of this procedure.
[ CSS |CLM |CV |KURTOSIS |LCLM |MAX |MEAN |MIN |N |NMISS |P1 |P5 |P10 |[ P25 | Q1 ] |[ P50 | MEDIAN ] |[ P75 | Q3 ] |P90 |P95 |P99 |[ PROBT | PRT ] |QRANGE |RANGE |SKEW |[ STD | STDEV ] |STDERR |SUM |SUMWGT |T |UCLM |USS |VAR
]
PROC SUMMARY
PROC SUMMARY [ { option … } ] [ { statistic-keyword i … } ] ;
i See Statistic keywords.
Reference for language elementsVersion 3.3
1122
option[ ALPHA = value |
CHARTYPE |COMPLETETYPES |DATA = data-set ii |EXCLNPWGTS |FW = width |IDMIN |MAXDEC = decimals |MISSING |NONOBS |NWAY |ORDER =
[ DATA |FORMATTED |FREQ |UNFORMATTED
] |PCTLDEF |[ PRINT | NOPRINT ] |[ PRINTALL | PRINTALLTYPES ] |QMARKERS = marker count |QMETHOD =
[ OS |[ P2 | HIST ]
] |QNTLDEF = [ 1 | 2 | 3 | 4 | 5 ] |SUMSIZE = memory amount |[ THREADS | NOTHREADS ] |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
ii See Input dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable-name … } [ / { option … } ] ;
Reference for language elementsVersion 3.3
1123
option[ [ ASCEND | ASCENDING ] |
[ DESCEND | DESCENDING ] |EXCLUSIVE |GROUPINTERNAL |MISSING |MLF |ORDER =
[ DATA |FORMATTED |FMT |FREQ |UNFORMATTED
] |PREFLOADFMT
]
FREQFREQ variable-name ;
IDID { variable-name … } ;
OUTPUT
OUTPUT [ OUT = output-data-set i ][ { output-statistic-specification … }] [ / [ { option … } ] ] ;
i See Output dataset.
output-statistic-specificationstatistic-keyword ii
[ ( { input-variable-name … } )] = [ { output-name … } ]
ii See Statistic keywords.
Reference for language elementsVersion 3.3
1124
option[ AUTOLABEL |
AUTONAME |KEEPLEN |LEVELS |NOINHERIT |WAYS
]
TYPESTYPES type-list ;
type-list{
{ variable |( type-list )
*… } … }
VARVAR { variable-name … }
[ / WEIGHT = variable-name] ;
WAYSWAYS ;
WEIGHTWEIGHT variable-name ;
Reference for language elementsVersion 3.3
1125
WHEREWHERE condition ;
TABULATE Procedure
Supported statements• PROC TABULATE• BY• CLASS• CLASSLEV• FREQ• KEYLABEL• KEYWORD• TABLE• VAR• WEIGHT• WHERE
PROC TABULATEPROC TABULATE [ { option … } ] ;
option[ DATA = data-set i |
EXCLNPWGTS |FORMAT = format |FORMCHAR
[ ( character positions )] = "formatting characters" |
MISSING |NOSEPS |ORDER =
[ DATA |EXTERNAL |FORMATTED |FMT |
Reference for language elementsVersion 3.3
1126
INTERNAL |UNFORMATTED |UNFMT
] |OUT = output-data-set ii |VARDEF = [ DF | N | WDF | WEIGHT | WGT ] |STYLE
]
i See Input dataset.ii See Output dataset.
style - when used at the PROC TABULATE levelSTYLE = [ element-name ] { { style-attribute-name = [ valid-value | "valid-string" ] … } }
style - when used in a PROC TABULATE optionSTYLE = [ element-name ] { { style-attribute-name = [ <PARENT> ] [ | valid-value | "valid-
string" ] … } }
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable-name … }
[ / { MLF | PREFLOADFMT | STYLE … } ] ;
CLASSLEVCLASSLEV { variable-name … } [ / STYLE ] ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1127
KEYLABELKEYLABEL { keyword = "description" … } ;
KEYWORDKEYWORD { variable-name … } [ / STYLE ] ;
TABLETABLE
[ [ page-expression [ * style ] ,] row-expression [ * style ] ,
] column-expression [ * style ] [ / [ { option … } ] ] ;
option[ BOX = [ _PAGE_ | "string" | variable ] [ * style ] |
CONDENSE |FUZZ = tolerance |INDENT = nested-heading-indent |MISSTEXT = "text" [ * style ] |STYLE |PRINTMISS |ROW = [ CONSTANT | CONST ] |[ RTSPACE | RTS ] = space
]
VARVAR { variable-name … }
[ / WEIGHT = variable-name] ;
WEIGHTWEIGHT variable-name ;
Reference for language elementsVersion 3.3
1128
WHEREWHERE condition ;
TEMPLATE Procedure
Supported statements• PROC TEMPLATE• DELETE• LINK• LIST• PATH• SOURCE• DEFINE STYLE• DEFINE TAGSET
PROC TEMPLATEPROC TEMPLATE ;
DELETEDELETE item [ / STORE member.name ] ;
LINKLINK item-1 TO item-2
[ / { NOTES = "text" | STORE member.name … } ] ;
Reference for language elementsVersion 3.3
1129
LISTLIST [ path ]
[ /
{ sort |stats |STORE member.name |WHERE keyword where-expression
… } ] ;
sortSORT =
[ CREATED |NOTES |LINK |PATH |SIZE |TYPE
] [ | ASCENDING | DESCENDING ]
statsSTATS =
[ ALL |{ CREATED | NOTES | LINK | SIZE … }
]
keyword[ [ path |
_path_ |name |_name_ |template |_template_
] |[ type | _type_ ] |[ notes | label ] |size |created |[ cdate | _cdate_ ] |[ cdatetime | _cdatetime_ ] |[ ctime | _ctime_ ] |[ mdate | _mdate_ ] |
Reference for language elementsVersion 3.3
1130
[ mdatetime | _mdatetime_ ] |modified |[ mtime | _mtime_ ]
]
PATHPATH [ [ instruction ] member.name [ mode ] | option ] ;
instruction( [ APPEND | PREPEND | REMOVE ] )
mode( [ READ | UPDATE | WRITE ] )
option[ RESET | SHOW | VERIFY ]
SOURCESOURCE path
[ / STORE member.name WHERE keyword where-expression] ;
keyword[ [ path |
_path_ |name |_name_ |template |_template_
] |[ type | _type_ ] |[ notes | label ] |size |created |[ cdate | _cdate_ ] |[ cdatetime | _cdatetime_ ] |[ ctime | _ctime_ ] |
Reference for language elementsVersion 3.3
1131
[ mdate | _mdate_ ] |[ mdatetime | _mdatetime_ ] |modified |[ mtime | _mtime_ ]
]
DEFINE STYLEDEFINE STYLE path [ / STORE member.name ] ;
[ NOTES "text" ;PARENT = path ;] { class | replace | style … } END ;
classCLASS { style-element-name , … } [ "notes" ] [ / { style-attribute … } ] ;
replaceREPLACE style-element-name
[ FROM style-element-name] [ "notes" ] [ / { style-attribute … } ] ;
styleSTYLE { style-element-name , … }
[ FROM [ style-element-name | _SELF_ ] ] [ "notes" ] [ / { style-attribute … } ] ;
style-attribute[ attribute-name | "user-defined-name" ] = [ | ] value
DEFINE TAGSETDEFINE TAGSET path [ / STORE member.name ] ;[ NOTES "text" ; ]
{ |tagset-attribute-name = value |
[ event-attribute-name = value ; |[ [ START: | FINISH: ] |
statement]
] … } END ;
Reference for language elementsVersion 3.3
1132
statement[ BLOCK event-name |
BREAK |CLOSE |CONTINUE |DELSTREAM $$varname |do-statement |EVAL indexvarname condition-where-expression |FLUSH |ITERATE tagset-indexvariable |NDENT |NEXT tagset-indexvariable |OPEN $$varname |put-statement |putl-statement |putlog-statement |putq-statement |PUTSTREAM $$varname |putvars-statement |set-statement |STOP |trigger-statement |UNBLOCK event-name |unset-statement |XDENT
] [ / statement-condition ] ;
do-statementdo-block [ { else-block … } ] DONE ;
do-blockDO
[ / [ | ! | IF | WHEN | WHERE | WHILE ] condition-where-expression] ; { statement … }
else-blockELSE
[ / [ | ! | IF | WHEN | WHERE ] condition-where-expression] ; { statement … }
Reference for language elementsVersion 3.3
1133
put-statement{ NL |
string |datastep-function |indexvarname |$$varname
… }
putl-statement{ NL |
string |datastep-function |indexvarname |$$varname
… }
putlog-statement{ string |
datastep-function |indexvarname |$$varname
… }
putq-statement{ NL |
string |datastep-function |indexvarname |$$varname
… }
putvars-statementPUTVARS
[ indexvarname |EVENT |STYLE |MEM |MEMORY |STREAM |[ | NL | string ]
]
Reference for language elementsVersion 3.3
1134
set-statementSET indexvarname [ string | datastep-function | indexvarname ]
trigger-statementEVENT event-name [ | START | FINISH ]
unset-statementUNSET [ ALL | $varname | $$varname ]
statement-condition[ | ! | IF | BREAKIF | WHEN | WHERE ] condition-where-expression
condition-where-expression[ ANY ( { $varname , … } ) |
CMP ( [ "string" | $varname ] , $varname ) |CONTAINS ( { $varname , … } ) |EXIST ( $varname ) |EXISTS ( { $varname , … } ) |where-expression
]
tagset-indexvariable$varname [ [ integer | string ] ]
indexvarname$varname
[ [ [ integer | string | indexvarname ] ]]
TRANSPOSE Procedure
Supported statements• PROC TRANSPOSE• BY• COPY• ID
Reference for language elementsVersion 3.3
1135
• IDLABEL• VAR• WHERE
PROC TRANSPOSEPROC TRANSPOSE [ { option … } ] ;
option[ DATA = input-data-set-with-options i |
LABEL = "label" |NAME = name |OUT = output-data-set-with-options ii |PREFIX = name
]
i See Input dataset.ii See Output dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
COPYCOPY { variable … } ;
IDID variable ;
IDLABELIDLABEL variable ;
Reference for language elementsVersion 3.3
1136
VARVAR { variable-name … } ;
WHEREWHERE condition ;
TRANTAB Procedure
Supported statements• PROC TRANTAB• CLEAR• INVERSE• LIST• LOAD• REPLACE• SAVE• SWAP
PROC TRANTABPROC TRANTAB [ TABLE | TAB ] =
[ table-name |SASCCL |SASLCL |SASLCS |SASUCS |SASXPT
] [ NLS ] ;
CLEARCLEAR [ | ONE | TWO | BOTH ] ;
Reference for language elementsVersion 3.3
1137
INVERSEINVERSE ;
LISTLIST [ | ONE | TWO | BOTH ] ;
LOADLOAD [ TABLE | TAB ] = table-name NLS ;
REPLACEREPLACE [ position | "char-to-replace" ]
{ decimal-value |"character-string" |"hexadecimal-string"x
… } ;
SAVESAVE [ TABLE | TAB ] = table-name [ | ONE | TWO | BOTH ] ;
SWAPSWAP ;
UNIVARIATE Procedure
Supported statements• PROC UNIVARIATE• BY
Reference for language elementsVersion 3.3
1138
• CDFPLOT• CLASS• FREQ• HISTOGRAM• ID• OUTPUT• PPPLOT• PROBPLOT• QQPLOT• VAR• WEIGHT• WHERE
PROC UNIVARIATEPROC UNIVARIATE [ { option … } ] ;
type-alpha-option[ (
{ TYPE = [ LOWER | UPPER | TWOSIDED ] |ALPHA= = value
… } )]
option[ DATA = data-set i |
EXCLNPWGT |NEXTROBS = n |NOPRINT |PCTLDEF = [ 1 | 2 | 3 | 4 | 5 ] |VARDEF = [ DF | N | WDF | WEIGHT | WGT ] |ALL |ALPHA = value |CIBASIC type-alpha-option |[ CIPCTLDF | CIQUANTDF ] type-alpha-option |[ CIPCTLNORMAL | CIQUANTNORMAL ] type-alpha-option |FREQ |LOCCOUNT |[ MODES | MODE ] |
Reference for language elementsVersion 3.3
1139
[ MU0 | LOCATION ] = { value … } |NEXTRVAL = { n … } |NOBYPLOT |[ NORMAL | NORMALTEST ] |OUTTABLE = output-data-set ii |[ PLOT | PLOTS ] |ROBUSTSCALE |ROUND = { value … } |[ TRIMMED | TRIM ] type-alpha-option |[ WINSORIZED | WINSOR ] type-alpha-option
]
i See Input dataset.ii See Output dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CDFPLOT{ variable-name … } [ / { option … } ] ;
value_or_test[ EST | value ]
option[ dist-options | other-options ]
alpha_opt[ ALPHA | A ] = value_or_test
alphadelta_optALPHADELTA = value
alphainitial_optALPHAINITIAL = value
Reference for language elementsVersion 3.3
1140
maxiter_optMAXITER = value
beta_opt[ BETA | B ] = value_or_test
mu_optMU = value_or_test
sigma_optSIGMA = value_or_test
theta_opt[ THETA | THRESHOLD ] = value_or_test
thetaconstant_opt[ THETA | THRESHOLD ] = value
lambda_optLAMBDA = value_or_test
zeta_optZETA = value_or_test
scale_optSCALE = value_or_test
shape_optSHAPE = value_or_test
c_optC = value_or_test
cdelta_optCDELTA = value
Reference for language elementsVersion 3.3
1141
cinitial_optCINITIAL = value
dist-options[ BETA (
{ alpha_opt |beta_opt |sigma_opt |theta_opt |scale_opt
… } ) |[ EXPONENTIAL | EXP ] (
{ sigma_opt |theta_opt |scale_opt
… } ) |GAMMA (
{ alpha_opt |alphadelta_opt |alphainitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt
… } ) |GUMBEL ( { mu_opt | sigma_opt … } ) |IGAUSS ( { mu_opt | lambda_opt … } ) |LOGNORMAL (
{ sigma_opt |theta_opt |zeta_opt |shape_opt
… } ) |NORMAL ( { mu_opt | sigma_opt … } ) |PARETO (
{ alpha_opt |sigma_opt |theta_opt
… } ) |POWER (
{ alpha_opt |sigma_opt |theta_opt
… } ) |RAYLEIGH ( { sigma_opt | theta_opt … } ) |
Reference for language elementsVersion 3.3
1142
WEIBULL ({ c_opt |
cdelta_opt |cinitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt
… } ) |other-options
]
other-options{ NOECDF |
NOHLABEL |NOVLABEL |NOVTICK |OVERLAY |HREF = { value … } |[ HREFLABELS | HREFLABEL | HREFLAB ] = { "label" … } |HREFLABPOS = [ 1 | 2 | 3 | 4 ] |VREF = { value … } |[ VREFLABELS | VREFLABEL | VREFLAB ] = { "label" … } |VREFLABPOS = [ 1 | 2 | 3 | 4 ]
… }
CLASSCLASS variable-name-1 [ variable-name-2 ] ;
FREQFREQ variable-name ;
HISTOGRAM{ variable-name … } [ / { option … } ] ;
Reference for language elementsVersion 3.3
1143
value_or_test[ EST | value ]
optiondist-options
alpha_opt[ ALPHA | A ] = value_or_test
alphadelta_optALPHADELTA = value
alphainitial_optALPHAINITIAL = value
maxiter_optMAXITER = value
beta_opt[ BETA | B ] = value_or_test
mu_optMU = value_or_test
sigma_optSIGMA = value_or_test
theta_opt[ THETA | THRESHOLD ] = value_or_test
thetaconstant_opt[ THETA | THRESHOLD ] = value
lambda_optLAMBDA = value_or_test
Reference for language elementsVersion 3.3
1144
zeta_optZETA = value_or_test
scale_optSCALE = value_or_test
shape_optSHAPE = value_or_test
c_optC = value_or_test
cdelta_optCDELTA = value
cinitial_optCINITIAL = value
fittolerance_optFITTOLERANCE = value
johnson_fitmethodFITMETHOD = [ PERCENTILE | MLE | MOMENTS ]
histogram_distribution_common_opts[ MIDPERCENTS |
NOPRINT |[ PERCENTS | PERCENT ] = { percentile … }
]
edf_opts[ EDFNSAMPLES = value | EDFSEED = seed ]
Reference for language elementsVersion 3.3
1145
value-list[ { value … } |
value |value TO value [ BY value ]
]
gamma_optGAMMA = value_or_test
dist-options[ BETA (
{ alpha_opt |beta_opt |sigma_opt |theta_opt |histogram_distribution_common_opts |scale_opt
… } ) |[ EXPONENTIAL | EXP ] (
{ sigma_opt |theta_opt |histogram_distribution_common_opts |scale_opt
… } ) |GAMMA (
{ alpha_opt |alphadelta_opt |alphainitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt |histogram_distribution_common_opts
… } ) |GUMBEL (
{ mu_opt |sigma_opt |edf_opts |histogram_distribution_common_opts
… } ) |IGAUSS (
{ mu_opt |lambda_opt |histogram_distribution_common_opts
Reference for language elementsVersion 3.3
1146
… } ) |LOGNORMAL (
{ sigma_opt |theta_opt |zeta_opt |shape_opt |histogram_distribution_common_opts
… } ) |NORMAL (
{ mu_opt |sigma_opt |histogram_distribution_common_opts
… } ) |PARETO (
{ alpha_opt |sigma_opt |theta_opt |edf_opts |histogram_distribution_common_opts
… } ) |POWER (
{ alpha_opt |sigma_opt |theta_opt |histogram_distribution_common_opts
… } ) |RAYLEIGH (
{ sigma_opt |theta_opt |edf_opts |histogram_distribution_common_opts
… } ) |SB (
{ cdelta_opt |johnson_fitmethod |fittolerance_opt |gamma_opt |sigma_opt |theta_opt |scale_opt |histogram_distribution_common_opts
… } ) |SU (
{ cdelta_opt |johnson_fitmethod |fittolerance_opt |
Reference for language elementsVersion 3.3
1147
gamma_opt |sigma_opt |theta_opt |histogram_distribution_common_opts
… } ) |WEIBULL (
{ c_opt |cdelta_opt |cinitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt |histogram_distribution_common_opts
… } ) |KERNEL (
{ c_opt |K = [ NORMAL | QUADRATIC | TRIANGULAR ] |LOWER = { value … } |UPPER = { value … }
… } ) |other-options
]
other-options{
[ NOHLABEL |NOVLABEL |NOVTICK |OVERLAY |HREF = { value … } |[ HREFLABELS | HREFLABEL | HREFLAB ] = { "label" … } |HREFLABPOS = [ 1 | 2 | 3 | 4 ] |VREF = { value … } |[ VREFLABELS | VREFLABEL | VREFLAB ] = { "label" … } |VREFLABPOS = [ 1 | 2 | 3 | 4 ]
] ENDPOINTS = value-listGRID [ HANGING | HANG ] MIDPOINTS = value-listNENDPOINTS =n NMIDPOINTS = n [ NOPLOT | NOCHART ] RTINCLUDE VAXISLABEL = "label" MIDPERCENTS[ OUTHISTOGRAM | OUTHIST ] = output-data-set iOUTKERNEL = output-data-set ii …}
i See Output dataset.ii See Output dataset.
Reference for language elementsVersion 3.3
1148
IDID { variable-name … } ;
OUTPUT
OUTPUT [ OUT = output-data-set i ][ { statistic-keyword = { name … } … }] [ percentile_definition ] ;
i See Output dataset.
percentile definition[ PCTLPTS = percentiles { [ , ] percentiles … } |
PCTLPRE = { name … } |PCTLNAME = { name … }
]
percentiles[ percentile |
start percentile TO end percentile [ BY increment ]]
statistic-keyword[ CSS |
CV |GINI |KURTOSIS |MAD |MAX |MEAN |MEDIAN |MIN |MODE |MSIGN |N |NMISS |NOBS |P10 |P1 |P5 |
Reference for language elementsVersion 3.3
1149
P90 |P95 |P99 |PCTLNAME |PCTLPRE |PCTLPTS |PROBM |PROBS |PROBT |Q1 |Q3 |QN |QRANGE |RANGE |SIGNRANK |SKEWNESS |SN |STD_GINI |STD |STD_MAD |STDMEAN |STD_QN |STD_SN |SUM |SUMWGT |T |USS |VAR
]
PPPLOT{ variable-name … } [ / { option … } ] ;
histogram_distribution_common_optsNOLINE
value_or_test[ EST | value ]
option[ dist-options | other-options ]
Reference for language elementsVersion 3.3
1150
alpha_opt[ ALPHA | A ] = value_or_test
alphadelta_optALPHADELTA = value
alphainitial_optALPHAINITIAL = value
maxiter_optMAXITER = value
beta_opt[ BETA | B ] = value_or_test
mu_optMU = value_or_test
sigma_optSIGMA = value_or_test
theta_opt[ THETA | THRESHOLD ] = value_or_test
thetaconstant_opt[ THETA | THRESHOLD ] = value
lambda_optLAMBDA = value_or_test
zeta_optZETA = value_or_test
scale_optSCALE = value_or_test
Reference for language elementsVersion 3.3
1151
shape_optSHAPE = value_or_test
c_optC = value_or_test
cdelta_optCDELTA = value
cinitial_optCINITIAL = value
dist-options[ BETA (
{ alpha_opt |beta_opt |sigma_opt |theta_opt |scale_opt
… } ) |[ EXPONENTIAL | EXP ] (
{ sigma_opt |theta_opt |scale_opt
… } ) |GAMMA (
{ alpha_opt |alphadelta_opt |alphainitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt
… } ) |GUMBEL ( { mu_opt | sigma_opt … } ) |IGAUSS ( { mu_opt | lambda_opt … } ) |LOGNORMAL (
{ sigma_opt |theta_opt |zeta_opt |shape_opt
… } ) |
Reference for language elementsVersion 3.3
1152
NORMAL ( { mu_opt | sigma_opt … } ) |PARETO (
{ alpha_opt |sigma_opt |theta_opt
… } ) |POWER (
{ alpha_opt |sigma_opt |theta_opt
… } ) |RAYLEIGH ( { sigma_opt | theta_opt … } ) |WEIBULL (
{ c_opt |cdelta_opt |cinitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt
… } ) |other-options
]
other-options{ NOHLABEL |
NOVLABEL |NOVTICK |OVERLAY |SQUARE |HREF = { value … } |[ HREFLABELS | HREFLABEL | HREFLAB ] = { "label" … } |HREFLABPOS = [ 1 | 2 | 3 | 4 ] |VREF = { value … } |[ VREFLABELS | VREFLABEL | VREFLAB ] = { "label" … } |VREFLABPOS = [ 1 | 2 | 3 | 4 ]
… }
PROBPLOT{ variable-name … } [ / { option … } ] ;
Reference for language elementsVersion 3.3
1153
value_or_test[ EST | value ]
option[ dist-options | other-options ]
alpha_opt[ ALPHA | A ] = value_or_test
alphadelta_optALPHADELTA = value
alphainitial_optALPHAINITIAL = value
maxiter_optMAXITER = value
beta_opt[ BETA | B ] = value_or_test
mu_optMU = value_or_test
sigma_optSIGMA = value_or_test
theta_opt[ THETA | THRESHOLD ] = value_or_test
thetaconstant_opt[ THETA | THRESHOLD ] = value
lambda_optLAMBDA = value_or_test
Reference for language elementsVersion 3.3
1154
zeta_optZETA = value_or_test
scale_optSCALE = value_or_test
shape_optSHAPE = value_or_test
c_optC = value_or_test
cdelta_optCDELTA = value
cinitial_optCINITIAL = value
dist-options[ BETA (
{ alpha_opt |beta_opt |sigma_opt |theta_opt |scale_opt
… } ) |[ EXPONENTIAL | EXP ] (
{ sigma_opt |theta_opt |scale_opt
… } ) |GAMMA (
{ alpha_opt |alphadelta_opt |alphainitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt
… } ) |
Reference for language elementsVersion 3.3
1155
GUMBEL ( { mu_opt | sigma_opt … } ) |IGAUSS ( { mu_opt | lambda_opt … } ) |LOGNORMAL (
{ sigma_opt |theta_opt |zeta_opt |shape_opt
… } ) |NORMAL ( { mu_opt | sigma_opt … } ) |PARETO (
{ alpha_opt |sigma_opt |theta_opt
… } ) |POWER (
{ alpha_opt |sigma_opt |theta_opt
… } ) |RAYLEIGH ( { sigma_opt | theta_opt … } ) |[ WEIBULL | WEIB ] (
{ c_opt |cdelta_opt |cinitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt
… } ) |[ WEIBULL2 | W2 ] (
{ c_opt |cdelta_opt |cinitial_opt |maxiter_opt |sigma_opt |thetaconstant_opt |scale_opt
… } ) |other-options
]
other-options{ NOHLABEL |
NOVLABEL |NOVTICK |OVERLAY |
Reference for language elementsVersion 3.3
1156
SQUARE |HREF = { value … } |[ HREFLABELS | HREFLABEL | HREFLAB ] = { "label" … } |HREFLABPOS = [ 1 | 2 | 3 | 4 ] |VREF = { value … } |[ VREFLABELS | VREFLABEL | VREFLAB ] = { "label" … } |VREFLABPOS = [ 1 | 2 | 3 | 4 ] |RANKADJ = value |NADJ = value |ROTATE
… }
QQPLOT{ variable-name … } [ / { option … } ] ;
value_or_test[ EST | value ]
option[ dist-options | other-options ]
alpha_opt[ ALPHA | A ] = value_or_test
alphadelta_optALPHADELTA = value
alphainitial_optALPHAINITIAL = value
maxiter_optMAXITER = value
beta_opt[ BETA | B ] = value_or_test
Reference for language elementsVersion 3.3
1157
mu_optMU = value_or_test
sigma_optSIGMA = value_or_test
theta_opt[ THETA | THRESHOLD ] = value_or_test
thetaconstant_opt[ THETA | THRESHOLD ] = value
lambda_optLAMBDA = value_or_test
zeta_optZETA = value_or_test
scale_optSCALE = value_or_test
shape_optSHAPE = value_or_test
c_optC = value_or_test
cdelta_optCDELTA = value
cinitial_optCINITIAL = value
dist-options[ BETA (
Reference for language elementsVersion 3.3
1158
{ alpha_opt |beta_opt |sigma_opt |theta_opt |scale_opt
… } ) |[ EXPONENTIAL | EXP ] (
{ sigma_opt |theta_opt |scale_opt
… } ) |GAMMA (
{ alpha_opt |alphadelta_opt |alphainitial_opt |maxiter_opt |sigma_opt |theta_opt |scale_opt
… } ) |GUMBEL ( { mu_opt | sigma_opt … } ) |IGAUSS ( { mu_opt | lambda_opt … } ) |LOGNORMAL (
{ sigma_opt |theta_opt |zeta_opt |shape_opt
… } ) |NORMAL ( { mu_opt | sigma_opt … } ) |PARETO (
{ alpha_opt |sigma_opt |theta_opt
… } ) |POWER (
{ alpha_opt |sigma_opt |theta_opt
… } ) |RAYLEIGH ( { sigma_opt | theta_opt … } ) |[ WEIBULL | WEIB ] (
{ c_opt |cdelta_opt |cinitial_opt |maxiter_opt |sigma_opt |
Reference for language elementsVersion 3.3
1159
theta_opt |scale_opt
… } ) |[ WEIBULL2 | W2 ] (
{ c_opt |cdelta_opt |cinitial_opt |maxiter_opt |sigma_opt |thetaconstant_opt |scale_opt
… } ) |other-options
]
other-options{ NOHLABEL |
NOVLABEL |NOVTICK |OVERLAY |SQUARE |HREF = { value … } |[ HREFLABELS | HREFLABEL | HREFLAB ] = { "label" … } |HREFLABPOS = [ 1 | 2 | 3 | 4 ] |VREF = { value … } |[ VREFLABELS | VREFLABEL | VREFLAB ] = { "label" … } |VREFLABPOS = [ 1 | 2 | 3 | 4 ] |RANKADJ = value |NADJ = value |ROTATE
… }
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
Reference for language elementsVersion 3.3
1160
WHEREWHERE condition ;
Library Engines
CVPLIBNAME name [ CVP physical-location explicit-CVP-options | other-engine-name physical-
location implicit-CVP-options ] ;
explicit-CVP-options[ cvpengine = underlying-engine-name] [ | cvpbytes = count | cvpmultiplier = mult ]
implicit-CVP-options[ cvpbytes = count | cvpmultiplier = mult ]
SASDASDLIBNAME name SASDASD physical-filename ;
SAS7BDATLIBNAME name [ SAS7BDAT | V8 | V9 ] physical-location ;
SD2LIBNAME name [ SD2 | V6 ] physical-location ;
Reference for language elementsVersion 3.3
1161
SASSEQLIBNAME name SASSEQ physical-filename ;
V8SEQLIBNAME name V8SEQ physical-filename ;
V9SEQLIBNAME name V9SEQ physical-filename ;
WPDSEQLIBNAME name WPDSEQ physical-filename ;
WPDLIBNAME name [ WPD ] physical-location ;
WPD (z/OS)LIBNAME name [ WPD ] physical-location [ { option … } ] ;
option[ BLKSIZE = block-size |
DATACLAS = data-class |DISP =
[ status |( status
[ , normal-termination-disp[ , abnormal-termination-disp]
] )
Reference for language elementsVersion 3.3
1162
] |HFS |LIKE = "model-dataset" |MGMTCLASS = management-class |SPACE =
[ space |( space
[ , primary-space-allocation[ , secondary-space-allocation]
] )] |
STORCLASS = storage-class]
status[ NEW | MOD | SHR ]
normal-termination-disp[ KEEP |
DELETE |CATLG |UNCATLG
]
abnormal-termination-disp[ KEEP |
DELETE |CATLG |UNCATLG
]
space[ TRK | CYL | block-size ]
WPD1LIBNAME name [ WPD1 ] physical-location ;
Reference for language elementsVersion 3.3
1163
WPDV2LIBNAME name [ WPDV2 ] physical-location ;
WPDV2 (z/OS)LIBNAME name [ WPDV2 ] physical-location [ { option … } ] ;
option[ BLKSIZE = block-size |
DATACLAS = data-class |DISP =
[ status |( status
[ , normal-termination-disp[ , abnormal-termination-disp]
] )] |
HFS |LIKE = "model-dataset" |MGMTCLASS = management-class |SPACE =
[ space |( space
[ , primary-space-allocation[ , secondary-space-allocation]
] )] |
STORCLASS = storage-class]
status[ NEW | MOD | SHR ]
Reference for language elementsVersion 3.3
1164
normal-termination-disp[ KEEP |
DELETE |CATLG |UNCATLG
]
abnormal-termination-disp[ KEEP |
DELETE |CATLG |UNCATLG
]
space[ TRK | CYL | block-size ]
XMLLIBNAME name XML [ "physical-location" ] [ { libname-option … } ] ;
libname-option[ formatactive = [ YES | NO ] |
formatnoreplace = [ YES | NO ] |indent = count |odscharset = character set |xmldataformat = [ ELEMENT | ATTRIBUTE ] |xmlconcatenate = [ YES | NO ] |xmldouble = [ DISPLAY | INTERNAL ] |xmlencoding = encoding |xmlfileref = fileref |xmlmap = [ fileref | "physical-location" ] |xmltype =
[ GENERIC |ORACLE |XMLMAP |CDISCODM
] ]
Reference for language elementsVersion 3.3
1165
XPORTLIBNAME name [ XPORT | SASXPORT ] physical-location ;
Macros
Automatic Macro Variables
SYSADDRBITSRead only variable.
SYSCHARWIDTHRead only variable.
SYSCCRead-write variable.
SYSDATERead only variable.
SYSDATE9Read only variable.
Reference for language elementsVersion 3.3
1166
SYSDAYRead only variable.
SYSDSNRead-write variable.
SYSENDIANRead only variable.
SYSENVRead only variable.
SYSERRRead only variable.
SYSERRORTEXTRead-write variable.
SYSFILRCRead-write variable.
SYSENDIANRead only variable.
Reference for language elementsVersion 3.3
1167
SYSINDEXRead only variable.
SYSINFORead-write variable.
SYSJOBIDRead only variable.
SYSLASTRead-write variable.
SYSLIBRCRead-write variable.
SYSMACRONAMERead only variable.
SYSMAXLONGRead only variable.
SYSMENVRead only variable.
Reference for language elementsVersion 3.3
1168
SYSPARMRead-write variable.
SYSPBUFFRead-write variable.
SYSPROCESSIDRead only variable.
SYSPROCESSNAMERead only variable.
SYSPROCNAMERead only variable.
SYSRCRead-write variable.
SYSSCPRead-write variable.
SYSSCPLRead-write variable.
Reference for language elementsVersion 3.3
1169
SYSSITERead only variable.
SYSMAXLONGRead only variable.
SYSSIZEOFPTRRead only variable.
SYSSIZEOFUNICODERead only variable.
SYSUIDRead only variable.
SYSUSERIDRead only variable.
SYSVERRead only variable.
SYSVLONG
Reference for language elementsVersion 3.3
1170
SYS99ERRRead-write variable.
SYS99INFRead-write variable.
SYS99MSGRead-write variable.
SYS99R15Read-write variable.
Macro Processor Statements
%ABORT%ABORT [ ABEND | RETURN ] n ;
%* comment%* comment text ;
%COPY%COPY macro_name [ / { option … } ] ;
Reference for language elementsVersion 3.3
1171
option[ SOURCE |
SRC |[ LIB | LIBRARY ] = |[ OUTFILE | OUT ] = [ fileref | "external-file" ]
]
%DO%DO ; text and macro statements %END ;
%DO, Iterative%DO index-variable = start %TO stop [ %BY increment ] ; text and macro statements %END ;
%DO %UNTIL%DO %UNTIL ( condition ); text and macro statements %END ;
%DO %WHILE%DO %WHILE ( condition ); text and macro statements %END ;
%END
%EXECUTE%EXECUTE ( { %macro-name ( { parameter , … } ) … } );
%GLOBAL%GLOBAL { macro-variable … } ;
Reference for language elementsVersion 3.3
1172
%GOTO[ %GOTO | %GO TO ] label ;
%IF-%THEN/%ELSE%IF condition %THEN text or macro statement ;
[ %ELSE text or macro statement ;]
%INCLUDEThe %INCLUDE statement adds sourcelines from an external file into the program.
For more details, please refer to the %INCLUDE Global Statement.
%label% label : text or macro statement
%LET%LET macro-variable = value ;
%LOCAL%LOCAL { macro-variable … } ;
%MACRO%MACRO macro-name
[ ( { positional-parameter | keyword-parameter = [ value ] , … } )] [ / { option … } ] ; text and macro statements %MEND [ macro-name ] ;
Reference for language elementsVersion 3.3
1173
option[ DES = description |
MINDELIMITER = 'delimiter-character' |[ MINOPERATOR | NOMINOPERATOR ] |[ PARMBUFF | PBUFF ] |[ SOURCE | SRC ] |STORE
]
%MENDMarks the end of the the macro statement.
%MEND takes no arguments, but putting the macro-name after the statement can help in identifying theextent of a macro in your SAS language program, For example:
%MACRO my_macro……%MEND my_macro
%PUT%PUT
[ _ALL_ |_AUTOMATIC_ |_GLOBAL_ |_LOCAL_ |_USER_ |text
] ;
%RETURN%RETURN ;
Reference for language elementsVersion 3.3
1174
%SYSCALL%SYSCALL call-routine (
[ { call-routine-argument , … }] );
%SYMDEL%SYMDEL { macro-variable … } [ / NOWARN ] ;
%SYSEXEC%SYSEXEC { command … } ;
Macro Processor Functions
%BQUOTE%BQUOTE ( argument )
%CMPRES%CMPRES ( argument )
%DATATYP%DATATYP ( argument )
Reference for language elementsVersion 3.3
1175
%DS2CSV%DS2CSV ( RUNMODE =
[ S data_options[ { options_for_RUNMODE=S … }] |
B data_options[ { options_for_RUNMODE=any … }]
] )
data optionsDATA = dataset [ CSVFILE = filename | CSVFREF = fileref ]
options for RUNMODE=S[ CONTTYPE = [ Y | N ] |
CONTDISP = [ Y | N ] |SAVEFILE = filename |MIMEHDR1 = MIME/HTTP header |MIMEHDR2 = MIME/HTTP header |MIMEHDR3 = MIME/HTTP header |MIMEHDR4 = MIME/HTTP header |MIMEHDR5 = MIME/HTTP header
]
options for RUNMODE=any[ OPENMODE = [ REPLACE | APPEND ] |
COLHEAD = [ Y | N ] |FORMATS = [ Y | N ] |LABELS = [ Y | N ] |PW = password |SEPCHAR = separator (hex) |VAR = { variable … } |WHERE = where-expression
]
%EVAL%EVAL ( argument )
Reference for language elementsVersion 3.3
1176
%INDEX%INDEX ( source , search )
%LEFT%LEFT ( argument )
%LENGTH%LENGTH ( argument )
%LOWCASE%LOWCASE ( argument )
%NRBQUOTE%NRBQUOTE ( argument )
%NRQUOTE%NRQUOTE ( argument )
%NRSTR%NRSTR ( argument )
%QCMPRES%QCMPRES ( argument )
Reference for language elementsVersion 3.3
1177
%QLEFT%QLEFT ( argument )
%QLOWCASE%QLOWCASE ( argument )
%QSCAN%QSCAN ( source , n [ , delimiters ] )
%QSUBSTR%QSUBSTR ( source , pos [ , length ] )
%QSYSFUNC%QSYSFUNC ( function-name ( [ { argument , … } ] )[ , format ] )
%QTRIM%QTRIM ( argument )
%QUOTE%QUOTE ( argument )
%QUPCASE%QUPCASE ( argument )
Reference for language elementsVersion 3.3
1178
%SCAN%SCAN ( source , n [ , delimiters ] )
%STR%STR ( argument )
%SUBSTR%SUBSTR ( source , position [ , length ] )
%SUPERQ%SUPERQ ( argument )
%SYMEXIST%SYMEXIST ( argument )
%SYMGLOBL%SYMGLOBL ( argument )
%SYMLOCAL%SYMLOCAL ( argument )
%SYSEVALF%SYSEVALF ( argument )
Reference for language elementsVersion 3.3
1179
%SYSFUNC%SYSFUNC ( function-name ( [ { argument , … } ] )[ , format ] )
%SYSGET%SYSGET ( argument )
%SYSPROD%SYSPROD ( product )
%SYSRC%SYSRC ( character-string );
%TRIM%TRIM ( argument )
%UNQUOTE%UNQUOTE ( argument )
%UPCASE%UPCASE ( argument )
%VERIFY%VERIFY ( source , excerpt )
Reference for language elementsVersion 3.3
1180
WPS Graphing
Global Statements
AXISAXISn [ { options … } ] ;
options[ COLOR = h-v-color |
LABEL =[ NONE |
( { label-options … } )] |
MAJOR =[ NONE |
( { major-options … } )] |
MINOR =[ NONE |
( HEIGHT = n [ units ] )] |
ORDER =[ { value … } |
a to b [ by c ]] |
VALUE =[ NONE |
( { value-options … } )]
]
Reference for language elementsVersion 3.3
1181
label-options[ "label-text" |
ANGLE = [ 0 | 90 | -90 ] |COLOR = label-color |FONT = [ NONE | font-name ] |HEIGHT = n [ units ] |JUSTIFY = [ CENTER | LEFT | RIGHT ] |ROTATE = [ 0 | 90 ]
]
major-options[ COLOR = major-color |
HEIGHT = n [ units ] |NUMBER = n
]
value-options[ ANGLE = [ 90 | -90 ] |
COLOR = value-color |FONT = value-font |HEIGHT = n [ units ] |JUSTIFY = [ CENTER | LEFT | RIGHT ]
]
units[ CELLS | CM | IN | PCT | PT ]
FOOTNOTEFOOTNOTEn
[ { { graphing-options … } [ footnote-text | "footnote-text" ] … }] ;
graphing-options[ ANGLE = [ 90 | -90 ] |
COLOR = footnote-color |FONT = footnote-font |HEIGHT = n [ units ] |JUSTIFY = [ CENTER | LEFT | RIGHT ]
]
Reference for language elementsVersion 3.3
1182
units[ CELLS | CM | IN | PCT | PT ]
GOPTIONSGOPTIONS [ { options … } ] ;
options[ CBACK = back-color |
CBY = by-color |COLORS = [ ( [ { def-color … } ] ) ] |CPATTERN = pattern-color |CSYMBOL = symbol-color |CTEXT = text-color |CTITLE = title-color |DEVICE = [ GIF | JPEG ] |[ DISPLAY | NODISPLAY ] |[ FILLBORDERPRESERVE | FBP ] = [ LOWER | L | UPPER | U ] |FTEXT = font-name |FTITLE = font-name |GACCESS = [ GSASFILE | SASGASTD ] |GOUTMODE = [ APPEND | REPLACE ] |GSFNAME = output-fileref |GUNIT = units |HBY = n [ units ] |HPOS = n |HTEXT = n [ units ] |HTITLE = n [ units ] |INTERPOL = [ JOIN | NEEDLE | NONE ] |RESET =
[ ALL |GLOBAL |GOPTIONS |global-graphics-statements |( { global-graphics-statements … } )
] |VPOS = n |XPIXELS = n |YPIXELS = n
]
Reference for language elementsVersion 3.3
1183
units[ CELLS | CM | IN | PCT | PT ]
global-graphics-statements[ AXIS |
FOOTNOTE |LEGEND |PATTERN |SYMBOL |TITLE
]
LEGENDLEGENDn [ { options … } ] ;
options[ CBORDER = border-color |
CFRAME = area-color |FRAME |LABEL =
[ NONE |( { label-options … } )
] |SHAPE =
[ BAR = ( l [ units ] , h [ units ] )[ units ] |LINE = ( l )[ units ] |SYMBOL = ( l [ units ] , h [ units ] )[ units ]
] |VALUE =
[ NONE |( { value-options … } )
] ]
label-options[ "label-text" |
COLOR = label-color |FONT = [ NONE | label-font ] |HEIGHT = n [ units ]
]
Reference for language elementsVersion 3.3
1184
value-options[ { "value-text" … } |
COLOR = value-color |FONT = [ NONE | value-font ] |HEIGHT = n [ units ] |JUSTIFY = [ CENTER | LEFT | RIGHT ]
]
units[ CELLS | CM | IN | PCT | PT ]
PATTERNPATTERNn
{ |COLOR = pattern-color |VALUE =
[ EMPTY |Ln |MEMPTY |MnNd |MnXd |MSOLID |Rn |SOLID |Xn
] … } ;
SYMBOLSYMBOLn [ { options … } ] ;
Reference for language elementsVersion 3.3
1185
options[ CI = inter-color |
COLOR = plot-color |CV = symbol-color |HEIGHT = n [ units ] |INTERPOL =
[ JOIN |NEEDLE |R |SPLINE |STEP |NONE
] |LINE = n |REPEAT = n |VALUE = plot-symbols
]
units[ CELLS | CM | IN | PCT | PT ]
plot-symbols[ CIRCLE |
DIAMOND |DOT |FSQUARE |HASH |NONE |PLUS |SQUARE |STAR |TRIANGLE |U |X |Y |Z
]
Reference for language elementsVersion 3.3
1186
Graphing Procedures
GANNO Procedure
Supported statements• PROC GANNO
PROC GANNOPROC GANNO
{ |ANNOTATE = dataset |DATASYS |DESCRIPTION = "description" |GOUT = catalog_name |NAME = "entry-name"
… } ;
GBARLINE Procedure
Supported statements• PROC GBARLINE• BAR• BY• PLOT• WHERE
PROC GBARLINEPROC GBARLINE { | ANNOTATE = dataset | DATA = lookup_dataset … } ;
Reference for language elementsVersion 3.3
1187
BARBAR chart-variable [ / { options … } ] ;
options[ AUTOREF |
AXIS = AXISn |CAUTOREF |CAXIS = axis-color |CFRAME = area-color |CFREQ |CLIPREF |COUTLINE = outline-color |CPERCENT |CREF = ref-line-color |CTEXT = text-color |DESCRIPTION = "barchart-description" |DISCRETE |[ FRAME | NOFRAME ] |FREQ = num-variable |LAUTOREF = reference-line-type |LEGEND = LEGENDn |LREF = reference-line-type |MAXIS = AXISn |MEAN |MIDPOINTS =
[ { "char-value" … } |{ num-value … } |a to b [ by c ]
] |MINOR = number-of-minor-ticks |MISSING |NAME = "entry-name" |NOAXIS |NOBASEREF |NOLEGEND |NOZERO |OUTSIDE =
[ CFREQ |CPERCENT|CPCT |FREQ |MEAN |PERCENT|PCT |SUM
] |
Reference for language elementsVersion 3.3
1188
PATTERNID = [ BY | MIDPOINT | SUBGROUP ] |PERCENT |RAXIS = AXISn |REF = { value … } |SPACE = bar-spacing |SUBGROUP = sub-variable |SUM |SUMVAR = num-variable |TYPE =
[ CFREQ |CPERCENT |FREQ |MEAN |PERCENT |SUM
] |WAUTOREF = reference-line-width |WIDTH = bar-width |WOUTLINE = bar-outline-width |WREF = reference-line-width
]
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
PLOTPLOT [ { options … } ] ;
options[ AUTOREF |
AXIS = AXISn |CAXIS = axis-color |CAUTOREF = reference-line-color |CFREQ |CLIPREF |CPERCENT |CREF = reference-line-color |CTEXT = text-color |FREQ |LAUTOREF = reference-line-type |
Reference for language elementsVersion 3.3
1189
LEGEND = LEGENDn |LREF = reference-line-type |MEAN |MINOR = number-of-minor-ticks |NOAXIS |NOLINE |NOMARKER |PERCENT |RAXIS = AXISn |REF = value-list |SUM |SUMVAR = plot-variable |TYPE =
[ CFREQ |CPERCENT |FREQ |MEAN |PERCENT |SUM
] |WAUTOREF = reference-line-width |WREF = reference-line-width
]
WHEREWHERE condition ;
GCHART Procedure
Supported statements• PROC GCHART• BY• HBAR• PIE• VBAR• WHERE
Reference for language elementsVersion 3.3
1190
PROC GCHARTPROC GCHART
{ |ANNOTATE = dataset |DATA = data-set i |GOUT = dataset
… } ;
i See Input dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
HBARHBAR bar-variable [ / { options … } ] ;
options[ ANNOTATE = Annotate-data-set |
AUTOREF |AXIS = AXISn |CAUTOREF |CAXIS = axes-color |CFRAME = area-color |CFREQ |CFREQLABEL = column-label|NONE |CLIPREF |COUTLINE = outline-color |CPERCENT |CPERCENTLABEL = column-label|NONE |CREF = ref-line-color |CTEXT = text-color |DESCRIPTION = "barchart-description" |DISCRETE |[ FRAME | NOFRAME ] |FREQ |FREQ = num-variable |FREQLABEL = column-label|NONE |FRONTREF |
Reference for language elementsVersion 3.3
1191
G100 |GAXIS = AXISn |GROUP = group-variable |LAUTOREF = reference-line-type |LEGEND = LEGENDn |LREF = reference-line-type |MAXIS = AXISn |MEAN |MEANLABEL = column-label|NONE |MIDPOINTS =
[ { "char-value" … } |{ num-value … } |a to b [ by c ]
] |MINOR = number-of-minor-ticks |MISSING |NAME = "barchart-name" |NOAXIS |NOBASEREF |NOZERO |NOLEGEND |NOSTATS |OUTSIDE =
[ CFREQ |CPERCENT|CPCT |FREQ |MEAN |PERCENT|PCT |SUM
] |PATTERNID =
[ BY |GROUP |MIDPOINT |SUBGROUP
] |PERCENT |PERCENTLABEL = column-label|NONE |PERCENTSUM |RAXIS = AXISn |REF = { value … } |SPACE = n |SUBGROUP = sub-variable |SUM |SUMLABEL = column-label|NONE |SUMVAR = num-variable |
Reference for language elementsVersion 3.3
1192
TYPE =[ CFREQ |
CPERCENT |FREQ |MEAN |PERCENT |SUM
] |WAUTOREF = reference-line-width |WIDTH = n |WOUTLINE = bar-outline-width |WREF = reference-line-width
]
PIEPIE pie-variable [ / { options … } ] ;
options[ ANGLE = degrees |
CFILL = fill-color |CLOCKWISE |COUTLINE = [ outline-color | SAME ] |CTEXT = "char-value" |DESCRIPTION = "description" |DISCRETE |EXPLODE =
[ { "char-value" … } |{ num-value … } |a to b [ by c ]
] |FREQ = num-variable |GROUP = grp-variable |INVISIBLE =
[ { "char-value" … } |{ num-value … } |a to b [ by c ]
] |MISSING |NAME = "piechart-name" |OTHER = n |OTHERCOLOR = color |OTHERLABEL = "label-text" |MIDPOINTS = [ { "num-value" … } | OLD ] |
Reference for language elementsVersion 3.3
1193
PERCENT = [ NONE | OUTSIDE ] |SLICE = [ NONE | OUTSIDE ] |SUBGROUP = subgroup-variable |SUMVAR = num-variable |VALUE = [ NONE | OUTSIDE ] |WOUTLINE = slice-outline-width
]
VBARVBAR bar-variable [ / { options … } ] ;
options[ ANNOTATE = Annotate-data-set |
AUTOREF |AXIS = AXISn |CAUTOREF |CAXIS = axes-color |CFRAME = area-color |CFREQ |CLIPREF |COUTLINE = outline-color |CPERCENT |CREF = ref-line-color |CTEXT = text-color |DESCRIPTION = "barchart-description" |DISCRETE |[ FRAME | NOFRAME ] |FREQ = num-variable |FRONTREF |G100 |GAXIS = AXISn |GROUP = group-variable |LAUTOREF = reference-line-type |LEGEND = LEGENDn |LREF = reference-line-type |MAXIS = AXISn |MEAN |MIDPOINTS =
[ { "char-value" … } |{ num-value … } |a to b [ by c ]
] |MINOR = number-of-minor-ticks |
Reference for language elementsVersion 3.3
1194
MISSING |NAME = "barchart-name" |NOAXIS |NOBASEREF |NOLEGEND |NOZERO |OUTSIDE =
[ CFREQ |CPERCENT|CPCT |FREQ |MEAN |PERCENT|PCT |SUM
] |PATTERNID =
[ BY |GROUP |MIDPOINT |SUBGROUP
] |PERCENT |PERCENTSUM |RAXIS = AXISn |REF = { value … } |SPACE = n |SUBGROUP = sub-variable |SUM |SUMVAR = num-variable |TYPE =
[ CFREQ |CPERCENT |FREQ |MEAN |PERCENT |SUM
] |WAUTOREF = reference-line-width |WIDTH = n |WOUTLINE = bar-outline-width |WREF = reference-line-width
]
WHEREWHERE condition ;
Reference for language elementsVersion 3.3
1195
GOPTIONS Procedure
Supported statements• PROC GOPTIONS
PROC GOPTIONSPROC GOPTIONS { | OPTION = option | SHORT … } ;
GPLOT Procedure
Supported statements• PROC GPLOT• BY• PLOT• PLOT2• WHERE
PROC GPLOTPROC GPLOT
{ |ANNOTATE = dataset |DATA = data-set i |GOUT = dataset
… } ;
i See Input dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
Reference for language elementsVersion 3.3
1196
PLOTPLOT { y-var * x-var [ = z-var ] … } [ / { options … } ] ;
options[ AREAS = n |
AUTOHREF |AUTOVREF |CAXIS = x-y-color |CAUTOHREF = x-autoref-color |CAUTOVREF = y-autoref-color |CFRAME = area-color |CHREF = x-ref-color |COUTLINE = outline-color |CTEXT = text-color |CVREF = y-ref-color |DESCRIPTION = "graph-description" |[ FRAME | NOFRAME ] |FRONTREF |GRID |HAXIS = AXISn |HMINOR = n |HREF =
[ { num-value … } |[ a to b ] [ by c ]
] |HREVERSE |HZERO |LAUTOHREF = n |LAUTOVREF = n |LEGEND = LEGENDn |LHREF = n |LVREF = n |NAME = graph-name |OVERLAY |REGEQN |SKIPMISS |VAXIS = AXISn |VMINOR = n |VREF =
[ { num-value … } |[ a to b ] [ by c ]
] |VREVERSE |VZERO |
Reference for language elementsVersion 3.3
1197
WAUTOHREF = value-list |WAUTOVREF = value-list |WHREF = value-list |WVREF = value-list
]
PLOT2PLOT2 { y-var * x-var [ = z-var ] … } [ / { options … } ] ;
options[ AREAS = n |
AUTOVREF |CAXIS = x-y-color |CAUTOVREF = y-autoref-color |CFRAME = area-color |COUTLINE = outline-color |CTEXT = text-color |CVREF = y-ref-color |[ FRAME | NOFRAME ] |FRONTREF |GRID |LAUTOVREF = n |LEGEND = LEGENDn |LVREF = n |OVERLAY |REGEQN |SKIPMISS |VAXIS = AXISn |VMINOR = n |VREF =
[ { num-value … } |[ a to b ] [ by c ]
] |VREVERSE |VZERO |WAUTOVREF = value-list |WVREF = value-list
]
Reference for language elementsVersion 3.3
1198
WHEREWHERE condition ;
GREPLAY Procedure
Supported statements• PROC GREPLAY• DEVICE• DELETE• IGOUT• LIST• QUIT• REPLAY
PROC GREPLAYPROC GREPLAY { | IGOUT = dataset | NOFS … } ;
DEVICEDEVICE device-name ;
DELETEDELETE
{ catalog-entry-name |catalog-entry-index |_ALL_
… } ;
Reference for language elementsVersion 3.3
1199
IGOUTIGOUT [ libname . ] catalog ;
LISTLIST IGOUT ;
QUITQUIT ;
REPLAYREPLAY
{ catalog-entry-name |catalog-entry-index |_FIRST_ |_LAST_ |_ALL_
… } ;
GSLIDE Procedure
Supported statements• PROC GSLIDE
Reference for language elementsVersion 3.3
1200
PROC GSLIDEPROC GSLIDE
{ |ANNOTATE = dataset |BORDER |CFRAME = frame-color |DESCRIPTION = "description" |FRAME |GOUT = catalog_name |LFRAME = line-type |NAME = "entry-name" |WFRAME = n
… } ;
Reference for language elementsVersion 3.3
1201
WPS Statistics
Statistics Procedures
ACECLUS Procedure
Supported statements• PROC ACECLUS• BY• FREQ• VAR
PROC ACECLUSPROC ACECLUS [ { option … } ] ;
option[ ABSOLUTE |
CONVERGE = c |DATA = data-set i |INPUT =
[ [ DIAGONAL | D ] |[ FULL | F ] |[ IDENTITY | I ] |INPUT = data-set ii
] |MAXITER = n |METHOD =
[ [ COUNT | C ] |[ THRESHOLD | T ]
] |METRIC =
[ [ DIAGONAL | D ] |[ FULL | F ] |[ IDENTITY | I ]
Reference for language elementsVersion 3.3
1202
] |MPAIRS = m |N = n |NOPRINT |OUT = data-set iii |OUTSTAT = data-set iv |[ PROPORTION | PERCENT | P ] = p |PP |PREFIX = name |QQ |SHORT |[ SINGULAR | SING ] = g |[ THRESHOLD | T ] = t
]
i See Input dataset.ii See Input dataset.iii See Output dataset.iv See Output dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
FREQFREQ variable-name ;
VARVAR { variable-name … } ;
ANOVA Procedure
Supported statements• PROC ANOVA• BY• CLASS• FREQ
Reference for language elementsVersion 3.3
1203
• MEANS• MODEL• TEST• WHERE
PROC ANOVAPROC ANOVA [ { option … } ] ;
option[ DATA = data-set i |
NAMELEN = length |NOPRINT |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |OUTSTAT = data-set ii |PLOTS
[ ( MAXPOINTS = [ NONE | number ] )] [ = NONE ]
]
i See Input dataset.ii See Output dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable … } ;
Reference for language elementsVersion 3.3
1204
FREQFREQ variable-name ;
MEANSMEANS { effects … } [ / { options … } ] ;
options[ ALPHA = value |
BON |CLDIFF |CLM |DUNCAN |DUNNETT [ ( value-list ) ] |DUNNETTL [ ( value-list ) ] |DUNNETTU [ ( value-list ) ] |GABRIEL |GT2 |LINES |LSD |NOSORT |REGWQ |SCHEFFE |SIDAK |SMM |SNK |T |TUKEY |WELCH
]
MODELMODEL dependents = { effects … } [ / { options … } ] ;
options[ INT | INTERCEPT ]
Reference for language elementsVersion 3.3
1205
TESTTEST h = { effect … } e = effect ;
WHEREWHERE condition ;
BOXPLOT Procedure
Supported statements• PROC BOXPLOT• PLOT• BY• ID
PROC BOXPLOTPROC BOXPLOT
[ DATA = data-set i |BOX = boxplot-data-set ii |[ HISTORY | HIST ] = history-data-set iii
] ;
i See Input dataset.ii See Input dataset.iii See Input dataset.
PLOTvariable_list * group-variable-name ( { block-variable-name … } )[ { option … } ] ;
option[ BOXCONNECT
[ = [ MEAN | MEDIAN | MAX | MIN | Q1 | Q3 ] ] |
BOXSTYLE =
Reference for language elementsVersion 3.3
1206
[ SKELETAL |SCHEMATIC |SCHEMATICID |SCHEMATICIDFAR
] |BOXWITHSCALE = value |NOSERIFS |NOTCHES |PCTLDEF = value |WHISKERPERCENTILE = value |HREF = { value | "value" … } |HREFLABELS = { "label" … } |VREF = { value | "value" … } |VREFLABELS = { "label" … } |NOHLABEL |OUTBOX = output-data-set i |OUTHISTORY = output-data-set ii |HORIZONTAL |GRID |NOCHART |OVERLAY = variable_list |OVERLAYLEGLAB = "legend-text" |CLIPFACTOR = value |CLIPLEGEND = "legend-text" |CLIPSUBCHAR = 'character' |BLOCKVAR = variable_list |ODSFOOTNOTE = [ FOOTNOTE | FOOTNOTE1 | "foonote" ] |ODSFOOTNOTE2 = [ FOOTNOTE2 | "foonote" ] |ODSTITLE =
[ TITLE |TITLE1 |NONE |DEFAULT |LABELFMT |"title"
] |ODSTITLE2 = [ TITLE2 | TITLE1 | "title" ]
]
i See Output dataset.ii See Output dataset.
variable_list[ variable-name |
( { variable-name … } )]
Reference for language elementsVersion 3.3
1207
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
IDID variable ;
CANCORR Procedure
Supported statements• PROC CANCORR• BY• FREQ• PARTIAL• VAR• WEIGHT• WITH
PROC CANCORRPROC CANCORR [ { option … } ] ;
option[ ALL |
B |CLB |[ C | CORRB ] |DATA = data-set i |EDF = number |INT |NCAN = number |NOINT |NOPRINT |OUT = data-set ii |
Reference for language elementsVersion 3.3
1208
OUTSTAT = data-set iii |[ PARPREFIX | PPREFIX ] = number |PCORR |PROBT |RDF = number |[ RED | REDUNDANCY ] |[ S | SIMPLE ] |SEB |[ SING | SINGULAR ] = number |SMC |SPCORR |SQPCORR |SQSPCORR |STB |T |[ VDEP | WREG ] |[ VN | VNAME ] = label |[ VP | VPREFIX ] = name |[ VREG | WDEP ] |[ WP | WPREFIX ] = name
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
BYBY { variable-name … } ;
FREQFREQ variable-name ;
PARTIALPARTIAL { variable-name … } ;
VARVAR { variable-name … } ;
Reference for language elementsVersion 3.3
1209
WEIGHTWEIGHT variable-name ;
WITHWITH { variable-name … } ;
CANDISC Procedure
Supported statements• PROC CANDISC• BY• CLASS• FREQ• VAR• WEIGHT
PROC CANDISCPROC CANDISC [ { option … } ] ;
option[ ALL |
ANOVA |BCORR |BCOV |BSSCP |DATA = data-set i |DISTANCE |NCAN = n |NOPRINT |OUT = data-set ii |OUTSTAT = data-set iii |PCORR |PCOV |
Reference for language elementsVersion 3.3
1210
PREFIX = name |PSSCP |SHORT |SIMPLE |SINGULAR = p |STDMEAN |TCORR |TCOV |TSSCP |WCORR |WCOV |WSSCP
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
BYBY { variable-name … } ;
CLASSCLASS variable-name ;
FREQFREQ variable-name ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
Reference for language elementsVersion 3.3
1211
CLUSTER Procedure
Supported statements• PROC CLUSTER• BY• COPY• FREQ• ID• RMSSTD• VAR
PROC CLUSTERPROC CLUSTER [ { option … } ] ;
option[ BETA = value |
CCC |DATA = data-set i |DIM = value |K = value |METHOD =
[ AVERAGE |CENTROID |COMPLETE |DENSITY |FLEXIBLE |MCQUITTY |MEDIAN |SINGLE |WARD
] |MODE = value |NOEIGEN |NOID |NONORM |NOPRINT |NOSQUARE |NOTIE |OUTTREE = data-set ii |
Reference for language elementsVersion 3.3
1212
[ P | PRINT ] = number |PSEUDO |R = value |RMSSTD |RSQUARE |SIMPLE |[ STANDARD | STD ]
]
i See Input dataset.ii See Output dataset.
BYBY { variable-name … } ;
COPYCOPY { variable-name … } ;
FREQFREQ variable-name ;
IDID variable ;
RMSSTDRMSSTD variable ;
VARVAR { variable-name … } ;
Reference for language elementsVersion 3.3
1213
CORRESP Procedure
Supported statements• PROC CORRESP• BY• ID• SUPPLEMENTARY• TABLES• VAR• WEIGHT
PROC CORRESPPROC CORRESP [ { option … } ] ;
option[ ALL |
BENZECRI |BINARY |CELLCHI2 |COLUMN =
[ B |BD |DB |DBD |DBD1/2 |DBID1/2
] |CP |CROSS = [ BOTH | COLUMN | NONE | ROW ] |DATA = data-set i |DEVIATION |DIMENS = n |EXPECTED |FREQOUT |GREENACRE |MCA |MININERTIA = n |MISSING |NOCOLUMN [ = [ BOTH | DATA | PRINT ] ] |
Reference for language elementsVersion 3.3
1214
NOPRINT |NOROW [ = [ BOTH | DATA | PRINT ] ] |NVARS = n |OBSERVED |OUTC = data-set ii |OUTF = data-set iii |PLOTS [ ( GlobalPlotOptions ) ]
[ |PlotRequest |( { PlotRequest … } )
] |PRINT = [ BOTH | FREQ | PERCENT ] |PROFILE = [ BOTH | COLUMN | NONE | ROW ] |ROW =
[ A |AD |DA |DAD |DAD1/2 |DAID1/2
] |RP |SHORT |SINGULAR = n |SOURCE |UNADJUSTED
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
GlobalPlotOptionsFLIP
PlotRequest[ ALL | NONE ]
BYBY { variable-name … } ;
Reference for language elementsVersion 3.3
1215
IDID variable ;
SUPPLEMENTARYSUPPLEMENTARY { variable-name … } ;
TABLESTABLES [ { row-variable … } , ] { column-variable … } ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
DISCRIM Procedure
Supported statements• PROC DISCRIM• BY• CLASS• FREQ• ID• PRIORS• TESTCLASS• TESTFREQ• TESTID
Reference for language elementsVersion 3.3
1216
• VAR• WEIGHT
PROC DISCRIMPROC DISCRIM [ { option … } ] ;
option[ ALL |
ANOVA |BCORR |BCOV |BSSCP |CANONICAL |CANPREFIX = name |CROSSLIST |CROSSLISTERR |CROSSVALIDATE |DATA = data-set i |DISTANCE |K = k |KPROP = p |KERNEL =
[ BIWEIGHT |EPANECHNIKOV |NORMAL |TRIWEIGHT |UNIFORM
] |LIST |LISTERR |MANOVA |METHOD = [ NORMAL | NPAR ] |METRIC = [ DIAGONAL | FULL | IDENTITY ] |NCAN = number |NOCLASSIFY |NOPRINT |OUT = data-set ii |OUTCROSS = data-set iii |OUTD = data-set iv |OUTSTAT = data-set v |PCORR |
Reference for language elementsVersion 3.3
1217
PCOV |POOL = [ NO | TEST | YES ] |POSTERR |PSSCP |R = r |SCORES [ = prefix ] |SHORT |SIMPLE |SINGULAR = p |SLPOOL = p |STDMEAN |TCORR |TCOV |TESTDATA = data-set vi |TESTLIST |TESTLISTERR |TESTOUT = data-set vii |TESTOUTD = data-set viii |THREHOLD = p |TSSCP |WCORR |WCOV |WSSCP
]
i See Input dataset.ii See Output dataset.iii See Output dataset.iv See Output dataset.v See Outputdataset.vi See Output dataset.vii See Output dataset.viii See Output dataset.
BYBY { variable-name … } ;
CLASSCLASS variable-name ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1218
IDID variable ;
PRIORSPRIORS [ EQUAL | PROPORTIONAL | { classlevel = p … } ] ;
TESTCLASSTESTCLASS variable-name ;
TESTFREQTESTFREQ variable-name ;
TESTIDTESTID variable-name ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
Reference for language elementsVersion 3.3
1219
DISTANCE Procedure
Supported statements• PROC DISTANCE• BY• COPY• FREQ• ID• VAR• WEIGHT
PROC DISTANCEPROC DISTANCE [ { option … } ] ;
option[ ABSENT = value or qs |
ADD = value |DATA = data-set i |FUZZ = value |METHOD = method |MULT = value |NOMISS |NORM |PREFIX = name |OUT = data-set ii |OUTSDZ = data-set iii |RANKSCORE = [ MIDRANK | INDEX ] |REPLACE |REPONLY |SHAPE =
[ TRIANGLE |TRI |SQUARE |SQU |SQR
] |UNDEF = value |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
Reference for language elementsVersion 3.3
1220
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
method[ GOWER |
DGOWER |EUCLID |SQEUCLID |SIZE |SHAPE |COV |CORR |DCORR |SQCORR |DSQCORR |L |CITYBLOCK |CHEBYCHEV |POWER |SIMRATIO |DISRATIO |NONMETRIC |CANBERRA |COSINE |DOT |OVERLAP |DOVERLAP |CHISQ |CHI |PHISQ |PHI |HAMMING |MATCH |DMATCH |DSQMATCH |HAMANN |RT |SS1 |SS3 |DICE |RR |BLWNM |K1 |JACCARD |DJACCARD
Reference for language elementsVersion 3.3
1221
]
BYBY { variable-name … } ;
COPYCOPY { variable-name … } ;
FREQFREQ variable-name ;
IDID variable ;
VARVAR {
[ ANOMINAL |NOMINAL |ORDINAL |INTERVAL |RATIO
] ( { variable-name … } / opt-list ) … } ;
opt-list[ ABSENT = value or qs |
MISSING = miss-method or value |ORDER =
[ [ ASCENDING | ASC ] |[ DESENDING | DESC ] |[ ASCFORMATTED | ASCFMT ] |[ DESFORMATTED | DESFMT ] |
Reference for language elementsVersion 3.3
1222
[ DSORDER | DATA ] ] |
STD =[ MEAN |
MEDIAN |SUM |EUCLEN |USTD |STD |RANGE |MIDRANGE |MAXABS |IQR |MAD |L
] |WEIGHTS =
[ value |( list )
] ]
WEIGHTWEIGHT variable-name ;
FACTOR Procedure
Supported statements• PROC FACTOR• BY• FREQ• PRIORS• VAR• PARTIAL• WEIGHT
Reference for language elementsVersion 3.3
1223
PROC FACTORPROC FACTOR [ { option … } ] ;
option[ ALL |
CONVERGE = p |CORR |COVARIANCE |DATA = data-set i |EIGENVECTORS |FLAG = p |FUZZ = p |GAMMA = p |HEYWOOD |HKPOWER = p |MAXITER = n |METHOD =
[ ALPHA |HARRIS |IMAGE |PATTERN |PRINCIPAL |PRINIT
] |MINEIGEN = p |MSA |NFACTORS = n |NOBS = n |NOCORR |NOINT |NOPRINT |NOPROMAXNORM |NORM =
[ COV |KAISER |NONE |RAW |WEIGHT
] |OUT = data-set ii |OUTSTAT = data-set iii |PLOTS [ ( { PlotOptions … } ) ] =
[ PlotRequest |
Reference for language elementsVersion 3.3
1224
( { PlotRequest … } )] |
POWER = n |PREROTATE = rotation |PRINT |PRIORS =
[ ASMC |INPUT |MAX |ONE |RANDOM |SMC
] |PROPORTION = p |RANDOM = n |RCONVERGE = p |REORDER |RESIDUALS |RITER = n |ROTATE = rotation |ROUND |SCORE |SIMPLE |SINGULAR = p |TARGET = data-set iv |TAU = p |ULTRAHEYWOOD |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
i See Input dataset.ii See Output dataset.iii See Output dataset.iv See Input dataset.
rotation[ BIQUARTIMAX |
EQUAMAX |FACTORPARSIMAX |NONE |ORTHCF ( p1 , p2 ) |ORTHGENCF ( p1 , p2 , p3 , p4 ) |ORTHOMAX ( p ) |PARSIMAX |QUARTIMAX |VARIMAX |BIQUARTIMIN |COVARIMIN |HK ( p ) |
Reference for language elementsVersion 3.3
1225
OBBIQUARTIMAX |OBEQUAMAX |OBFACTORPARSIMAX |OBLICF ( p1 , p2 ) |OBLIGENCF ( p1 , p2 , p3 , p4 ) |OBLIMIN ( p ) |OBPARSIMAX |OBQUARTIMAX |OBVARIMAX |QUARTIMIN
]
PlotOptions[ CIRCLE [ = { number … } ] |
FLIP |NPLOTS = n |PLOTREF |UNPACK |VECTOR
]
PlotRequest[ ALL |
INITLOADINGS [ ( { PlotOptions … } ) ] |LOADINGS [ ( { PlotOptions … } ) ] |NONE |PRELOADINGS [ ( { PlotOptions … } ) ] |SCREE [ ( UNPACK ) ]
]
BYBY { variable-name … } ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1226
PRIORSPRIORS { communality-value … } ;
VARVAR { variable-name … } ;
PARTIALPARTIAL { variable-name … } ;
WEIGHTWEIGHT variable-name ;
FASTCLUS Procedure
Supported statements• PROC FASTCLUS• BY• FREQ• ID• VAR• WEIGHT• WHERE
PROC FASTCLUSPROC FASTCLUS [ { option … } ] ;
Reference for language elementsVersion 3.3
1227
option[ BINS = number |
CLUSTER = name |[ CONVERGE | CONV ] = value |DATA = dataset |DELETE = value |[ DISTANCE | DIST ] |DRIFT |IMPUTE |INSTAT = dataset |LEAST = [ p | MAX ] |LIST |[ MAXCLUSTERS | MAXC ] = number |MAXITER = number |MEAN = dataset |NOMISS |NOPRINT |OUT = dataset |OUTITER |[ OUTSEED | OUTS ] = dataset |OUTSTAT = dataset |[ RADIUS | R ] = number |RANDOM = number |REPLACE = [ FULL | PART | NONE | RANDOM ] |SEED = dataset |SHORT |STRICT [ = number ] |SUMMARY |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
BYBY { variable-name … } ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1228
IDID variable ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
WHEREWHERE condition ;
GENMOD Procedure
Supported statements• PROC GENMOD• BY• CLASS• CODE• DEVIANCE• FWDLINK• INVLINK• FREQ• MODEL• OUTPUT• REPEATED• VARIANCE• WEIGHT• ZERO
Reference for language elementsVersion 3.3
1229
PROC GENMODPROC GENMOD [ { option … } ] ;
option[ DATA = dataset |
[ DESC | DESCENDING ] |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |[ PLOT | PLOTS ]
[ ( { CLUSTERLABEL | UNPACK … } )] ={ ALL |
CLEVERAGE |CLUSTERDFIT |COOKSD |DCLS |DFBETA |DFBETAC |DFBETACS |DFBETAS |DOBS |LEVERAGE |MCLS |PREDICTED |PZERO |RESCHI |RESDEV |RESLIK |RESRAW |STDRESCHI |STDRESDEV
… } |RORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] ]
Reference for language elementsVersion 3.3
1230
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable [ ( options ) ] … } [ / { options … } ] ;
options[ [ DESC | DESCENDING ] |
MISSING |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |PARAM =
[ EFFECT |GLM |ORDINAL |ORTHEFFECT |ORTHORDINAL |ORTHOTHERM |ORTHREF |[ REFERENCE | REF ] |THERMOMETER
] |REF = [ FIRST | LAST | "level" ]
]
CODECODE { options … } ;
Reference for language elementsVersion 3.3
1231
options[ [ DUMMIES | NODUMMIES ] |
[ ERROR | NOERROR ] |FILE = fileref |FORMAT = format |[ LINESIZE | LS ] = length |LOOKUP =
[ AUTO |BINARY |LINEAR |SELECT
] |[ NORESIDUAL | RESIDUAL ]
]
DEVIANCEvariable = expression ;
FWDLINKvariable = expression ;
INVLINKvariable = expression ;
FREQFREQ variable-name ;
MODELMODEL [ option1 | option2 ] [ / options ] ;
Reference for language elementsVersion 3.3
1232
option1events / trials = [ { effect-definition … } ]
option2response = [ { [ effect-definition ] … } ]
effect-definitioneffect-variable [ { [ * | | ] effect-variable … } ]
effect-variableeffect-name [ ( { effect-name … } ) ]
options[ [ AGGREGATE |
AGGREGATE = ( { variable … } )] |
[ ALPHA | ALPH | A ] = value |CICONV = number |CL |CODING = [ EFFECT | FULLRANK ] |CONVERGE = value |CONVH = number |CORRB |COVB |DIAGNOSTICS |[ DIST | D | ERROR | E ] =
[ BINOMIAL |GAMMA |GEOMETRIC |IGAUSSIAN |MULTINOMIAL |NEGBIN |NORMAL |POISSON |ZINB |ZIP
] |DSCALE |EXPECTED |ID = variable |INFLUENCE |INITIAL = { number … } |
Reference for language elementsVersion 3.3
1233
INTERCEPT = { number … } |ITPRINT |LINK =
[ [ CUMCLL | CCLL ] |[ CUMLOGIT | CLOGIT ] |[ CUMPROBIT | CPROBIT ] |[ CLOGLOG | CLL ] |[ IDENTITY | ID ] |LOG |LOGIT |PROBIT |[ POWER | POW ] ( number )
] |[ MAXITER | MAXIT ] = number |LOGNB |LRCI |NOINT |NOLOGNB |NOSCALE |OBSTATS |OFFSET = variable |[ PREDICTED | PRED | P ] |PSCALE |[ RESIDUALS | R ] |SCALE =
[ [ DEVIANCE | D ] |[ PEARSON | P ] |value
] |SCORING = number |SINGULAR = number |TYPE1 |TYPE3 |WALD |WALDCI |XVARS
]
OUTPUTOUTPUT
[ OUT = output-data-set i{ option … }] ;
i See Output dataset.
Reference for language elementsVersion 3.3
1234
option[ [ CH | CLUSTERH | CLEVERAGE ] = name |
CLUSTER = name |[ CLUSTERCOOKD | CLUDTERCOOKSD | DCLS ] = name |[ CLUSTERDFIT | MCLS ] = name |[ COOKD | COOKSD | DOBS ] = name |[ DBETA | DFBETA ] = [ _ALL_ | var-list ] |[ DBETAC | DFBETAC ] = [ _ALL_ | var-list ] |[ DBETACS | DFBETACS ] = [ _ALL_ | var-list ] |[ DBETAS | DFBETAS ] = [ _ALL_ | var-list ] |[ H | LEVERAGE ] = name |HESSWGT = name |[ L | LOWER ] = name |[ P | PRED | PREDICTED | PROB ] = name |PZERO |RESCHI = name |RESDEV = name |RESLIK = name |RESRAW = name |STDRESCHI = name |STDRESDEV = name |STDXBETA = name |[ U | UPPER ] = name |XBETA = name
]
REPEATEDREPEATED subject = variable [ / { options … } ] ;
Reference for language elementsVersion 3.3
1235
options[ CONVERGE = number |
CORRB |CORRW |COVB |ECORRB |INITIAL = { number … } |INTERCEPT = number |MAXITER = number |MCORRB |MCOVB |RUPDATE |SORTED |WITHIN = variable
]
VARIANCEvariable = expression ;
WEIGHTWEIGHT variable-name ;
ZEROZERO { variable … }
[ / LINK =[ CLOGLOG |
CLL |LOGIT |PROBIT
] ] ;
Reference for language elementsVersion 3.3
1236
GLM Procedure
Supported statements• PROC GLM• BY• CLASS• CODE• FREQ• LSMEANS• MEANS• MODEL• OUTPUT• TEST• WEIGHT• WHERE
PROC GLMPROC GLM [ { option … } ] ;
option[ ALPHA = value |
DATA = data-set i |MANOVA |NAMELEN = length |NOPRINT |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |OUTPLOTDATA = library |OUTSTAT = data-set ii |[ PLOT | PLOTS ]
[ (
{ MAXPOINTS = [ NONE | n ] |ONLY |
Reference for language elementsVersion 3.3
1237
UNPACK |UNPACKPANEL
… } )][ =
[ plot-request |( { plot-request … } )
] ]
]
i See Input dataset.ii See Output dataset.
plot-request[ ALL |
ANCOVAPLOT [ ( { CLI | CLM | LIMITS … } ) ] |BOXPLOT [ ( NPANELPOS = n ) ] |CONTOURFIT
[ ( OBS =[ GRADIENT |
NONE |OUTLINE |OUTLINEGRADIENT
] )] |
CONTROLPLOT |DIAGNOSTICS [ ( { LABEL | UNPACK … } ) ] |DIFFPLOT
[ (
{ ABS |CENTER |NOABS |NOLINES
… } )] |
FITPLOT
[ ( { NOCLI | NOCLM | NOLIMITS … } )] |
INTPLOT [ ( { CLI | CLM | LIMITS … } ) ] |MEANPLOT
[ (
{ ASCENDING |CLBAND |CONNECT |DESCENDING
… } )
Reference for language elementsVersion 3.3
1238
] |NONE |RESIDUALS [ ( UNPACK ) ]
]
BYBY { variable-name … } ;
CLASSCLASS { variable … } ;
CODECODE { options … } ;
options[ [ DUMMIES | NODUMMIES ] |
[ ERROR | NOERROR ] |FILE = fileref |FORMAT = format |LINESIZE = length |LOOKUP =
[ AUTO |BINARY |LINEAR |SELECT
] |[ NORESIDUAL | RESIDUAL ]
]
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1239
LSMEANSLSMEANS { effects … } [ / { options … } ] ;
options[ ADJUST =
[ BON |DUNNETT |GT2 |SCHEFFE |SIDAK |SMM |TUKEY |T
] |ALPHA = p |AT
[ variable = value |( variable-list )= ( value-list ) |MEANS
] |BYLEVEL |CL |COV |E |E = effect |ETYPE = number |NOPRINT |OBSMARGINS |OM |OUT = data-set i |PDIFF
[ =
[ ALL |CONTROL [ ( { value-list … } ) ] |CONTROLL [ ( { value-list … } ) ] |CONTROLU [ ( { value-list … } ) ]
] ] |
[ PLOT | PLOTS ] [ =
[ lsmeans-plot-request |( { lsmeans-plot-request … } )
] ] |
Reference for language elementsVersion 3.3
1240
SINGULAR = value |STDERR |TDIFF
]
i See Output dataset.
lsmeans-plot-request[ ALL |
CONTROL |CONTROLPLOT |[ DIFF | DIFFOGRAM | DIFFPLOT ]
[ (
{ ABS |CENTER |NOABS |NOLINES
… } )] |
MEANPLOT
[ (
{ ASCENDING |CLBAND |CONNECT |DESCENDING |ILINK |JOIN
… } )] |
NONE
]
MEANSMEANS { effects … } [ / { options … } ] ;
options[ ALPHA = value |
BON |CLDIFF |CLM |DEPONLY |DUNCAN |
Reference for language elementsVersion 3.3
1241
DUNNETT [ ( value-list ) ] |DUNNETTL [ ( value-list ) ] |DUNNETTU [ ( value-list ) ] |GABRIEL |GT2 |LINES |LSD |NOSORT |REGWQ |SCHEFFE |SIDAK |SMM |SNK |T |TUKEY |WELCH
]
MODELMODEL dependents = { effects … } [ / { options … } ] ;
options[ ALPHA = value |
CLI |CLM |CLPARM |E |E1 |E2 |E3 |[ INT | INTERCEPT ] |[ I | INVERSE ] |NOINT |NOUNI |P |SINGULAR = value |SOLUTION |SS1 |SS2 |SS3 |TOLERANCE |XPX |ZETA = value
Reference for language elementsVersion 3.3
1242
]
OUTPUT
OUTPUT [ OUT = data-set i ] { keyword = { name … } … } [ / { option … } ] ;
i See Output dataset.
keyword[ COOKD |
COVRATIO |DFFITS |H |L95 |L95M |LCL |LCLM |[ PREDICTED | PRED | P ] |PRESS |[ RESIDUAL | R ] |RSTUDENT |STDI |STDP |STDR |STUDENT |U95 |U95M |UCL |UCLM
]
optionALPHA = value
TESTTEST [ H = { effect … } ] E = effect [ / { ETYPE = n | HTYPE = n … } ] ;
Reference for language elementsVersion 3.3
1243
WEIGHTWEIGHT variable-name ;
WHEREWHERE condition ;
GLMMOD Procedure
Supported statements• PROC GLMMOD• BY• CLASS• FREQ• MODEL• WEIGHT
PROC GLMMODPROC GLMMOD [ { option … } ] ;
Reference for language elementsVersion 3.3
1244
option[ DATA = data-set i |
NAMELEN = length |NOPRINT |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |OUTDESIGN = data-set ii |OUTPARM = data-set iii |PREFIX |ZEROBASED
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
BYBY { variable-name … } ;
CLASSCLASS { variable … } ;
FREQFREQ variable-name ;
MODELMODEL dependents = { effects … } [ / NOINT ] ;
Reference for language elementsVersion 3.3
1245
WEIGHTWEIGHT variable-name ;
KDE Procedure
Supported statements• PROC KDE• BIVAR• BY• UNIVAR• FREQ• WEIGHT
PROC KDEPROC KDE
[ { DATA = data-set i … }] ;
i See Input dataset.
BIVARBIVAR [ { option … } ] ;
Reference for language elementsVersion 3.3
1246
option[ BIVSTATS |
BVM = value |GRIDL = value |GRIDU = value |NGRID = count |NOPRINT |OUT = data-set i |PERCENTILES |UNISTATS
]
i See Output dataset.
BYBY { variable-name … } ;
UNIVARUNIVAR [ { option … } ] ;
option[ BVM = value |
GRIDL = value |GRIDU = value |METHOD = [ SJPI | SNR | SNRQ | SROT | OS ] |NGRID = count |NOPRINT |OUT = data-set i |PERCENTILES |SJPIMAX = value |SJPIMIN = value |SJPIMIN = value |SJPINUM = value |SJPITOL = value |UNISTATS
]
i See Output dataset.
Reference for language elementsVersion 3.3
1247
FREQFREQ variable-name ;
WEIGHTWEIGHT variable-name ;
LIFEREG Procedure
Supported statements• PROC LIFEREG• BY• CLASS• INSET• MODEL• PPLOT• OUTPUT• WEIGHT
PROC LIFEREGPROC LIFEREG [ { option … } ] ;
option[ COVOUT |
DATA = dataset |INEST = dataset |NAMELEN = value |NOPRINT |ORDER =
[ DATA |[ FMT | FORMATTED ] |FREQ |INTERNAL |[ UNFMT | UNFORMATTED ]
Reference for language elementsVersion 3.3
1248
] |OUTEST = dataset |PLOTS =
[ NONE |[ P | PROB | PROBPLOT ]
] |XDATA
]
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable-name … } ;
INSETINSET { options … } ;
options[ [ CONFIDENCE | CONF ] |
[ DISTRIBUTUION | DIST ] |INTERVAL |LEFTSINGULAR |NOBS |NMISS |RIGHT |SCALE |SHAPE |UNCENSORED
]
MODEL[ label : ] MODEL [ option1 | option2 | option3 ] [ / options ] ;
Reference for language elementsVersion 3.3
1249
option1events / trials = [ { effect-definition … } ]
option2response [ * censor ( { number … } ) ] = [ { [ effect-definition ] … } ]
option3( lower , upper )= [ { effect-definition … } ]
effect-definitioneffect-variable [ { [ * | | ] effect-variable … } ]
effect-variableeffect-name [ ( { effect-name … } ) ]
options[ ALPHA = value |
CONVERGE = value |CORRB |COVB |DISTRIBUTION =
[ EXPONENTIAL |GAMMA |LLOGISTIC |LNORMAL |LOGISTIC |NORMAL |WEIBULL
] |INITIAL = { value … } |INTERCEPT = value |ITPRINT |MAXITER = number |NOINT |NOLOG |NOSCALE |NOSHAPE1 |OFFSET = variable |SCALE = variable |SHAPE1 = variable |SINGULAR = variable
Reference for language elementsVersion 3.3
1250
]
OUTPUTOUTPUT [ { option … } ] ;
option[ CDF = name |
CENSORED = name |CONTROL = name |[ CRES | CRESIDUAL ] = name |OUT = data-set |[ P | PREDICTED ] = name |[ Q | QUANTILE | QUANTILES ] = name |RESCHI = name |[ SRES | RESIDUAL ] = name |[ STD | STD_ERR ] = name |XBETA = name
]
PPLOT[ PPLOT | PROBPLOT ] { options … } ;
options[ HCL |
HLOWER = value |HUPPER = value |HREF |HUPPER = name |ITPRINTEM |MAXITEM = number |NOCENPLOT |NOCONF |NODATA |NOFIT |NOFRAME |NOGRID |NPINTERVALS =
[ [ POINT | POINTWISE ] |[ SIMUL | SIMULTANEOUS ]
Reference for language elementsVersion 3.3
1251
] |PCTLIST = { value … } |PLOWER = value |PRINTPROBS |PUPPER = value |PPOS =
[ EXPRANK |MEDRANK |MEDRANK1 |KM |MKM
] |PPOUT |PROBLIST = { value … } |ROTATE |SQUARE |TOLLIKE = value |TOLPROB = value |VAXISLABEL = name |VREF |VREFLABELS = { name … }
]
WEIGHTWEIGHT variable-name ;
LIFETEST Procedure
Supported statements• PROC LIFETEST• BY• FREQ• ID• STRATA• TEST• TIME
Reference for language elementsVersion 3.3
1252
PROC LIFETESTPROC LIFETEST [ { option … } ] ;
option[ AALEN ALPHA = number-strictly-between-0-and-1 |
ALPHAQT = number-strictly-between-0-and-1 |ATRISK |[ BANKMAXTIME | BANKMAX ] = non-negative-number |[ BANKMINTIME | BANKMIN ] = non-negative-number |CONFBAND = [ ALL | EP | HW ] |CONFTYPE =
[ ASINSQRT |LINEAR |LOG |LOGIT |LOGLOG
] |DATA = data-set i |INTERVALS = { non-negative number
[ TO non-negative number [ BY non-zero number ]] , … } |
MAXTIME = non-negative number |METHOD =
[ ACT |BRESLOW |FH |KM |LIFE |LT |PL
] |MISSING |NELSON |NINTERVAL = non-negative integer |NOCENSPLOT |NOCENS |NOLEFT |NOPRINT |NOTABLE |OUTPLOTDATA = library-name |[ OUTSURV | OUTS ] = data-set ii |[ OUTTEST | OUTT ] = data-set iii |PLOTS
Reference for language elementsVersion 3.3
1253
[ ( Plots_global_options )= [ ( ] { Plots_request_item … } [ ) ]] |
REDUCEOUT |SINGULAR = non-negative-number |STDERR |TIMELIM =
[ [ EVENT | LET ] |[ OBSERVED | LOT ] |number
] |TIMELIST = { non-negative number … } |WIDTH = non-negative number
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
Plots global options{ ALL |
ONLY |MAXPOINTS = [ positive-integer | NONE ]
… }
Plots hazard type[ HAZARD | H ]
[ (
{ [ BANDWIDTH | BW ] =[ { non-negative number … } |
RANGE ( number , number )] |
CL |GRIDL = number |GRIDU = number |KERNEL =
[ [ BIWEIGHT | BW ] |[ EPANECHNIKOV | E ] |[ UNIFORM | U ]
] |NMINGRID = integer |NGRID = positive-integer
… } )]
Reference for language elementsVersion 3.3
1254
Plots survival type[ SURVIVAL | S ]
[ (
{ CB = [ ALL | EP | HW ] |CL |[ FAILURE | F ] |NOCONSOR |STRATA =
[ INDIVIDUAL |OVERLAY |PANEL |UNPACK
] … } )
]
Plots request item[ ALL |
[ LOGLOGS | LLS ] |[ LOGSURV | LS ] |NONE |[ PDF | P ] [ ( CL ) ] |Plots_hazard_type |Plots_survival_type
]
BYBY { variable-name … } ;
FREQFREQ variable-name [ / [ NOTRUNCATE | NOTRUNC ] ] ;
IDID { variable-name … } ;
Reference for language elementsVersion 3.3
1255
STRATASTRATA { Strata_variable … }
[ /
{ ADJUST =[ [ BONFERRONI | BON ] |
SCHEFFE |SIDAK |[ SMM | GTE ]
] |DIFF =
[ ALL |CONTROL ( { ' string ' … } )
] |GROUP = variable-name |MISSING |TREND |TEST = [ ( ] { Strata_test_request … } [ ) ]
… } ] ;
Strata variablevariable-name
[ ( { non-negative number[ TO non-negative number [ BY non-zero number ]] , … } )
]
Strata test request[ ALL |
FLEMING ( non-negative number , non-negative number ) |LOGRANK |LR |MODPETO |NONE |PETO |TARONE |WILCOXON
]
Reference for language elementsVersion 3.3
1256
TESTTEST { variable-name … } ;
TIMETIME [ * ( { number … } ) ] ;
LOESS Procedure
Supported statements• PROC LOESS• BY• ID• MODEL• OUTPUT• SCORE• WEIGHT
PROC LOESSPROC LOESS [ { option … } ] ;
option[ DATA = data-set i |
PLOTS [ ( { globalpltopt … } ) ] = [ ( ] { pltopt … } [ ) ]]
i See Input dataset.
globalpltopt[ MAXPOINTS = [ NONE | number ] |
ONLY |UNPACK
]
Reference for language elementsVersion 3.3
1257
pltopt[ ALL |
CONTOURFIT [ ( contourpltopt ) ] |CONTOURFITPANEL
[ ( { UNPACK | contourpltopt … } )] |
[ CRITERIONPLOT | CRITERION ] |[ DIAGNOSTICSPANEL | DIAGNOSTICS ] [ ( UNPACK ) ] |FITPANEL [ ( UNPACK ) ] |[ FITPLOT | FIT ] |NONE |OBSERVEDBYPREDICTED |[ QQPLOT | QQ ] |RESIDUALSBYSMOOTH [ ( { SMOOTH | UNPACK … } ) ] |RESIDUALBYPREDICTED |RESIDUALHISTOGRAM |[ RESIDUALPANEL | RESIDUALS ] [ ( { SMOOTH | UNPACK … } ) ] |[ RFPLOT | RF ] |[ SCOREPLOT | SCORE ]
]
contourpltoptOBS =
[ GRADIENT |NONE |OUTLINE |OUTLINEGRADIENT
]
BYBY { variable … } ;
IDID { variable … } ;
Reference for language elementsVersion 3.3
1258
MODELMODEL { dependent … } = { regressor … }
[ /
{ ALL |ALPHA = number |BUCKET = number |CLM |DEGREE = [ 1 | 2 ] |DETAILS
[ (
{ KDTREE |MODELSUMMARY |OUTPUTSTATISTICS |PREDATVERTICES
… } )] |
DFMETHOD = [ APPROX | EXACT | NONE ] [ ( { QUANTILE = number | CUTOFF = number … } )] |
DIRECT |DROPSQUARE = ( { variable … } ) |INTERP = [ CUBIC | LINEAR ] |ITERATIONS = number |[ RESIDUAL | R ] |SCALE =
[ NONE |SD |[ ( number ) ]
] |SCALEDINDEP |SELECT = criterion
[ (
{ GLOBAL |PRESEARCH |RANGE ( lower , upper ) |STEPS |target
… } )] |
SMOOTH = { value … } |STD |T |TRACEL
… } ] ;
Reference for language elementsVersion 3.3
1259
OUTPUTOUTPUT
{ |LCLM [ = name ] |OUT = output-data-set i |[ PREDICTED | P ] [ = name ] |[ RESIDUAL | R ] [ = name ] |STD [ = name ] |T [ = name ] |UCLM [ = name ]
… } [ /{ ALL |
[ ROW | ROWWISE ] … } ] ;
i See Output dataset.
SCORE
SCORE DATA = data-set i[ ID = ( { variable … } ) ][ /
{ CLM |PRINT [ ( VAR = { variable … } ) ] |[ R | RESIDUAL ] |SCALEDINDEP |STEPS
… } ] ;
i See Input dataset.
WEIGHTWEIGHT variable-name ;
Reference for language elementsVersion 3.3
1260
LOGISTIC Procedure
Supported statements• PROC LOGISTIC• BY• CLASS• CODE• MODEL• FREQ• OUTPUT• SCORE• WEIGHT
PROC LOGISTICPROC LOGISTIC [ { option … } ] ;
option[ ALPHA = value |
COVOUT |DATA = dataset |DESCENDING |INEST = dataset |INMODEL = dataset |NAMELEN = value |NOPRINT |OUTEST = dataset |OUTDESIGN = dataset |OUTDESIGNONLY |OUTMODEL = dataset |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |Plots_Option |RORDER = [ DATA | FORMATTED | INTERNAL ]
]
Reference for language elementsVersion 3.3
1261
Plots OptionPLOTS
[ [ (
[ LABEL |MAXPOINTS = [ NONE | number ] |ONLY |[ UNPACK | UNPACKPANELS ]
] )] ={ ALL |
DFBETAS [ ( UNPACK ) ] |DPC
[ (
[ MAXSIZE = value |MAXVALUE = value |MINSIZE = value |TYPE = [ BUBBLE | GRADIENT ] |[ UNPACK | UNPACKPANELS ]
] )] |
INFLUENCE
[ ( [ UNPACK | UNPACKPANELS ] )] |
LEVERAGE
[ ( [ UNPACK | UNPACKPANELS ] )] |
NONE |PHAT
[ ( [ UNPACK | UNPACKPANELS ] )] |
ROC
[ ( id =[ 1MSPEC |
FALPOS |FALNEG |OBS |MISCLASS |NEGPRED |POSPRED |PROB |SENSIT
] )]
… } ]
Reference for language elementsVersion 3.3
1262
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable [ ( options ) ] … } [ / { options … } ] ;
options[ [ DESC | DESCENDING ] |
MISSING |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |PARAM =
[ EFFECT |GLM |ORDINAL |[ REFERENCE | REF ]
] |REF = [ FIRST | LAST | "level" ]
]
CODECODE { options … } ;
Reference for language elementsVersion 3.3
1263
options[ [ DUMMIES | NODUMMIES ] |
[ ERROR | NOERROR ] |FILE = fileref |FORMAT = format |LINESIZE = length |LOOKUP =
[ AUTO |BINARY |LINEAR |SELECT
] |[ NORESIDUAL | RESIDUAL ]
]
MODEL[ label : ] MODEL [ option1 | option2 ] ;
option1events / trials = { [ effect-definition ] … }
option2variable ( { response-options … } )= { [ effect-definition ] … } [ / { options … } ]
response-options[ DESCENDING |
EVENT = [ "category" | FIRST | LAST ] |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |[ REF | REFERENCE ] = [ "category" | FIRST | LAST ]
]
effect-definitioneffect-name [ { [ * | | ] effect-name … } ]
Reference for language elementsVersion 3.3
1264
options[ ABSFCONV = value |
[ AGGREGATE |AGGREGATE = ( { variable … } )
] |ALPHA = value |BEST = number |BINWIDTH = number |CLPARM = [ BOTH | PL | WALD ] |CONVERGE = value |CORRB |COVB |CTABLE |DETAILS |[ EXPB | EXPEST ] |FAST |FCONV = value |GCONV = value |[ HIERARCHY | HIER ] =
[ MULTIPLE |MULTIPLECLASS |NONE |SINGLE |SINGLECLASS
] |INCLUDE = value |INFLUENCE |ITPRINT |LACKFIT ( n ) |[ L | LINK ] =
[ CLOGLOG |GLOGIT |LOGIT |PROBIT
] |MAXITER = number |MAXSTEP = number |[ NODUMMYPRINT | NODESIGNPRINT | NODP ] |NOCHECK |NOINT |OFFSET = variable |OUTROC = dataset |PARMLABEL |PEVENT =
[ value |( list )
Reference for language elementsVersion 3.3
1265
] |PLCL |PLCONV = value |PPROB =
[ value |( list )
] |RIDGEINIT = value |RIDGING = [ ABSOLUTE | NONE | RELATIVE ] |ROCEPS = value |[ RSQ | RSQUARE ] |SCALE =
[ constant |D |DEVIANCE |N |NONE |P |PEARSON
] |SELECTION =
[ NONE |[ B | BACKWARD ] |[ F | FORWARD ] |SCORE |[ S | STEPWISE ]
] |SEQUENTIAL |SINGULAR = value |SLENTRY = value |SLSTAY = value |START = value |STB |STOP = value |[ TECH | TECHNIQUE ] = [ FISHER | NEWTON ] |[ WALDCL | CL ] |XCONV = value
]
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1266
OUTPUTOUTPUT
[ OUT = output-data-set i{ option … }] ;
i See Output dataset.
option[ ALPHA = value |
C = name |CBAR = name |DFBETAS = [ _ALL_ | var-list ] |DIFCHISQ = name |DIFDEV = name |H = name |[ L | LOWER ] = name |OUT = data-set |[ P | PRED | PREDICTED | PROB ] = name |PREDPROBS =
[ CROSSVALIDATE |XVALIDATE |X |CUMULATIVE |C |INDIVIDUAL |I
] |RESCHI = name |RESDEV = name |STDXBETA = name |[ U | UPPER ] = name |XBETA = name
]
SCORESCORE [ { options … } ] ;
Reference for language elementsVersion 3.3
1267
options[ ALPHA = number |
CLM |DATA = dataset |FITSTAT |OUT = dataset |OUTROC = dataset |PRIOR = dataset |PRIOREVENT = value |ROCEPS = value
]
WEIGHTWEIGHT variable-name ;
MI Procedure
Supported statements• PROC MI• BY• EM• FREQ• MCMC• TRANSFORM• VAR• WHERE
PROC MIPROC MI [ { options … } ] ;
options[ ALPHA = value |
DATA = data-set i |
Reference for language elementsVersion 3.3
1268
[ MAXIMUM | MAX ] = { value … } |[ MINIMUM | MIN ] = { value … } |MINMAXITER = number |[ MU0 | THETA0 ] = { value … } |NIMPUTE = number |NOPRINT |OUT = data-set ii |ROUND = { value … } |SEED = number |SIMPLE |SINGULAR = value
]
i See Input dataset.ii See Output dataset.
BYBY { variable … }
EMEM [ { options … } ] ;
options[ [ CONVERGE | XCONV ] = value |
INITIAL =[ CC |
AC [ ( R = value ) ]] |
ITPRINT |MAXITER = number |OUT = data-set i |OUTEM = data-set ii |OUTITER [ ( { COV | MEAN … } ) ] = data-set iii
]
i See Output dataset.ii See Output dataset.iii See Output dataset.
Reference for language elementsVersion 3.3
1269
FREQFREQ variable ;
MCMCMCMC [ { options … } ] ;
options[ CHAIN = [ MULTIPLE | SINGLE ] |
DISPLAYINIT |INEST = data-set i |INITIAL =
[ EM
[ (
{ BOOTSTRAP [ = value ] |[ CONVERGE | XCONV ] = value |ITPRINT |MAXITER = number
… } )] |
INPUT = data-set ii
] |NBITER = number |NITER = number |OUTEST = data-set iii |OUTITER
[ (
{ COV |LR |LR_POST |MEAN |STD |WLF
… } )] = data-set iv |
PLOTS [ ( LOG ) ][ =
[ mcmc-plot-request |( { mcmc-plot-request … } )
] ] |
Reference for language elementsVersion 3.3
1270
PRIOR =[ INPUT = data-set v |
JEFFREYS |RIDGE = value
] |WLF
]
i See Input dataset.ii See Input dataset.iii See Output dataset.iv See Output dataset.v See Inputdataset.
mcmc-plot-request[ ACF
[ (
{ COV
[ ( { variable | variable * variable … } )] |
MEAN [ ( { variable … } ) ] |NLAG = number |WLF
… } )] |
ALL |NONE |TRACE
[ (
{ COV
[ ( { variable | variable * variable … } )] |
MEAN [ ( { variable … } ) ] |WLF
… } )]
]
TRANSFORMTRANSFORM
{ BOXCOX ( { variable … }[ / { C = value | LAMBDA = value … } ] ) |
EXP ( { variable … } [ / C = value ] ) |LOG ( { variable … } [ / C = value ] ) |LOGIT ( { variable … } [ / C = value ] ) |
Reference for language elementsVersion 3.3
1271
POWER ( { variable … }[ / { C = value | LAMBDA = value … } ] )
… } ;
VARVAR { variable … } ;
WHEREWHERE condition ;
MIXED Procedure
Supported statements• PROC MIXED• BY• CLASS• MODEL• RANDOM• REPEATED
PROC MIXEDPROC MIXED [ { options … } ] ;
options[ ABSOLUTE |
ALPHA = number |ASYCORR |ASYCOV |CL [ = WALD ] |CONVF [ = number ] |CONVG [ = number ] |
Reference for language elementsVersion 3.3
1272
CONVH [ = number ] |COVTEST |DATA = dataset |DFBW |EMPIRICAL |IC |INFO |ITDETAILS |LOGNOTE |MAXFUNC = number |MAXITER = number |METHOD =
[ REML |ML |MIVQUE0 |TYPE1 |TYPE2 |TYPE3
] |MMEQ |MMEQSOL |NOBOUND |NOCLPRINT [ = number ] |NOINFO |NOITPRINT |NOPROFILE |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |RATIO |RIDGE = number |SCORING [ = number ] |SIGITER |UPDATE
]
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
Reference for language elementsVersion 3.3
1273
CLASSCLASS { variable … } ;
MODELMODEL dependent = [ { fixed-effect … } ] [ / options ] ;
options[ ALPHA = number |
ALPHAP = number |CHISQ |CL |CONTAIN |CORRB |COVB |COVBI |DDFM =
[ CONTAIN |BETWITHIN |RESIDUAL |SATTERTHWAITE |KENWARDROGER [ ( FIRSTORDER ) ]
] |E |E1 |E2 |E3 |HTYPE = value-list |INTERCEPT |LCOMPONENTS |NOCONTAIN |NOINT |NOTEST |OUTP = output-data-set i |OUTM = output-data-set ii |RESIDUAL |SINGCHOL = number |SINGRES = number |SINGULAR = number |SOLUTION |VCIRY |XPVIX |
Reference for language elementsVersion 3.3
1274
XPVIXI |ZETA = number
]
i See Output dataset.ii See Output dataset.
RANDOMRANDOM { random-effect … } [ / options ] ;
options[ ALPHA = number |
CL |G |GC |GCI |GCORR |GI |GROUP = effect |SOLUTION |SUBJECT = effect |TYPE =
[ ANTE(1) |AR(1) |ARH(1) |ARMA(1,1) |CS |CSH |FA(q) |FA0(q) |FA1(q) |HF |TOEP |TOEP(q) |TOEPH |TOEPH(q) |UN |UN(q) |UNR |UNR(q) |VC
] |V [ = value-list ] |VC [ = value-list ] |
Reference for language elementsVersion 3.3
1275
VCI [ = value-list ] |VCORR [ = value-list ] |VI [ = value-list ]
]
REPEATEDREPEATED [ repeated-effect ] [ / options ] ;
options[ GROUP = effect |
R [ = value-list ] |RC [ = value-list ] |RCI [ = value-list ] |RCORR [ = value-list ] |RI [ = value-list ] |SUBJECT = effect |TYPE =
[ ANTE(1) |AR(1) |ARH(1) |ARMA(1,1) |CS |CSH |FA(q) |FA0(q) |FA1(q) |HF |TOEP |TOEP(q) |TOEPH |TOEPH(q) |UN |UN(q) |UNR |UNR(q) |VC
] ]
Reference for language elementsVersion 3.3
1276
MODECLUS Procedure
Supported statements• PROC MODECLUS• BY• FREQ• ID• VAR
PROC MODECLUSPROC MODECLUS [ { option … } ] ;
option[ ALL |
AM |BOUNDARY |[ CASCADE | CASC ] = number |CK = number |CLUSTER = name |CORE |CR = number |CROSS |CROSSLIST |DATA = dataset |DENSITY = name |[ DIMENSION | DIM ] = number |DK = number |DOCK = number |DR = number |EARLY |HM |JOIN [ = number ] |K = number |[ MAXCLUSTER | MAXC ] = number |[ METHOD | MET | M ] = number |MODE = number |NEIGHBOR |NOPRINT |NOSUMMARY |OUT = dataset |
Reference for language elementsVersion 3.3
1277
[ OUTCLUS | OUTC ] = name |[ OUTLENGTH | OUTL ] = name |[ OUTSUM | OUTS ] = name |[ POWER | PIW ] = number |R = number |SHORT |[ S | SIMPLE ] |[ STANDARD | STD ] |SUM |TEST |[ THRESHOLD | THR | = | number ] |TRACE
]
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
FREQFREQ variable-name ;
IDID variable-name ;
VARVAR { variable-name … } ;
NESTED Procedure
Supported statements• PROC NESTED• BY
Reference for language elementsVersion 3.3
1278
• CLASS• VAR• WHERE
PROC NESTEDPROC NESTED
{ |AOV |DATA = data-set i
… } ;
i See Input dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable … } [ / TRUNCATE ] ;
VARVAR { variable-name … } ;
WHEREWHERE condition ;
Reference for language elementsVersion 3.3
1279
NLIN Procedure
Supported statements• PROC NLIN• BOUNDS• BY• CONTROL• DER• ID• MODEL• OUTPUT• PARAMETERS• RETAIN• VAR• WEIGHT• WHERE
PROC NLINPROC NLIN [ { option … } ] ;
option[ ALPHA = number-strictly-between-0-and-1 |
BEST = non-negative-integer |BIAS |CONVERGE = non-negative-number |CONVERGEOBJ = non-negative-number |CONVERGEPARM = non-negative-number |DATA = data-set i |G4 |HOUGAARD |LIST |LISTALL |LISTCODE |LISTDEP |LISTDER |MAXITER = non-negative-integer |MAXSUBIT = non-negative-integer |
Reference for language elementsVersion 3.3
1280
METHOD =[ GAUSS |
MARQUARDT |NEWTON |GRADIENT
] |NLINMEASURES |NUMERICDIFFERENTIATION |NUMERICDIFF |NOITPRINT |NOHALVE |NOPRINT |OUTPLOTDATA = library-name |OUTEST = data-set ii |PLOTS
[ ( Plots_global_options )[ =
[ { Plots_request_item … } |( { Plots_request_item … } )
] ]
] |RHO = number |SAVE |SIGSQ = number |SINGULAR = non-negative-number |SMETHOD = [ HALVE | GOLDEN | CUBIC ] |TAU = number |TOTALSS |UNCORRECTEDDF |UNCORRECTEDGF |OUTPLOTDATA = library
]
i See Input dataset.ii See Output dataset.
Plots global options{ Plots_residual_type |
Plots_stats_type |UNPACK |MAXPOINTS = [ positive-integer | NONE ]
… }
Plots residual typeRESIDUALTYPE = [ RAW | PROJ | BOTH ]
Reference for language elementsVersion 3.3
1281
Plots stats typeSTATS =
{ ALL |DEFAULT |NONE |MAXINCURV |MAXPECURV |MSE |NOBS |NPARM |PVAR |RMSNINCURV |RMSINCURV |RMSPECURV |VAR |CURVCRIT
… }
Plots leverage typeLEVERAGETYPE = [ TAN | JAC | BOTH ]
Plots request item[ ALL |
NONE |DIAGNOSTICS
[ ( Diagnostics_options )] |
[ FITPLOT | FIT ] [ ( Fit_options ) ] |RESIDUALS [ ( Residual_options ) ]
]
Diagnostics options[ ( { Diagnostics_option … } ) |
Diagnostics_option]
Reference for language elementsVersion 3.3
1282
Diagnostics option[ RESIDUALTYPE = Plots_residual_type |
LEVERAGETYPE = Plots_leverage_type |LABELOBS |STATS = Plots_stats_type |UNPACK
]
Fit options[ ( { Fit_option … } ) |
Fit_option]
Fit option[ NOCLI |
NOCLM |NOLIMITS |OBS =
[ GRADIENT |NONE |OUTLINE |OUTLINEGRADIENT
] |CONTLEG |STATS = Plots_stats_type
]
Residual options[ ( { Residual_option … } ) |
Residual_option]
Residual option[ RESIDUALTYPE = Plots_residual_type | UNPACK ]
Reference for language elementsVersion 3.3
1283
BOUNDSBOUNDS
[ Bounds_inequality [ { [ , ] Bounds_inequality … } ] |[ parameter-name | number ] [ LT | LE | GT | GE | < | <= | > | >= ] [ parameter-name |
number ] ]
Bounds inequality{ parameter-name … } [ LT | LE | GT | GE | < | <= | > | >= ] [ parameter-name | number ]
BYBY { variable-name … } ;
CONTROLCONTROL { { variable-name … } [ = ] [ number ] … } ;
DER[ DER . parameter-name = expression |
DER . parameter-name . parameter-name = expression] ;
IDID { variable-name … } ;
MODELMODEL [ . ] dependent-name = expression ;
Reference for language elementsVersion 3.3
1284
OUTPUTOUTPUT [ { output_option … } ] ;
output option[ OUT = data-set i |
H = name |J = name |L95 = name |L95M = name |LCL = name |LCLM = name |PARMS = { name … } |PREDICTED = name |P = name |PROJRES = name |PROJSTUDENT = name |RESEXPEC = name |RESIDUAL = name |R = name |SSE = name |ESS = name |STDI = name |STDP = name |STDR = name |STUDENT = name |U95 = name |U95M = name |UCL = name |UCLM = name |WEIGHT = name |/ { ALPHA = name | DER … }
]
i See Output dataset.
PARAMETERS[ PARAMETERS | PARMS | PARAMS ]
{ parameter-name [ = ] number [ TO number [ BY number ] ] |/ PDATA = data-set i
… } ;
Reference for language elementsVersion 3.3
1285
i See Input dataset.
RETAINRETAIN { { variable-name … } [ = ] [ number ] … } ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
WHEREWHERE condition ;
NPAR1WAY Procedure
Supported statements• PROC NPAR1WAY• BY• CLASS• FREQ• OUTPUT• VAR• WHERE
PROC NPAR1WAYPROC NPAR1WAY [ { option … } ] ;
Reference for language elementsVersion 3.3
1286
option[ AB |
ALPHA = p |CONOVER |CORRECT = [ YES | NO ] |D |DATA = data-set i |EDF |HL |KLOTZ |MEDIAN |MISSING |MOOD |NOPRINT |NORMAL |SAVAGE |SCORES=DATA |ST |VW |WILCOXON |PLOTS
[ ( GlobalPlotOptions )[ =
[ ALL |NONE |PlotTypeOptions |( { PlotTypeOptions … } )
] ]
]]
i See Input dataset.
GlobalPlotOptions[ MAXPOINTS = [ positive-integer | NONE ] |
NOSTATS |ONLY |STATS
]
PlotTypeOptions[ [ AB | ABBOXPLOT ] |
[ ANOVA | ANOVABOXPLOT ] |
Reference for language elementsVersion 3.3
1287
[ CONOVER | CONOVERBOXPLOT ] |[ DATASCORES | DATASCORESBOXPLOT ] |[ EDF | EDFPLOT ] |[ KLOTZ | KLOTZBOXPLOT ] |[ MOOD | MOODBOXPLOT ] |[ SAVAGE | SAVAGEBOXPLOT ] |[ ST | STBOXPLOT ] |[ VW | VWBOXPLOT ] |[ NORMAL | NORMALBOXPLOT ] |[ WILCOXON | WILCOXONBOXPLOT ]
] [ ( [ NOSTATS | STATS ] ) ]
BYBY { variable-name … } ;
CLASSCLASS variable-name ;
FREQFREQ variable-name ;
OUTPUTOUTPUT [ { OutputTypeOptions … } ] ;
Reference for language elementsVersion 3.3
1288
OutputTypeOptions[ AB |
ANOVA |CONOVER |D |EDF |HL |KLOTZ |MEDIAN |MOOD |NORMAL |OUT = data-set i |SAVAGE |SCORES=DATA |ST |VW |WILCOXON
]
i See Output dataset.
VARVAR { variable-name … } ;
WHEREWHERE condition ;
PHREG Procedure
Supported statements• PROC PHREG• BY• CLASS• FREQ• ID
Reference for language elementsVersion 3.3
1289
• MODEL• OUTPUT• STRATA• WEIGHT• WHERE
PROC PHREGPROC PHREG [ { options … } ] ;
options[ DATA = data-set i |
ALPHA = value |ATRISK |COVM |COVOUT |[ COVSANDWICH | COVS ] [ ( AGGREGATE ) ] |NAMELEN = number |NOPRINT |NOSUMMARY |OUTEST = data-set ii |SIMPLE
]
i See Input dataset.ii See Output dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable [ ( options ) ] … } [ / { options … } ] ;
Reference for language elementsVersion 3.3
1290
options[ [ DESC | DESCENDING ] |
MISSING |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |PARAM =
[ EFFECT |GLM |ORDINAL |[ REFERENCE | REF ]
] |REF = [ FIRST | LAST | "level" ]
]
FREQ[ FREQ | FREQUENCY ] variable ;
IDID { variable … }
MODEL[ response |
( entry , response )] [ * censor ( values ) ] = { effects … } [ / { options … } ] ;
effectseffect [ { [ * | | ] effect … } ]
options[ [ ABSFCONV | CONVERGELIKE ] = value |
ALPHA = value |
Reference for language elementsVersion 3.3
1291
BEST = number |CORRB |COVB |DETAILS |[ ENTRYTIME | ENTRY ] = variable |FCONV = value |GCONV = value |[ HIERARCHY | HIER ] =
[ MULTIPLE |MULTIPLECLASS |NONE |SINGLE |SINGLECLASS
] |INCLUDE = number |ITPRINT |MAXITER = number |MAXSTEP = number |[ NODUMMYPRINT | NODP | NODESIGNPRINT ] |NOFIT |RIDGEINIT = value |RIDGEMAX = value |RIDGING = [ RELATIVE | ABSOLUTE | NONE ] |[ RISKLIMITS | RL ] [ = WALD ] |SELECTION =
[ [ BACKWARD | B ] |[ FORWARD | F ] |[ NONE | N ] |SCORE |[ STEPWISE | S ]
] |SEQUENTIAL |SINGULAR = value |[ SLENTRY | SLE ] = value |[ SLSTAY | SLS ] = value |START = number |STOP = number |[ STOPRES | SR ] |[ XCONV | CONVERGEPARM ] = value
]
OUTPUT
[ OUT = data-set i ] { keywords … } [ / { options … } ] ;
Reference for language elementsVersion 3.3
1292
i See Output dataset.
keywords[ [ ATRISK | NUM_LEFT ] = name |
DFBETA = { name … } |LD = name |LMAX = name |LOGLOGS = name |LOGSURV = name |RESDEV = name |RESMART = name |RESSCH = { name … } |RESSCO = { name … } |STDXBETA = name |SURVIVAL = name |WTRESSCH = { name … } |XBETA = name
]
options[ METHOD = [ BRESLOW | CH | EMP | FH | PL ] |
ORDER = [ DATA | SORTED ] ]
STRATA{ variable
[ ( { [ value | value TO value | value TO value BY value ] [ , ] … } )] … } [ / MISSING ]
WEIGHTWEIGHT variable [ / [ NORMALIZE | NORM ] ] ;
WHEREWHERE condition ;
Reference for language elementsVersion 3.3
1293
PRINCOMP Procedure
Supported statements• PROC PRINCOMP• BY• FREQ• PARTIAL• VAR• WEIGHT
PROC PRINCOMPPROC PRINCOMP [ { option … } ] ;
option[ COVARIANCE |
DATA = data-set i |N = number |NOINT |NOPRINT |OUT = data-set ii |OUTSTAT = data-set iii |PLOTS [ ( { GlobalPlotOptions … } ) ]
[ |= PlotRequest |= ( { PlotRequest … } )
] |PREFIX = name |SINGULAR = value |STANDARD |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
Reference for language elementsVersion 3.3
1294
GlobalPlotOptions[ FLIP |
NCOMP = n |ONLY |UNPACKPANEL
]
PlotRequest[ ALL |
SCREE [ (UNPACKPANEL) ] |MATRIX |NONE |PATTERN [ ( { PatternOptions … } ) ] |PATTERNPROFILE |SCORE [ ( { ScoreOptions … } ) ]
]
PatternOptions[ CIRCLES [ = number list ] |
FLIP |NCOMP = n |VECTOR
]
ScoreOptions[ ALPHA = number list |
ELLIPSE |FLIP |NCOMP = n
]
BYBY { variable-name … } ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1295
PARTIALPARTIAL { variable-name … } ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
PROBIT Procedure
Supported statements• PROC PROBIT• BY• CLASS• CODE• FREQ• MODEL• OUTPUT• WEIGHT
PROC PROBITPROC PROBIT [ { option … } ] ;
Reference for language elementsVersion 3.3
1296
option[ C = value |
COVOUT |DATA = dataset |HPROB = value |INEST = dataset |INVERSECL |LACKFIT |[ LN | LOG ] |LOG10 |NOPRINT |OPTC |ORDER = sort order |OUTEST = dataset |XDATA = dataset
]
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable [ ( options ) ] … } [ / { options … } ] ;
Reference for language elementsVersion 3.3
1297
options[ [ DESC | DESCENDING ] |
MISSING |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |PARAM =
[ EFFECT |GLM |ORDINAL |[ REFERENCE | REF ]
] |REF = [ FIRST | LAST | "level" ]
]
CODECODE { options … } ;
options[ [ ERROR | NOERROR ] |
FILE = fileref |FORMAT = format |LINESIZE = length |LOOKUP =
[ AUTO |BINARY |LINEAR |SELECT
] |[ NORESIDUAL | RESIDUAL ]
]
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1298
MODEL[ label : ] MODEL [ option1 | option2 ] [ / { options … } ] ;
option1events / trials = [ { effect-definition … } ]
option2variable [ ( { response-options … } ) ] = [ { effect-definition … } ]
response-options[ [ DESC | DESCENDING ] |
EVENT = [ "category" | FIRST | LAST ] |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL
] |[ REF | REFERENCE ] = [ "category" | FIRST | LAST ]
]
effect-definitioneffect-name [ { [ * | | ] effect-name … } ]
options[ AGGREGATE
[ =
[ variable ( variable-list )]
] |ALPHA = value |CONVERGE = value |CORRB |COVB |[ D | DIST | DISTRIBUTION ] =
[ LOGISTIC |NORMAL |[ EXTREME | EXTREMEVALUE | GOMPERTZ ]
] |HPROB = value |
Reference for language elementsVersion 3.3
1299
INITIAL = list |INTERCEPT = value |INVERSECL [ ( PROB = list ) ] |ITPRINT |LACKFIT |[ MAXITER = value | MAXIT = value ] |NOINT |SCALE =
[ [ D | DEVIANCE ] |[ P | PEARSON ]
] |SINGULAR = value
]
OUTPUT{ OUTPUT |
[ OUT = output-data-set i[ P | PROB ] = name STD = name XBETA = name]
… } ;
i See Output dataset.
WEIGHTWEIGHT variable-name ;
REG Procedure
Supported statements• PROC REG• ADD• BY• CODE• DELETE• FREQ• ID
Reference for language elementsVersion 3.3
1300
• MODEL• MTEST• OUTPUT• PRINT• REFIT• REWEIGHT• TEST• VAR• WEIGHT• WHERE
PROC REGPROC REG [ { option … } ] ;
option[ ALL |
ALPHA = number |CORR |COVOUT |DATA = data-set i |EDF |NOPRINT |OUTEST = output-data-set ii |OUTSEB |OUTSSCP = output-data-set iii |PLOTS
[ (
{ LABEL |MAXPOINTS = [ NONE | max [ heat-max ] ] |MODELLABEL |ONLY |STATS = StatsOptions |UNPACK |USEALL
… } )[ =
[ PlotTypeOptions |( { PlotTypeOptions … } )
]
Reference for language elementsVersion 3.3
1301
]] |
RSQUARE |SIMPLE |SINGULAR = singularity criterion |TABLEOUT |USSCP
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
StatsOptions[ ALL |
DEFAULT |NONE |(
{ ADJRSQ |AIC |BIC |CP |COEFFVAR |DEPMEAN |DEFAULT |EDF |GMSEP |JP |MSE |NOBS |NPARM |PC |RSQUARE |SBC |SP |SSE
… } )]
PlotTypeOptions[ ADJRSQ [ ( { LABEL | LABELVARS … } ) ] |
AIC [ ( { LABEL | LABELVARS … } ) ] |ALL |BIC [ ( { LABEL | LABELVARS … } ) ] |COOKSD [ ( LABEL ) ] |CP [ ( { LABEL | LABELVARS … } ) ] |[ CRITERIA | CRITERIONPANEL ]
Reference for language elementsVersion 3.3
1302
[ ( { LABEL | LABELVARS | UNPACK … } )] |
DFBETAS
[ (
{ COMMONAXES |LABEL |UNPACK
… } )] |
DFFITS [ ( LABEL ) ] |DIAGNOSTICS
[ ( { STATS = StatsOptions | UNPACK … } )] |
[ Fit | FITPLOT ] [ ( { NOCLI | NOCLM | NOLIMITS … } )] |
OBSERVEDBYPREDICTED [ ( LABEL ) ] |NONE |PARTIAL [ ( UNPACK ) ] |PREDICTIONS ( X = variable
[ (
[ NOCLI |NOCLM |NOLIMITS |UNPACK
] )] ) |
[ QQ | QQPLOT ] |[ RESIDUALBOXPLOT | BOXPLOT ] [ ( LABEL ) ] |RESIDUALBYPREDICTED [ ( LABEL ) ] |RESIDUALS [ ( LABEL ) ] |RESIDUALHISTOGRAM |[ RF | RF ] |[ RIDGE | RIDGEPANEL | RIDGEPLOT ]
[ (
{ RIDGEAXIS = [ LINEAR | LOG ] |UNPACK |VARSPERPLOT = [ ALL | number ] |VIFAXIS = [ LINEAR | LOG ]
… } )] |
RSQUARE [ ( { LABEL | LABELVARS … } ) ] |RSTUDENTBYLEVERAGE [ ( LABEL ) ] |RSTUDENTBYPREDICTED [ ( LABEL ) ] |SBC [ ( { LABEL | LABELVARS … } ) ]
]
Reference for language elementsVersion 3.3
1303
ADDADD { name … } ;
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CODECODE { option … } ;
option[ [ DUMMIES | NODUMMIES ] |
[ ERROR | NOERROR ] |FILE = fileref |FORMAT = format |LINESIZE = length |LOOKUP =
[ AUTO |BINARY |LINEAR |SELECT
] |[ NORESIDUAL | RESIDUAL ]
]
DELETEDELETE { name … } ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1304
IDID { variable-name … } ;
MODEL[ label : ] MODEL { response-variables … } = { regressor-variables … } [ / { option … } ] ;
option[ ACOV |
ACOVMETHOD = [ 0 | 1 | 2 | 3 ] |ADJRSQ |AIC |ALL |ALPHA = value |BEST = value |BIC |CLB |CLI |CLM |COLLIN |COLLINOINT |CORRB |COVB |CP |DETAILS |DETAILS = name |DW |EDF |GMSEP |GROUPNAMES = { name … } |HCC |HCCMETHOD = [ 0 | 1 | 2 | 3 ] |I |INCLUDE = value |INFLUENCE |JP |MAXSTEP = value |MSE |NOINT |NOPRINT |OUTSEB |OUTSTB |
Reference for language elementsVersion 3.3
1305
OUTVIF |P |PARTIAL |PARTIALDATA |PARTIALR2 |PC |PCOMIT = list |PRESS |PCORR1 |PCORR2 |RIDGE = list |R |RMSE |RSQUARE |SBC |SCORR1 |SCORR2 |SELECTION =
[ NONE |BACKWARD |FORWARD |STEPWISE |ADJRSQ |CP |RSQUARE |MAXR |MINR
] |SEQB |SLE = value |SLENTRY = value |SLS = value |SLSTAY = value |SIGMA = value |SINGULAR = value |SP |SPEC |SS1 |SS2 |SSE |START = value |STB |STOP = value |TOL |VIF |XPX
Reference for language elementsVersion 3.3
1306
]
MTESTMTEST { [ equation [ , ] ] … }
[ / { CANPRINT | DETAILS | PRINT … } ]
OUTPUT
OUTPUT [ OUT = output-data-set i ] { keyword = { name … } … } ;
i See Output dataset.
keyword[ COOKD |
COVRATIO |DFFITS |H |LCL |LCLM |L95 |L95M |[ PRESS | P ] |PREDICTED |[ RESIDUAL | R ] |RSTUDENT |STDI |STDP |STDR |STUDENT |UCL |UCLM |U95 |U95M
]
PRINTPRINT { option … } ;
Reference for language elementsVersion 3.3
1307
option[ ACOV |
ANOVA |ALL |CLI |CLM |COLLIN |COLLINOINT |CORRB |COVB |DW |I |INFLUENCE |MODELDATA |P |PARTIAL |PARTIALDATA |PCORR1 |PCORR2 |R |SCORR1 |SCORR2 |SEQB |SPEC |SS1 |SS2 |TOL |VIF |XPX
]
REFITREFIT ;
Reference for language elementsVersion 3.3
1308
REWEIGHTREWEIGHT
[ [ | condition | ALLOBS ] [ /
{ NOLIST |RESET |WEIGHT = value
… } ] |
STATUS |UNDO
] ;
TESTTEST { [ equation, ] … } [ / PRINT ]
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
WHEREWHERE condition ;
SCORE Procedure
Supported statements• PROC SCORE• BY
Reference for language elementsVersion 3.3
1309
• ID• VAR
PROC SCOREPROC SCORE [ { option … } ] ;
option[ DATA = data-set i |
NOSTD |OUT = data-set ii |PREDICT |RESIDUAL |SCORE = data-set iii |TYPE = type
]
i See Input dataset.ii See Output dataset.iii See Input dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
IDID { variable-name … } ;
VARVAR { variable-name … } ;
Reference for language elementsVersion 3.3
1310
SIMNORMAL Procedure
Supported statements• PROC SIMNORMAL• BY• CONDITION• VAR
PROC SIMNORMAL
PROC SIMNORMAL OUT = data-set i[ { option … } ] ;
i See Output dataset.
option[ DATA = data-set ii |
[ SINGULAR1 | SING1 ] = number |[ SINGULAR2 | SING2 ] = number |NUMREAL = n |OUTSEED |OUTCOND |SEED = number |SEEDBY
]
ii See Input dataset.
BYBY { variable-name … } ;
CONDITION[ CONDITION | COND ] { variable-name … } ;
Reference for language elementsVersion 3.3
1311
VARVAR { variable-name … } ;
STDIZE Procedure
Supported statements• PROC STDIZE• BY• FREQ• LOCATION• SCALE• VAR• WEIGHT
PROC STDIZEPROC STDIZE [ { option … } ] ;
option[ ADD = value |
DATA = data-set i |FUZZ = value |METHOD = method |MISSING = [ method | value ] |MULT = value |NMARKERS = value |NOMISS |NORM |OUT = data-set ii |OUTSTAT = data-set iii |PCTLDEF = value |PCTLMTD = [ ORD_STAT | ONEPASS | P2 ] |PCTLPTS =
[ value |( list )
] |
Reference for language elementsVersion 3.3
1312
PSTAT |REPALCE |REPONLY |UNSTD |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
method[ MEAN |
MEDIAN |SUM |EUCLEN |USTD |STD |RANGE |MIDRANGE |MAXABS |IQR |MAD |L |IN
]
BYBY { variable-name … } ;
FREQFREQ variable-name ;
LOCATIONLOCATION { variable-name … } ;
Reference for language elementsVersion 3.3
1313
SCALESCALE { variable-name … } ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
STEPDISC Procedure
Supported statements• PROC STEPDISC• BY• CLASS• FREQ• VAR• WEIGHT
PROC STEPDISCPROC STEPDISC [ { option … } ] ;
option[ ALL |
BCORR |BCOV |BSSCP |DATA = data-set i |INCLUDE = n |MAXMACRO = n |
Reference for language elementsVersion 3.3
1314
MAXSTEP = n |METHOD =
[ BACKWARD |BW |FORWARD |FW |STEPWISE |SW
] |PCORR |PCOV |[ PR2ENTRY | PR2E ] = p |[ PR2STAY | PR2S ] = p |PSSCP |SHORT |SIMPLE |SINGULAR = p |[ SLENTRY | SLE ] = p |[ SLSTAY | SLS ] = p |START = n |STDMEAN |STOP = n |TCORR |TCOV |TSSCP |WCORR |WCOV |WSSCP
]
i See Input dataset.
BYBY { variable-name … } ;
CLASSCLASS variable-name ;
Reference for language elementsVersion 3.3
1315
FREQFREQ variable-name ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
SURVEYSELECT Procedure
Supported statements• PROC SURVEYSELECT• CONTROL• ID• SIZE• STRATA
PROC SURVEYSELECTPROC SURVEYSELECT [ { option … } ] ;
option[ CERTSIZE |
CERTSIZE = [ value | dataset ] |CERTSIZE = P = value |DATA = dataset |JTPROBS |MAXSIZE |MAXSIZE = [ number | dataset ] |METHOD = name |MINSIZE |
Reference for language elementsVersion 3.3
1316
MINSIZE = [ number | dataset ] |N =
[ number |( { value , … } ) |dataset
] |NMAX = integer |NMIN = integer |NOPRINT |OUT = dataset |OUTALL |OUTHITS |OUTSEED |OUTSIZE |OUTSORT = dataset |REP = number |SAMPRATE =
[ number |( { value , … } ) |dataset
] |SAMPSIZE =
[ number |( { value , … } ) |dataset
] |SEED = [ number | dataset ] |SELECTALL |SORT = method |STATS
]
CONTROLCONTROL { variable-name … } ;
IDID { variable-name … } ;
Reference for language elementsVersion 3.3
1317
SIZESIZE variable-name ;
STRATASTRATA { variable-name … } ;
TREE Procedure
Supported statements• PROC TREE• BY• COPY• FREQ• HEIGHT• ID• NAME• PARENT
PROC TREEPROC TREE [ { option … } ] ;
option[ CFRAME = frame color |
DATA = data-set i |[ DESCENDING | DES ] |[ DESCRIPTION | DES ] = "tree description" |[ FILLCHAR | FC ] = "c" |GOUT = [ library | catalogname | library . catalogname ] |HAXIS = AXISn |HEIGHT =
[ [ HEIGHT | H ] |[ LENGTH | L ] |[ MODE | M ] |
Reference for language elementsVersion 3.3
1318
[ NCL | N ] |[ RSQ | R ]
] |HORIZONTAL/HOR |INC = n |[ JOINCHAR | JC ] = "c" |[ LEAFCHAR | LC ] = "c" |LINEPRINTER |LIST |[ MAAXHEIGHT | MAXH ] = n |[ MINH | MINHEIGHT ] = n |NAME = "tree name" |[ NCLUSTERS | NCL | N ] = n |NOPRINT |NTICK = n |OUT = data-set ii |PAGES = n |POS = n |ROOT = [ "cluster name" | n ] |SORT |[ SPACES | S ] = n |TREECHAR/TC = "c" |VAXIS = AXISn
]
i See Input dataset.ii See Output dataset.
BYBY { variable-name … } ;
COPYCOPY { variable-name … } ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1319
HEIGHTHEIGHT variable-name ;
IDID variable ;
NAMENAME variable-name ;
PARENTPARENT variable-name ;
TTEST Procedure
Supported statements• PROC TTEST• BY• CLASS• FREQ• PAIRED• VAR• WEIGHT
PROC TTESTPROC TTEST [ { option … } ] ;
Reference for language elementsVersion 3.3
1320
option[ ALPHA = value |
CI = { NONE | EQUAL | UMPU … } |CL |COCHRAN |DATA = data-set i |DIST = [ NORMAL | LOGNORMAL ] |H0 = value |BYVAR |NOBYVAR |ORDER =
[ DATA |FORMATTED |FREQ |INTERNAL |MIXED
] |SIDES = [ 2 | L | U ] |SIDED = value |SIDE = value |TEST = [ DIFF | RATIO ] |TOST = ( [ lower bound , ] upper bound )
]
i See Input dataset.
BYBY { variable-name … } ;
CLASSCLASS variable-name ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1321
PAIREDPAIRED { pair-definition … } ;
pair-definition[ ( pair-definition-variable-list )[ * | : ] ( pair-definition-variable-list ) |
variable-name [ * | : ] variable-name]
pair-definition-variable-listvariable-name [ | { variable-name … } | - variable-name ]
VARVAR CROSSOVER = [ Y | IGNOREPERIOD ] { variable-name … } ;
WEIGHTWEIGHT variable-name ;
VARCLUS Procedure
Supported statements• PROC VARCLUS• BY• FREQ• PARTIAL• SEED• VAR• WEIGHT
Reference for language elementsVersion 3.3
1322
PROC VARCLUSPROC VARCLUS [ { option … } ] ;
option[ CENTROID |
CORR |COVARIANCE |DATA = data-set i |HIERARCHY |INITIAL = [ GROUP | INPUT | RANDOM | SEED ] |MAXCLUSTERS = n |MAXEIGEN = n |MAXITER = n |MAXSEARCH = n |MINCLUSTERS = n |MULTIPLEGROUP |NOINT |NOPRINT |OUTSTAT = data-set ii |OUTTREE = data-set iii |PROPORTION = n |RANDOM = n |SHORT |SIMPLE |SUMMARY |TRACE |VARDEF = [ DF | N | WDF | WEIGHT | WGT ]
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
BYBY { variable-name … } ;
FREQFREQ variable-name ;
Reference for language elementsVersion 3.3
1323
PARTIALPARTIAL { variable-name … } ;
SEEDSEED { variable-name … } ;
VARVAR { variable-name … } ;
WEIGHTWEIGHT variable-name ;
VARCOMP Procedure
Supported statements• PROC VARCOMP• BY• CLASS• MODEL
PROC VARCOMPPROC VARCOMP [ { options … } ] ;
Reference for language elementsVersion 3.3
1324
options[ DATA = dataset |
EPSILON = name |MAXITER = number |METHOD = [ MIVQUE0 | ML | REML | TYPE1 ] |SEED = number
]
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
CLASSCLASS { variable-name … } ;
MODELMODEL { dependent … } = [ { effect … } ] [ / FIXED = number ]
Reference for language elementsVersion 3.3
1325
WPS Timeseries
Timeseries Procedures
ARIMA Procedure
Supported statements• PROC ARIMA• BY• IDENTIFY• ESTIMATE• FORECAST• WHERE
PROC ARIMAPROC ARIMA [ { proc_options … } ] ;
proc options[ DATA = data-set i |
PLOTS [ ( { ONLY | UNPACK … } ) ][ = (
{ ALL |NONE |SERIES (
[ ACF |ALL |CORR |CROSSCORR |IACF |PACF
] ) |RESIDUAL (
[ ACF |
Reference for language elementsVersion 3.3
1326
ALL |CORR |HIST |IACF |NORMAL |PACF |QQ |WN
] ) |FORECAST ( [ ALL | FORECAST | FORECASTONLY ] )
… } )]
]
i See Input dataset.
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
IDENTIFYIDENTIFY VAR = [ variable | variable(d1,...,dt) ] [ { option … } ]
option[ ALPHA = value |
CLEAR |CROSSCORR =
[ variable |variable(d11,d12,...,d1k) |( { variable(d1,d2,...,dk) … } )
] |DATA = data-set i |ESACF |NLAG = number |MINIC |NOMISS |NOPRINT |OUTCOV = data-set ii |P = (min:max) |PERROR = (min:max) |
Reference for language elementsVersion 3.3
1327
Q = (min:max) |SCAN |WHITENOISE = [ ST | IGNOREMISS ]
]
i See Input dataset.ii See Output dataset.
ESTIMATE[ label : ] ESTIMATE [ { option … } ]
option[ ALTPARM |
AR = { value … } |CONVERGE = value |DELTA = value |INITVAL = ( { initial_values … } ) |INPUT =
[ variable |( { transfer_function … } )
] |MA = { value … } |[ MAXITER | MAXIT ] = value |METHOD = [ CLS | ML | ULS ] |MU = value |[ NOCONSTANT | NOINT ] |NODF |NOEST |NOLS |NOPRINT |NOSTABLE |NOTFSTABLE |OUTCORR |OUTCOV |OUTEST = dataset |OUTMODEL = dataset |OUTSTAT = dataset |P =
[ order |{ ( { lag … } ) … }
] |PLOT |PRINTALL |Q =
Reference for language elementsVersion 3.3
1328
[ order |{ ( { lag … } ) … }
] |SINGULAR = value |WHITENOISE = [ ST | IGNOREMISS ]
]
initial valuesscale [ $ { ( { value … } ) … } ] [ / { ( { value … } ) … } ] variable
transfer function[ shift ] [ $ { ( { lag … } ) … } ] [ / { ( { lag … } ) … } ] variable
FORECASTFORECAST [ { option … } ]
option[ ALIGN =
[ [ B | BEG | BEGINNING ] |[ M | MID | MIDDLE ] |[ E | END | ENDING ]
] |ALPHA = value |BACK = value |ID = variable |INTERVAL = [ interval | value ] |LEAD = value |NOOUTALL |NOPRINT |OUT = data-set i |PRINTALL |SIGSQ = value
]
i See Output dataset.
WHEREWHERE condition ;
Reference for language elementsVersion 3.3
1329
EXPAND Procedure
Supported statements• PROC EXPAND• BY• CONVERT• ID
PROC EXPANDPROC EXPAND [ { option … } ] ;
option[ DATA = data-set i |
OUT = data-set ii |OUTEST = data-set iii |ALIGN = [ BEGINNING | MIDDLE | ENDING ] |FACTOR =
[ n |( n : m )
] |FROM = interval |TO = interval |EXTRAPOLATE |methodiv |observedv
]
i See Input dataset.ii See Output dataset.iii See Output dataset.iv See Option METHOD.v See OptionOBSERVED.
BYBY { variable-name … } ;
Reference for language elementsVersion 3.3
1330
CONVERTCONVERT { variable-name … } [ / options ] ;
options[ method
i |observedii |TRANSFORMIN = ( { operation … } ) |TRANSFORMOUT = ( { operation … } )
]
i See Option METHOD.ii See Option OBSERVED.
operation[ numeric_operations |
(C)MOV_operations |CD_operations |CU_operations |ABS |ADJUST |CEIL |[ DIF | LAG | LEAD ] [ n ] |EWMA number |EXP |FDIF d |FLOOR |FSUM d |[ HP_T | HP_C ] lambda |ILOGIT |LOG |LOGIT |MISSONLY [ mean ] |NEG |NOMISS |PCTDIF n |PCTSUM n |RATIO n |RECIPROLCAL |REVERSE |SCALE n1 n2 |
[ SEQADD |SEQDIV |
Reference for language elementsVersion 3.3
1331
SEQMINUS |SEQMULT
] sequence |SET ( n1 n2 ) |SETEMBEDDED ( n1 n2 ) |SETLEFT ( n1 n2 ) |SETMISS number |SETRIGHT ( n1 n2 ) |SIGN |SQRT |SQUARE |SUM |SUM n |TRIM n |TRIMLEFT n |TRIMRIGHT n
]
numeric operations[ + | - | * | / | MAX | MIN | > | >= | = | ^= | < | <= ] number
CD operations[ CD_I |
CD_S |CD_SA |CD_TC |CDA_I |CDA_S |CDA_SA
] s
Reference for language elementsVersion 3.3
1332
CU operations[ CUAVE |
CUCSS |CUGMEAN |CUMAX |CUMED |CUMIN |CUPROD |CURANK |CURANGE |CUSTD |CUSUM |CUTVALUE |CUUSS |CUVAR
] [ n ]
(C)MOV operations[ [ CMOVMAX |
CMOVMED |CMOVMIN |CMOVRANGE |CMOVRANK |CMOVSUM |MOVAVE |MOVMAX |MOVMED |MOVMIN |MOVRANGE |MOVRANK |MOVSUM
] n |[ CMOVAVE |
CMOVCSS |CMOVGMEAN |CMOVPROD |CMOVSTD |CMOVTVALUE |CMOVUSS |CMOVVAR |MOVAVE |MOVCSS |MOVGMEAN |MOVPROD |MOVSTD |
Reference for language elementsVersion 3.3
1333
MOVTVALUE |MOVUSS |MOVVAR
] window]
IDID variable ;
Common options
Option METHOD
METHOD =[ [ SPLINE |
JOIN |STEP |AGGREGATE |NONE
] |SPLINE (
{ NOTAKNOT |NATURAL |SLOPE = value |CURVATURE = value
,… } )]
Option OBSERVED
OBSERVED =[ observed_type |
( { observed_type, … } )]
Reference for language elementsVersion 3.3
1334
observed type[ BEGINNING |
MIDDLE |END |TOTAL |AVERAGE |DERIVATIVE
]
FORECAST Procedure
Supported statements• PROC FORECAST• BY• ID• VAR
PROC FORECASTPROC FORECAST [ { option … } ] ;
option[ ALIGN = [ BEGINNING | MIDDLE | ENDING ] |
AR = n |[ ASTART | BSTART | CSTART ] =
[ value |( { value , … } )
] |DATA = data-set i |INTERVAL = interval |INTPER = n |LEAD = n |MAXERRORS = n |METHOD =
[ STEPAR |EXPO |WINTERS |ADDWINTERS
] |
Reference for language elementsVersion 3.3
1335
NSTART = n |NSSTART = n |OUT = data-set ii |OUTACTUAL |OUTALL |OUTEST = data-set iii |OUTESTALL |OUTESTTHEIL |OUTFITSTATS |OUTFULL |OUTRESID |OUT1STEP |SEASONS = interval |SINGULAR = value |SINTPER = n |SLENTRY = value |SLSTAY = value |START = n |TREND = n |WEIGHT =
[ w |( w1 w2 ) |( w1 w2 w3 )
] |ZEROMISS
]
i See Input dataset.ii See Output dataset.iii See Output dataset.
BYBY { variable-name … } ;
IDID { variable-name … } ;
VARVAR { variable-name … } ;
Reference for language elementsVersion 3.3
1336
X12 Procedure
Supported statements• PROC X12• ADJUST• ARIMA• BY• ESTIMATE• FORECAST• ID• IDENDIFY• OUTPUT• REGRESSION• TABLES• TRANSFORM• VAR• X11
PROC X12PROC X12 [ { option … } ] ;
option[ DATA = data-set i |
[ DATE | DATEVAR ] = variable |INTERVAL = [ QTR | QUARTER | MONTH ] |NOPRINT |NOTRIMMISS |PERIODOGRAM |SEASONS = [ 4 | 12 ] |SPAN =
[ ( mmmyy , mmmyy ) |( yyQq , yyQq )
] |SPECTRUMSERIES = [ A1 | A19 | B1 | E1 ] |[ START | STARTDATE ] = [ mmmyy | "yyQq" ]
]
Reference for language elementsVersion 3.3
1337
i See Input dataset.
ADJUSTADJUST
[ PREDEFINED = [ LOM | LOQ | LPYEAR ] ] ;
ARIMAARIMA
[ MODEL = ( ( p d q )( P D Q ) s )] ;
BYBY { [ DESCENDING ] variable-name … } [ NOTSORTED ] ;
ESTIMATEESTIMATE [ { option … } ] ;
option[ ITPRINT |
MAXITER = number |PRINTERR |TOL = value
]
FORECASTFORECAST [ { option … } ] ;
Reference for language elementsVersion 3.3
1338
option[ ALPHA = value |
[ BACKCAST | NBACK | NBACKCAST ] = number |LEAD = number |[ OUTBACKCAST | OUTBKCAST ] |[ OUTFORECAST | OUTFCST ]
]
IDID { variable-name … } ;
IDENDIFYIDENDIFY [ { option … } ] ;
option[ DIFF = ( order , order , order ) |
MAXLAG = value |PRINTREG |SDIFF = ( order , order , order )
]
OUTPUTOUTPUT [ { option … } ] ;
option[ A1 |
A2 |A6 |A7 |A8 |A8AO |A8LS |A8TC |A9 |A10 |
Reference for language elementsVersion 3.3
1339
A19 |B1 |C17 |C20 |D1 |D7 |D8 |D9 |D10 |D10D |D11 |D11A |D11R |D12 |D13 |D16 |D16B |D18 |E1 |E2 |E3 |E5 |E6 |E6A |E6R |E7 |E8 |MV1 |OUT = data-set i |[ YEARSEAS | YRSEAS ]
]
i See Output dataset.
REGRESSIONREGRESSION PREDEFINED = { predefined-option … } [ / B = ( { value … } ) ] ;
predefined-option[ CONSTANT |
EASTER ( value ) |LABOR ( value ) |LOM |LOMSTOCK |
Reference for language elementsVersion 3.3
1340
LOQ |LPYEAR |SCEASTER ( value ) |SEASONAL |SCEASTER ( { value … } ) |TD |TD1COEFF |TD1NOLPYEAR |TDSTOCK ( value ) |THANK ( value )
]
TABLESTABLES [ { option … } ] ;
option[ A1 |
A19 |B1 |B2 |B3 |B4 |B5 |B6 |B7 |B8 |B9 |B10 |B11 |B13 |B14 |B15 |B16 |B17 |B18 |B19 |B20 |C1 |C2 |C4 |C5 |C6 |C9 |
Reference for language elementsVersion 3.3
1341
C10 |C13 |C14 |C15 |C16 |C17 |C18 |C19 |C20 |D1 |D2 |D4 |D5 |D6 |D7 |D8 |D9 |D10 |D11 |D12 |D13 |E1 |E2 |E3 |E4 |E5 |E6 |F1 |F2 |G0 |G1 |G2 |[ NOSUMMARY | NOSUM | NOSUMMARYLINE ]
]
TRANSFORMTRANSFORM [ { option … } ] ;
Reference for language elementsVersion 3.3
1342
option[ FUNCTION =
[ LOG |LOGISTIC |INVERSE |NONE |SQRT
] |POWER = value
]
VARVAR { variable-name … } ;
X11X11 [ { option … } ] ;
option[ FORCE = [ TOTALS | ROUND | BOTH ] |
MODE =[ ADD |
MULT |LOGADD |PSEUDOADD
] |[ OUTFORECAST | OUTFCST ] |SEASONALMA =
[ S3X1 |S3X3 |S3X5 |S3X9 |S3X15 |STABLE |X11DEFAULT |MSR
] |SIGMALIM = ( [ lower limit ] , [ upper limit ] ) |TRENDMA = value
]
Reference for language elementsVersion 3.3
1343
WPS Communicate
Global Statements
ENDRSUBMIT
ENDRSUBMIT ;
This statement indicates the end of a block of code that began with an RSUBMIT statement.
RSUBMIT
RSUBMIT [ remote-id ] [ { option … } ] ;
option[ options_A_to_M | options_N_to_Z ]
options A to M[ [ CMACVAR | MACVAR ] = 'variable-name' |
[ CONNECTPERSIST | CPERSIST | PERSIST ] = [ YES | NO ] |[ CONNECTREMOTE |
CREMOTE |REMOTE |PROCESS
] = remote-id |[ CONNECTWAIT | CWAIT | WAIT ] = [ YES | NO ] |[ CSYSRPUTSYNC | SYSRPUTSYNC ] = [ YES | NO ] |[ CSCRIPT | SCRIPT ] = signon-script |IDENTITYFILE = identity-file |LOG = [ KEEP | PURGE | filename ]
]
options N to Z[ [ NOCSCRIPT | NOSCRIPT ] |
Reference for language elementsVersion 3.3
1344
OUTPUT = [ KEEP | PURGE | filename ] |[ PASSWORD |
PASS |PASSWD |PW |PWD
] = string |[ SASCMD | LAUNCHCMD ] = 'command-name' |SIGNONWAIT = [ YES | NO ] |TBUFSIZE = [ bytes | kilobytes K | megabytes M ] |
[ UID |USER |USERID |USERNAME
] = 'string' |SSH |DEBUG
]
This statement marks the beginning of a block of program code to be submitted to a (usually remote)host for execution.
CMACVAR, MACVARThis option specifies a macro variable whose value is bound to the completion status of the currentRSUBMIT block.
CONNECTPERSIST, CPERSIST, PERSISTThis option signifies whether or not an automatic signoff occurs after a SIGNON and RSUBMIT.
CONNECTREMOTE, CREMOTE, REMOTE, PROCESSThis option identifies the remote machine to which a connection will be established, either directly or bynaming a macro variable that contains the address.
Reference for language elementsVersion 3.3
1345
Note:If the CONNECTREMOTE option is used with the name of the remote host specifically provided as amacro variable, then no ampersand should be placed before the macro variable name. The correctsyntax is illustrated in the following fragment:
...%LET HostName = RemoteHost;
options ssh_hostvalidation=none;signon connectremote=HostName ssh /* Not &HostName */user = <username>password = <password>launchcmd = '<location-of-wps-executable> -dmr';...
CONNECTWAIT, CWAIT, WAITThis option determines if the RSUBMIT block is to be run in asynchronous or synchronous mode, bysetting it to NO or YES respectively.
CSYSRPUTSYNC, SYSRPUTSYNCIf set to YES, this option forces macro variables to be defined when %SYSRPUT executes.
CSCCRIPT, SCRIPTThis option identifies a signon script.
IDENTITYFILEThis option specifies a file containing authentication information, such as SSH keys.
NOSCRIPT, NOCSCRIPTThis option indicates that no script should be used to sign on.
LOGThis option defines whether the system log should be kept, purged or sent to a specific file.
OUTPUTThis option defines whether the output of the sub-program should be kept, purged or sent to a specificfile.
PASSWORD, PASS, PASSWD, PW, PWDThis option is used to specify a password for remote authorisation.
Reference for language elementsVersion 3.3
1346
SASCMD, LAUNCHCMDWhen present, this option is used to specify the command required to launch WPS on the remotemachine.
SIGNONWAITThis option stipulates that a SIGNON should finish before permitting subsequent processing.
TBUFSIZEThis option specifies the WPS COMMUNICATE message buffer size.
UID, USER, USERID, USERNAMEWhen present, this option specifies the user name.
SSHThis option specifies that the connection will utilise the encrypted SSH protocol.
DEBUGThis option specifies that extra debugging messages are written to the sytem log.
SIGNOFF
SIGNOFF [ | remote-id | _ALL_ ] [ { option … } ] ;
option[ [ CMACVAR | MACVAR ] = 'variable-name' |
[ CONNECTREMOTE |CREMOTE |REMOTE |PROCESS
] = remote-id |[ CSCRIPT | SCRIPT ] = signon-script |[ NOCSCRIPT | NOSCRIPT ]
]
This statement closes down a connection with a remote server, following the execution of a remotelyexecuted block of code.
Reference for language elementsVersion 3.3
1347
CMACVAR, MACVARThis option specifies a macro variable associated with the remote session and whose value is bound tothe completion status of the current SIGNOFF statement.
CONNECTREMOTE, CREMOTE, REMOTE, PROCESSThis option names the remote session from which you wish to sign off.
CSCRIPT, SCRIPTThis option identifies a script to be executed during signoff.
NOSCRIPT, NOCSCRIPTThis option indicates that no script should be involved in the signoff process.
SIGNON
SIGNON [ remote-id ] [ { option … } ] ;
option[ options_A_to_O | options_P_to_Z ]
options A to O[ [ CMACVAR | MACVAR ] = 'variable-name' |
[ CONNECTREMOTE |CREMOTE |REMOTE |PROCESS
] = remote-id |[ CONNECTWAIT | CWAIT | WAIT ] = [ YES | NO ] |[ CSCRIPT | SCRIPT ] = signon-script |[ CSYSRPUTSYNC | SYSRPUTSYNC ] = [ YES | NO ] |IDENTITYFILE = identity-file |LOG = [ KEEP | PURGE | filename ] |[ NOCSCRIPT | NOSCRIPT ] |OUTPUT = [ KEEP | PURGE | filename ]
]
Reference for language elementsVersion 3.3
1348
options P to Z[ [ PASSWORD |
PASS |PASSWD |PW |PWD
] = string |[ SASCMD | LAUNCHCMD ] = 'command-name' |SIGNONWAIT = [ YES | NO ] |TBUFSIZE = [ bytes | kilobytes K | megabytes M ] |
[ UID |USER |USERID |USERNAME
] = 'string' |SSH |DEBUG
]
This statement and its options provide the information necessary to specify where the remote WPSinstallation is located, plus credentials to connect and log in to the remote server, prior to invoking ablock of remotely executed code.
CMACVAR, MACVARThis option specifies a macro variable associated with the remote session and whose value is bound tothe completion status of the current SIGNON statement.
CONNECTREMOTE, CREMOTE, REMOTE, PROCESSThis option names the remote session.
Note that if the CONNECTREMOTE option is used with the name of the remote host specifically providedas a macro variable, then (perhaps counterintuitively) no ampersand should be placed before the macrovariable name. The correct syntax is illustrated in the following fragment:
...%LET HostName = RemoteHost;
options ssh_hostvalidation=none;signon connectremote=HostName ssh /* Not &HostName */user = <username>password = <password>launchcmd = '<location-of-wps-executable> -dmr';...
Reference for language elementsVersion 3.3
1349
CONNECTWAIT, CWAIT, WAITThis option determines if the RSUBMIT block is to be run in asynchronous or synchronous mode, bysetting it to NO or YES respectively.
CSYSRPUTSYNC, SYSRPUTSYNCIf set to YES, this option forces macro variables to be defined when %SYSRPUT executes.
CSCCRIPT, SCRIPTThis option identifies a signon script.
IDENTITYFILEThis option specifies a file containing authentication information, such as SSH keys.
NOSCRIPT, NOCSCRIPTThis option indicates that no script should be used to sign on.
LOGThis option defines whether the system log should be kept, purged or sent to a specific file.
OUTPUTThis option defines whether the output of the sub-program should be kept, purged or sent to a specificfile.
PASSWORD, PASS, PASSWD, PW, PWDThis option is used to specify a password for remote authorisation.
SASCMD, LAUNCHCMDWhen present, this option is used to specify the command required to launch WPS on the remotemachine.
SIGNONWAITThis option stipulates that a SIGNON should finish before permitting subsequent processing.
TBUFSIZEThis option specifies the WPS COMMUNICATE message buffer size.
Reference for language elementsVersion 3.3
1350
UID, USER, USERID, USERNAMEWhen present, this option specifies the user name.
SSHThis option specifies that the connection will utilise the encrypted SSH protocol.
DEBUGThis option specifies that extra debugging messages are written to the sytem log.
WAITFORWAITFOR [ | _ANY_ | _ALL_ ] { remote-id … } [ TIMEOUT = seconds ] ;
In that the above diagram applies to WPS Communicate only, the WAITFOR _ALL_ statementsuspends execution of the current session until processing is complete for all of the server remote-ids, or until the TIMEOUT interval, if specified, has expired.
If you use WAITFOR _ANY_, or simply WAITFOR, instead of WAITFOR _ALL_, then execution of thesession will only be suspended until processing is complete on one of the server remote-ids (or untilthe TIMEOUT interval, if specified, has expired).
Note:As implied above, the default is _ANY_ rather than _ALL_ if no argument is supplied between WAITFORand the remote-ids.
Macro Processor Statements
%SYSLPUT%SYSLPUT
[ macro-variable = value |_ALL_ |_AUTOMATIC_ |_GLOBAL_ |_LOCAL_ |_USER_
] [ / { option … } ] ;
Reference for language elementsVersion 3.3
1351
option[ LIKE = 'pattern' | REMOTE = remote-id ]
This statement creates a macro variable on a remote host with which you have established a WPSCommunicate session. It should be placed outside of the corresponding RSUBMIT block.
%SYSRPUT%SYSRPUT macro-variable = value ;
This statement retrieves a macro variable from a remote host to which there is an established WPSCommunicate session, creating an identical local macro variable. It should be placed inside thecorresponding RSUBMIT block.
Procedures
DOWNLOAD ProcedureThis procedure downloads one or more files, libraries or datasets from a remote host. It can only beinvoked from inside an RSUBMIT block.
Supported statements• PROC DOWNLOAD• EXCLUDE• SELECT• WHERE
PROC DOWNLOADPROC DOWNLOAD [ { option … } ] ;
option[ AFTER = numeric |
BINARY |DATA = server-data-set [ ( dataset-options ) ] |
Reference for language elementsVersion 3.3
1352
DATECOPY |EXTENDSN = [ NO | YES ] |INDEX = [ NO | YES ] |INFILE = server-file-reference |[ INLIB | IN | INDD ] = server-library-name |MEMTYPE =
[ ALL |CATALOG |DATA |MDDB |VIEW
] |OUT = [ library.dataset | dataset ] [ ( dataset-options ) ] |OUTFILE = client-file-reference |[ OUTLIB | OUTDD | OUT ] = client-library-name |V6TRANSPORT
]
AFTERSpecifies a numeric modification date, ensuring that only datasets or libraries modified after this dateare downloaded. This option is invalid for external file downloads.
BINARYValid only when downloading external files, this option specifies that the transfer should be an exact,binary copy.
DATASpecifies the name of a dataset to be downloaded.
DATECOPYWhen present, this option indicates that a remote dataset's creation date and time should be retainedwhen it is downloaded. This option is invalid for external file downloads.
EXTENDSNSpecifies if short numeric variables should have their lengths extended. This option is invalid forexternal file downloads and might be considered if transferring datasets from a mainframe to a PC.
INDEXFor remote datasets that have indexes, this indicates whether these indexes should be re-establishedon the local machine after the download. This option is invalid for external files downloads.
Reference for language elementsVersion 3.3
1353
INFILESpecifies the name of a remote external file to download. If this option is present, so must theOUTFILE= option be.
INLIBSpecifies the name of the remote library. This option is invalid for external file downloads.
OUTSpecifies the name of the receiving local dataset. This option is invalid for external file downloads.
OUTFILESpecifies the name of local file to receive an external file download. If this option is present, so must theINFILE option be.
OUTLIBSpecifies the name of the local library into which a remote dataset is downloaded. This option is invalidfor external file downloads.
V6TRANSPORTThis is a translation option when exchanging data between two different versions.
EXCLUDEEXCLUDE { data-set … } [ / option ] ;
data-setdata-set-name [ : ]
[ ( [ MEMTYPE | MTYPE | M ] = [ DATA | VIEW | CATALOG ] )]
optionMEMTYPE = [ DATA | VIEW | CATALOG | ALL ]
MEMTYPEThis option specifies the member types to be downloaded - see the syntax diagram above. This optionis invalid for external file downloads.
Reference for language elementsVersion 3.3
1354
SELECTSELECT { data-set … } [ / option ] ;
data-setdata-set-name [ : ]
[ ( [ MEMTYPE | MTYPE | M ] = [ DATA | VIEW | CATALOG ] )]
optionMEMTYPE = [ DATA | VIEW | CATALOG | ALL ]
MEMTYPESee statement EXCLUDE.
WHEREWHERE condition ;
UPLOAD ProcedureThis procedure uploads one or more files, libraries or datasets to a remote host. It can only be invokedfrom inside an RSUBMIT block.
Supported statements• PROC UPLOAD• EXCLUDE• SELECT• WHERE
PROC UPLOADPROC UPLOAD [ { option … } ] ;
Reference for language elementsVersion 3.3
1355
option[ AFTER = numeric |
BINARY |DATA = client-data-set |DATECOPY |EXTENDSN = [ NO | YES ] |INDEX = [ NO | YES ] |INFILE = client-file-reference |[ INLIB | IN | INDD ] = client-library-name |MEMTYPE =
[ ALL |CATALOG |DATA |MDDB |VIEW
] |OUT = [ library.dataset | dataset ] [ ( dataset-options ) ] |[ OUTLIB | OUTDD | OUT ] = server-library-name |OUTFILE = server-file-reference |V6TRANSPORT
]
AFTERSpecifies a numeric modification date, ensuring that only datasets or libraries modified after this dateare uploaded. This option is invalid for external file uploads.
BINARYValid only when uploading external files, this option specifies that the transfer should be an exact,binary copy.
DATASpecifies the name of a dataset to be uploaded.
DATECOPYWhen present, this option indicates that a local dataset's creation date and time should be retainedwhen it is uploaded. This option is invalid for external file uploads.
EXTENDSNSpecifies if short numeric variables should have their lengths extended. This option is invalid forexternal file uploads and might be considered if transferring datasets to a mainframe from a PC.
Reference for language elementsVersion 3.3
1356
INDEXFor local datasets that have indexes, this indicates whether these indexes should be re-established onthe remote machine after the upload. This option is invalid for external files uploads.
INFILESpecifies the name of a local external file to upload. If this option is present, so must the OUTFILE=option be.
INLIBSpecifies the name of the local library. This option is invalid for external file uploads.
MEMTYPEThis option specifies the member types to be uploaded - see the syntax diagram above. This option isinvalid for external file uploads.
OUTSpecifies the name of the receiving remote dataset. This option is invalid for external file uploads.
OUTFILESpecifies the name of remote file to receive an external file upload. If this option is present, so must theINFILE option be.
OUTLIBSpecifies the name of the remote library into which a local dataset is uploaded. This option is invalid forexternal file uploads.
V6TRANSPORTThis is a translation option when exchanging data between two different versions.
EXCLUDEEXCLUDE { data-set … } [ / option ] ;
data-setdata-set-name [ : ]
[ ( [ MEMTYPE | MTYPE | M ] = [ DATA | VIEW | CATALOG ] )]
Reference for language elementsVersion 3.3
1357
optionMEMTYPE = [ DATA | VIEW | CATALOG | ALL ]
SELECTSELECT { data-set … } [ / option ] ;
data-setdata-set-name [ : ]
[ ( [ MEMTYPE | MTYPE | M ] = [ DATA | VIEW | CATALOG ] )]
optionMEMTYPE = [ DATA | VIEW | CATALOG | ALL ]
WHEREWHERE condition ;
System Options
AUTOSIGNON[ AUTOSIGNON | NOAUTOSIGNON ]
Valid in: OPTIONS statement, configuration file and command lineDefault: NOAUTOSIGNON
DescriptionWhen this system option is active, remote submit will attempt to automatically sign on.
Reference for language elementsVersion 3.3
1358
COMAMIDCOMAMID = communication-method
Valid in: OPTIONS statement, configuration file and command lineDefault: TCPMax length: 8
DescriptionThis system option specifies the communication method to use for establishing remotecommunications.
CONNECTPERSIST[ CONNECTPERSIST | NOCONNECTPERSIST ]
Valid in: OPTIONS statement, configuration file and command lineDefault: CONNECTPERSIST
DescriptionWhen set, this system option specifies that a remote connection will be persisted after an RSUBMITblock. This system option is an alias of CPERSIST.
CONNECTREMOTECONNECTREMOTE = server-name
Valid in: OPTIONS statement, configuration file and command lineDefault: blankMax length: 1024
DescriptionThis system option identifies a specific remote server to connect to. It is blank (empty string) by default.
Reference for language elementsVersion 3.3
1359
DMR[ DMR | NODMR ]
Valid in: Command line onlyDefault: NODMR
DescriptionThis sytem option invokes a WPS COMMUNICATE server session. It is inactive by default and can beeffected only via the command line.
SASCMDSASCMD = command
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 32767
DescriptionThis system option specifies the command to be used by WPS COMMUNICATE to start another localWPS session. It is blank (empty string) by default.
SASSCRIPTSASSCRIPT = ( { location … } )
Valid in: OPTIONS statement, configuration file and command lineDefault: ""Max length: 1024
DescriptionThis system option specifies the location of the WPS COMMUNICATE signon scripts. It is blank (emptystring) by default.
Reference for language elementsVersion 3.3
1360
Data Engines
WPS Engine for Access
ACCESS
LIBNAME library-name ACCESS [ filepath ] [ Connection-options | Sql-generation | Sql-transaction ] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
dbpassword
[ DBPASSWORD | DBPWD | DBPW ] = passwd
Type: String
dbsysfile
[ DBSYSFILE | DBSYS | WGB ] = string
Type: String
init_string
[ INIT_STRING | INIT ] = initialisation-options
Type: String
msengine
MSENGINE = [ ACE | JET ]
password
[ PASSWORD | PWD | PW ] = passwd
Reference for language elementsVersion 3.3
1361
Type: String
path
[ PATH | DS | DATASRC ] = datasource-name
Type: String
prompt
PROMPT =[ NO |
NOPROMPT |REQUIRED |UDL |YES
]
udl
[ UDL | UDL_FILE ] = filepath
Type: String
user
[ USER | UID | USERID ] = oneWord
Type: String
SQL generation
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
Reference for language elementsVersion 3.3
1362
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
label
LABEL
Type: Keyword
replace
REPLACE
Type: Keyword
stringdates
[ STRINGDATES | STRDATES ] = [ NO | YES ]
use_datetype
[ USE_DATETYPE | USE_DATE | USEDATE ] = [ NO | YES ]
SQL transaction
command_timeout
[ COMMAND_TIMEOUT | TIMEOUT ] = duration
Type: Numeric
Minimum value: 0
Reference for language elementsVersion 3.3
1363
cursor_type
CURSOR_TYPE = [ KEYSET_DRIVEN | STATIC ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Minimum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 0
scan_textsize
[ SCAN_TEXTSIZE |SCAN_TEXT |SCANMEMO |SCANTEXT
] = [ NO | YES ]
scan_timetype
[ SCAN_TIMETYPE | SCAN_TIME | SCANTIME ] = [ ANY | NO | YES ]
spool
SPOOL = [ NO | YES ]
Reference for language elementsVersion 3.3
1364
WPS Engine for Actian Matrix
ACTIANMATRIX
LIBNAME library-name [ ACTIANMATRIX | PARACCEL | ACMATRIX ] [ Connection-options |
Sql-generation |Sql-metadata |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
database
[ DATABASE | DB ] = database-name
Type: String
datasrc
[ DATASRC | DSN | DS ] = datasource-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
Reference for language elementsVersion 3.3
1365
dbconterm
DBCONTERM = termination-options
Type: String
driver
DRIVER = driver-name
Type: String
password
[ PASSWORD |PWD |PW |PASS |USING
] = user-passwd
Type: String
port
PORT = port-number
Type: String
schema
SCHEMA = schema-name
Type: String
server
[ SERVER | HOST ] = remote-id
Type: String
use_odbc_cl
USE_ODBC_CL = [ NO | YES ]
user
[ USER | UID ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Reference for language elementsVersion 3.3
1366
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
quote_char
QUOTE_CHAR = character
Type: String
Reference for language elementsVersion 3.3
1367
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
SQL metadata
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Reference for language elementsVersion 3.3
1368
Type: Numeric
Minimum value: 1
Minimum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Minimum value: 32767
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Minimum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
tracefile
TRACEFILE = filepath
Type: String
Reference for language elementsVersion 3.3
1369
WPS Engine for DB2
DB2
LIBNAME library-name DB2[ Connection-options |
Bulkload-options |Libname-options |Sql-generation |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
complete
COMPLETE = complete-options
Type: String
This option can only be used on 32-bit Windows, 64-bit Windows.
databasename
DATABASENAME = database-name
Type: String
datasrc
[ DATASRC | DSN | DATABASE ] = string
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Reference for language elementsVersion 3.3
1370
Type: String
noprompt
NOPROMPT = noprompt-options
Type: String
password
PASSWORD = user-passwd
Type: String
prompt
PROMPT = prompt-options
Type: String
This option can only be used on 32-bit Windows, 64-bit Windows.
required
REQUIRED = required-options
Type: String
This option can only be used on 32-bit Windows, 64-bit Windows.
servername
SERVERNAME = remote-id
Type: String
user
USER = user-name
Type: String
Bulkload options
bl_allow_read_access
BL_ALLOW_READ_ACCESS = [ NO | YES ]
bl_cpu_parallelism
BL_CPU_PARALLELISM = cpu-count
Type: Numeric
Minimum value: 30
Reference for language elementsVersion 3.3
1371
bl_data_buffer_size
BL_DATA_BUFFER_SIZE = buffer-size
Type: Numeric
bl_disk_parallelism
BL_DISK_PARALLELISM = disk-count
Type: Numeric
bl_indexing_mode
BL_INDEXING_MODE =[ AUTOSELECT |
DEFERRED |INCREMENTAL |REBUILD
]
bl_load_replace
BL_LOAD_REPLACE = [ NO | YES ]
bl_log
BL_LOG = filepath
Type: String
bl_method
BL_METHOD = CLILOAD
bl_recoverable
BL_RECOVERABLE = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
Libname Options
Reference for language elementsVersion 3.3
1372
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
cursor_type
CURSOR_TYPE =[ DYNAMIC |
FORWARD_ONLY |KEYSET_DRIVEN |STATIC
]
dbindex
DBINDEX = [ NO | YES ]
dbsaslabel
DBSASLABEL = [ COMPAT | NONE ]
dbsliceparm
DBSLICEPARM = { ALL | NONE | THREADED_APPS … }
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
in
IN = string
Type: String
port
PORT = port-number
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
Reference for language elementsVersion 3.3
1373
read_isolation_level
READ_ISOLATION_LEVEL =[ COMMITTEDREAD |
CS |NONE |READCOMMITTED |READSTABILITY |READSTABILITY KEEP UPDATE LOCKS |READUNCOMMITTED |REPEATABLEREAD |REPEATABLEREAD KEEP UPDATE LOCKS |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UNCOMMITTEDREAD |UR
]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
schema
[ SCHEMA | AUTHID ] = schema-name
Type: String
sql_functions
SQL_FUNCTIONS = ALL
stringdates
STRINGDATES = [ NO | YES ]
update_isolation_level
UPDATE_ISOLATION_LEVEL =[ COMMITTEDREAD |
CS |NONE |READCOMMITTED |READSTABILITY |READSTABILITY KEEP UPDATE LOCKS |READUNCOMMITTED |REPEATABLEREAD |REPEATABLEREAD KEEP UPDATE LOCKS |
Reference for language elementsVersion 3.3
1374
RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UNCOMMITTEDREAD |UR
]
update_lock_type
UPDATE_LOCK_TYPE = [ LUW | NOLOCK | ROW | TABLE ]
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
dbnullkeys
DBNULLKEYS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… }
Reference for language elementsVersion 3.3
1375
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL metadatapreserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Minimum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
readbuff
READBUFF = buffer-size
Reference for language elementsVersion 3.3
1376
Type: Numeric
Minimum value: 1
spool
SPOOL = [ DBMS | NO | YES ]
DB2 dataset options
bulkload
BULKLOAD = [ NO | YES ]
cursor_type
CURSOR_TYPE =[ DYNAMIC |
FORWARD_ONLY |KEYSET_DRIVEN |STATIC
]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
dbindex
DBINDEX = [ NO | YES ]
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Reference for language elementsVersion 3.3
1377
dbnull
DBNULL = None
dbnullkeys
DBNULLKEYS = [ NO | YES ]
dbsaslabel
DBSASLABEL = [ COMPAT | NONE ]
dbslice
DBSLICE = ( { Where-clause … } )
dbsliceparm
DBSLICEPARM =[ NONE |
THREADED_APPS |ALL |( [ THREADED_APPS | ALL ] [ | , max-threads | max-threads ] )
]
dbtype
DBTYPE = ( { column-name = DBMS-type … } )
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
in
IN = in-options
Type: String
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
Reference for language elementsVersion 3.3
1378
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
read_isolation_level
READ_ISOLATION_LEVEL =[ COMMITTEDREAD |
CS |NONE |READCOMMITTED |READSTABILITY |READSTABILITY KEEP UPDATE LOCKS |READUNCOMMITTED |REPEATABLEREAD |REPEATABLEREAD KEEP UPDATE LOCKS |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UNCOMMITTEDREAD |UR
]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
schema
[ SCHEMA | AUTHID ] = None
Type: String
update_isolation_level
UPDATE_ISOLATION_LEVEL =[ COMMITTEDREAD |
CS |NONE |READCOMMITTED |READSTABILITY |READSTABILITY KEEP UPDATE LOCKS |READUNCOMMITTED |REPEATABLEREAD |REPEATABLEREAD KEEP UPDATE LOCKS |
Reference for language elementsVersion 3.3
1379
RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UNCOMMITTEDREAD |UR
]
update_lock_type
UPDATE_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
DB2OLD
LIBNAME library-name DB2OLD[ Connection-options |
Bulkload-options |Libname-options |Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
complete
COMPLETE = option-list
Type: String
This option can only be used on 32-bit Windows, 64-bit Windows.
Reference for language elementsVersion 3.3
1380
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
databasename
DATABASENAME = database-name
Type: String
datasrc
[ DATASRC | DSN | DATABASE ] = datasource-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
noprompt
NOPROMPT = option-list
Type: String
password
PASSWORD = user-passwd
Type: String
prompt
PROMPT = option-list
Type: String
This option can be used on 32-bit Windows, 64-bit Windows.
Reference for language elementsVersion 3.3
1381
required
REQUIRED = option-list
Type: String
This option can be used on 32-bit Windows, 64-bit Windows.
schema
[ SCHEMA | AUTHID ] = shema-name
Type: String
servername
SERVERNAME = remote-id
Type: String
user
USER = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
bl_allow_read_access
BL_ALLOW_READ_ACCESS = [ NO | YES ]
bl_cpu_parallelism
BL_CPU_PARALLELISM = cpu-count
Type: Numeric
bl_data_buffer_size
BL_DATA_BUFFER_SIZE = buffer-size
Type: Numeric
bl_disk_parallelism
BL_DISK_PARALLELISM = disk-count
Type: Numeric
Reference for language elementsVersion 3.3
1382
bl_indexing_mode
BL_INDEXING_MODE =[ AUTOSELECT |
DEFERRED |INCREMENTAL |REBUILD
]
bl_load_replace
BL_LOAD_REPLACE = [ NO | YES ]
bl_log
BL_LOG = filepath
Type: String
bl_method
BL_METHOD = CLILOAD
bl_recoverable
BL_RECOVERABLE = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
Libname Options
cursor_type
CURSOR_TYPE =[ DYNAMIC |
FORWARD_ONLY |KEYSET_DRIVEN |STATIC
]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
Reference for language elementsVersion 3.3
1383
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
Reference for language elementsVersion 3.3
1384
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Minimum value: 32767
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
in
IN = in-options
Type: String
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Reference for language elementsVersion 3.3
1385
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
spool
SPOOL = [ DBMS | NO | YES ]
Table locking options
read_isolation_level
READ_ISOLATION_LEVEL =[ CS |
NONE |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UR
]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
update_isolation_level
UPDATE_ISOLATION_LEVEL =[ CS |
NONE |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UR
]
update_lock_type
UPDATE_LOCK_TYPE = [ LUW | NOLOCK | ROW | TABLE ]
Reference for language elementsVersion 3.3
1386
DB2 (for z/OS)
LIBNAME library-name DB2[ Connection-options |
Bulkload-options |Libname-options |Sql-generation |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
databasename
DATABASENAME = database-name
Type: String
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
location
LOCATION = location-options
Type: String
password
PASSWORD = user-passwd
Reference for language elementsVersion 3.3
1387
Type: String
prompt
PROMPT = prompt-options
Type: String
This option can be used on 32-bit Windows, 64-bit Windows.
server
SERVER = remote-id
Type: String
ssid
SSID = ssid-options
Type: String
user
USER = user-name
Type: String
Libname Options
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
dbsaslabel
DBSASLABEL = [ COMPAT | NONE ]
dbsliceparm
DBSLICEPARM = { ALL | NONE | THREADED_APPS … }
degree
DEGREE = [ 1 | ANY ]
Reference for language elementsVersion 3.3
1388
in
IN = string
Type: String
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
read_isolation_level
READ_ISOLATION_LEVEL =[ COMMITTEDREAD |
CS |NONE |READCOMMITTED |READSTABILITY |READSTABILITY KEEP UPDATE LOCKS |READUNCOMMITTED |REPEATABLEREAD |REPEATABLEREAD KEEP UPDATE LOCKS |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UNCOMMITTEDREAD |UR
]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
schema
[ SCHEMA | AUTHID ] = schema-name
Type: String
sql_functions
SQL_FUNCTIONS = ALL
Reference for language elementsVersion 3.3
1389
update_isolation_level
UPDATE_ISOLATION_LEVEL =[ COMMITTEDREAD |
CS |NONE |READCOMMITTED |READSTABILITY |READSTABILITY KEEP UPDATE LOCKS |READUNCOMMITTED |REPEATABLEREAD |REPEATABLEREAD KEEP UPDATE LOCKS |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UNCOMMITTEDREAD |UR
]
update_lock_type
UPDATE_LOCK_TYPE = [ LUW | NOLOCK | ROW | TABLE ]
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
dbnullkeys
DBNULLKEYS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1390
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… }
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL transaction
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
spool
SPOOL = [ DBMS | NO | YES ]
DB2 dataset options (for z/OS)
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
Reference for language elementsVersion 3.3
1391
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
dbnull
DBNULL = None
dbnullkeys
DBNULLKEYS = [ NO | YES ]
dbsaslabel
DBSASLABEL = [ COMPAT | NONE ]
dbslice
DBSLICE = ( { Where-clause … } )
dbsliceparm
DBSLICEPARM =[ NONE |
THREADED_APPS |ALL |( [ THREADED_APPS | ALL ] [ | , max-threads | max-threads ] )
]
dbtype
DBTYPE = ( { column-name = DBMS-type … } )
degree
DEGREE = [ 1 | ANY ]
in
IN = in-options
Type: String
location
LOCATION = location-options
Reference for language elementsVersion 3.3
1392
Type: String
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
read_isolation_level
READ_ISOLATION_LEVEL =[ COMMITTEDREAD |
CS |NONE |READCOMMITTED |READSTABILITY |READSTABILITY KEEP UPDATE LOCKS |READUNCOMMITTED |REPEATABLEREAD |REPEATABLEREAD KEEP UPDATE LOCKS |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UNCOMMITTEDREAD |UR
]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
schema
[ SCHEMA | AUTHID ] = None
Type: String
update_isolation_level
UPDATE_ISOLATION_LEVEL =[ COMMITTEDREAD |
CS |NONE |READCOMMITTED |
Reference for language elementsVersion 3.3
1393
READSTABILITY |READSTABILITY KEEP UPDATE LOCKS |READUNCOMMITTED |REPEATABLEREAD |REPEATABLEREAD KEEP UPDATE LOCKS |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UNCOMMITTEDREAD |UR
]
update_lock_type
UPDATE_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
DB2OLD (for z/OS)
LIBNAME library-name DB2OLD[ Connection-options |
Libname-options |Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
Reference for language elementsVersion 3.3
1394
databasename
DATABASENAME = database-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
password
PASSWORD = user-passwd
Type: String
schema
[ SCHEMA | AUTHID ] = shema-name
Type: String
server
SERVER = remote-id
Type: String
user
USER = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Libname Options
degree
DEGREE = [ 1 | ANY ]
Reference for language elementsVersion 3.3
1395
location
LOCATION = remote-id
Type: String
ssid
SSID = remote-id
Type: String
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
Reference for language elementsVersion 3.3
1396
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Minimum value: 32767
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
spool
SPOOL = [ DBMS | NO | YES ]
Reference for language elementsVersion 3.3
1397
Table locking options
read_isolation_level
READ_ISOLATION_LEVEL =[ CS |
NONE |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UR
]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
update_isolation_level
UPDATE_ISOLATION_LEVEL =[ CS |
NONE |RR |RR KEEP UPDATE LOCKS |RS |RS KEEP UPDATE LOCKS |UR
]
update_lock_type
UPDATE_LOCK_TYPE = [ LUW | NOLOCK | ROW | TABLE ]
DB2EXT Procedure
Supported statements• PROC DB2EXT• FMT• RENAME• SELECT• EXIT
Reference for language elementsVersion 3.3
1398
PROC DB2EXTPROC DB2EXT
[ options [ OUT = data-set | SSID ] ] ;
FMTFMT { column-index = "format-name" … } ;
RENAMERENAME { column-index = column-name … } ;
SELECTSELECT db2-sql-query ;
EXITEXIT ;
WPS Engine for Excel
EXCEL
LIBNAME library-name EXCEL [ filepath ] [ Connection-options | Sql-generation | Sql-transaction ] ;
Connection options
Reference for language elementsVersion 3.3
1399
access
ACCESS = READONLY
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
header
HEADER = [ NO | YES ]
init_string
[ INIT_STRING | INIT ] = initialisation-options
Type: String
mixed
MIXED = [ NO | YES ]
msengine
MSENGINE = [ ACE | JET ]
path
[ PATH | DS | DATASRC ] = datasource-name
Type: String
prompt
PROMPT =[ NO |
NOPROMPT |REQUIRED |UDL |YES
]
replace
REPLACE
Type: Keyword
udl
[ UDL | UDL_FILE ] = filepath
Type: String
Reference for language elementsVersion 3.3
1400
version
[ VERSION | VER ] = engine-version
SQL generation
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
label
LABEL
Type: Keyword
stringdates
[ STRINGDATES | STRDATES ] = [ NO | YES ]
use_datetype
[ USE_DATETYPE | USE_DATE | USEDATE ] = [ NO | YES ]
SQL transaction
Reference for language elementsVersion 3.3
1401
command_timeout
[ COMMAND_TIMEOUT | TIMEOUT ] = duration
Type: Numeric
Minimum value: 0
cursor_type
CURSOR_TYPE = [ KEYSET_DRIVEN | STATIC ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 0
scan_textsize
[ SCAN_TEXTSIZE |SCAN_TEXT |SCANMEMO |SCANTEXT
] = [ NO | YES ]
Reference for language elementsVersion 3.3
1402
scan_timetype
[ SCAN_TIMETYPE | SCAN_TIME | SCANTIME ] = [ ANY | NO | YES ]
spool
SPOOL = [ NO | YES ]
XLSX
LIBNAME library-name [ XLSX | XLS ] filepath Libname-options ;
Libname Options
access
ACCESS = READONLY
date_format
DATE_FORMAT = excel-format
Type: String
datetime_format
DATETIME_FORMAT = excel-format
Type: String
header
HEADER = [ NO | YES ]
noreplace
NOREPLACE
Type: Keyword
replace
REPLACE
Type: Keyword
time_format
TIME_FORMAT = excel-format
Reference for language elementsVersion 3.3
1403
Type: String
XLSX Dataset Options
xlsx_format
XLSX_FORMAT = None
WPS Engine for Greenplum
GREENPLUM
LIBNAME library-name [ GREENPLUM | GREENPLM ] [ Connection-options |
Bulkload-options |Sql-generation |Sql-metadata |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
database
DATABASE = database-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Reference for language elementsVersion 3.3
1404
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
host
HOST = remote-id
Type: String
options
OPTIONS = option-list
Type: String
password
PASSWORD = user-passwd
Type: String
port
PORT = port-number
Type: String
schema
SCHEMA = schema-name
Type: String
tty
TTY = option-list
Type: String
user
USER = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Reference for language elementsVersion 3.3
1405
Bulkload options
bl_buffersize
BL_BUFFERSIZE = buffer-size
Type: String
bl_delimiter
BL_DELIMITER = delimiter-value
Type: String
bl_nullstring
BL_NULLSTRING = nullstring-value
Type: String
bulkload
BULKLOAD = [ NO | YES ]
bulkunload
BULKUNLOAD = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
dbmstemp
DBMSTEMP = [ NO | YES ]
dbnullkeys
DBNULLKEYS = [ NO | YES ]
dbsaslabel
DBSASLABEL = [ NO | YES ]
Reference for language elementsVersion 3.3
1406
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
SQL metadata
Reference for language elementsVersion 3.3
1407
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
Reference for language elementsVersion 3.3
1408
Default value: 1
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
WPS Engine for Hadoop
HADOOP
LIBNAME library-name HADOOP[ Connection-options |
Bulkload-options |Sql-generation |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
bl_port
[ BL_PORT | BULKLOAD_PORT ] = port-number
Type: Numeric
config
CONFIG = option-list
Type: String
datasrc
[ DATASRC | DSN | DS ] = datasource-name
Type: String
Reference for language elementsVersion 3.3
1409
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
hive_principal
HIVE_PRINCIPAL = string
Type: String
jdbc_connection_string
JDBC_CONNECTION_STRING = option-list
Type: String
jdbc_driver
JDBC_DRIVER = driver-name
Type: String
password
[ PASSWORD |PWD |PW |PASS |USING
] = user-passwd
Type: String
port
PORT = port-number
Type: Numeric
schema
[ SCHEMA | DB | DATABASE ] = schema-name
Type: String
Reference for language elementsVersion 3.3
1410
server
[ SERVER | HOST ] = remote-id
Type: String
user
[ USER | UID ] = user-name
Type: String
Bulkload options
bulkload
BULKLOAD = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1411
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL transaction
hdfs_tempdir
HDFS_TEMPDIR = directory-path
Type: String
spool
SPOOL = [ DBMS | NO | YES ]
Reference for language elementsVersion 3.3
1412
WPS Engine for Informix
INFORMIX
LIBNAME library-name INFORMIX[ Connection-options |
Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
dbdatasrc
[ DBDATASRC | DSN ] = datasource-name
Type: String
schema
SCHEMA = schema-name
Type: String
Reference for language elementsVersion 3.3
1413
server
SERVER = remote-id
Type: String
user
USER = user-name
Type: String
using
[ USING | PWD | PASSWORD ] = passwd
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
dbsaslabel
DBSASLABEL = [ COMPAT | NONE ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1414
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
Reference for language elementsVersion 3.3
1415
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
spool
SPOOL = [ DBMS | NO | YES ]
Table locking options
locktable
LOCKTABLE = [ EXCLUSIVE | SHARE ]
locktime
LOCKTIME = duration
Type: Numeric
lockwait
LOCKWAIT = [ NO | YES ]
read_isolation_level
READ_ISOLATION_LEVEL =[ COMMITTED_READ |
CURSOR_STABILITY |DIRTY_READ |REPEATABLE_READ
]
Reference for language elementsVersion 3.3
1416
WPS Engine for Kognito
KOGNITIO
LIBNAME library-name KOGNITIO[ Connection-options |
Sql-generation |Sql-metadata |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
database
[ DATABASE | DB ] = database-name
Type: String
datasrc
[ DATASRC | DSN | DS ] = datasource-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
Reference for language elementsVersion 3.3
1417
dbconterm
DBCONTERM = termination-options
Type: String
driver
DRIVER = string
Type: String
password
[ PASSWORD |PWD |PASS |PW |USING
] = user-passwd
Type: String
port
PORT = port-number
Type: String
schema
SCHEMA = schema-name
Type: String
server
[ SERVER | HOST ] = remote-id
Type: String
use_odbc_cl
USE_ODBC_CL = [ NO | YES ]
user
[ USER | UID ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Reference for language elementsVersion 3.3
1418
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
quote_char
QUOTE_CHAR = character
Type: String
Reference for language elementsVersion 3.3
1419
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
SQL metadata
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Reference for language elementsVersion 3.3
1420
Type: Numeric
Minimum value: 1
Maximum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
tracefile
TRACEFILE = filepath
Type: String
Reference for language elementsVersion 3.3
1421
WPS Engine for MySQL
MYSQL
LIBNAME library-name MYSQL[ Connection-options |
Bulkload-options |Sql-generation |Sql-metadata |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
database
DATABASE = database-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
password
PASSWORD = user-passwd
Type: String
Reference for language elementsVersion 3.3
1422
port
PORT = port-number
Type: Numeric
Minimum value: 0
Default value: 3306
server
SERVER = remote-id
Type: String
timeout
TIMEOUT = duration
Type: Numeric
Minimum value: 1
Maximum value: 1000
Default value: 15
user
USER = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
bl_buffersize
BL_BUFFERSIZE = buffer-size
Type: String
bl_datafile
BL_DATAFILE = filepath
Type: String
bl_delete_datafile
BL_DELETE_DATAFILE = [ NO | YES ]
Reference for language elementsVersion 3.3
1423
bl_local
BL_LOCAL = [ NO | YES ]
bl_use_pipe
BL_USE_PIPE = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbdatetime_type
DBDATETIME_TYPE = [ DATETIME | TIMESTAMP ]
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1424
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
qualifier
QUALIFIER = qualifer-name
Type: String
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
Reference for language elementsVersion 3.3
1425
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
Default value: 1000
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
Default value: 1024
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
Reference for language elementsVersion 3.3
1426
WPS Engine for Netezza
NETEZZA
LIBNAME library-name NETEZZA[ Connection-options |
Bulkload-options |Sql-generation |Sql-metadata |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
database
[ DATABASE | DB ] = database-name
Type: String
datasrc
[ DATASRC | DSN | DS ] = datasource-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
Reference for language elementsVersion 3.3
1427
dbconterm
DBCONTERM = termination-options
Type: String
password
[ PASSWORD |PWD |PW |PASS |USING
] = user-passwd
Type: String
port
PORT = port-number
Type: String
schema
SCHEMA = schema-name
Type: String
server
[ SERVER | HOST ] = remote-id
Type: String
use_odbc_cl
USE_ODBC_CL = [ NO | YES ]
user
[ USER | UID ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
Reference for language elementsVersion 3.3
1428
bl_buffersize
[ BL_BUFFERSIZE | BL_BUFFSIZE ] = buffer-size
Type: String
bl_datafile
BL_DATAFILE = filepath
Type: String
bl_delete_datafile
BL_DELETE_DATAFILE = [ NO | YES ]
bl_delimiter
BL_DELIMITER = string
Type: String
bl_options
BL_OPTIONS = bulkload-options
Type: String
bl_pipe_name
BL_PIPE_NAME = string
Type: String
bl_use_pipe
BL_USE_PIPE = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
bulkunload
BULKUNLOAD = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
Reference for language elementsVersion 3.3
1429
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
qualifier
QUALIFIER = qualifer-name
Type: String
quote_char
QUOTE_CHAR = character
Type: String
sql_functions
SQL_FUNCTIONS = ALL
Reference for language elementsVersion 3.3
1430
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
Reference for language elementsVersion 3.3
1431
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
tracefile
TRACEFILE = filepath
Type: String
Reference for language elementsVersion 3.3
1432
NETEZZAM
LIBNAME library-name NETEZZAM[ Connection-options |
Bulkload-options |Sql-generation |Sql-metadata |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
database
[ DATABASE | DB ] = database-name
Type: String
datasrc
[ DATASRC | DSN | DS ] = datasource-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
Reference for language elementsVersion 3.3
1433
password
[ PASSWORD |PWD |PW |PASS |USING
] = user-passwd
Type: String
port
PORT = port-number
Type: String
schema
SCHEMA = schema-name
Type: String
server
[ SERVER | HOST ] = remote-id
Type: String
use_odbc_cl
USE_ODBC_CL = [ NO | YES ]
user
[ USER | UID ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
bl_buffersize
[ BL_BUFFERSIZE | BL_BUFFSIZE ] = buffer-size
Type: String
Reference for language elementsVersion 3.3
1434
bl_datafile
BL_DATAFILE = filepath
Type: String
bl_delete_datafile
BL_DELETE_DATAFILE = [ NO | YES ]
bl_delimiter
BL_DELIMITER = string
Type: String
bl_options
BL_OPTIONS = bulkload-options
Type: String
bl_pipe_name
BL_PIPE_NAME = string
Type: String
bl_use_pipe
BL_USE_PIPE = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
bulkunload
BULKUNLOAD = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
Reference for language elementsVersion 3.3
1435
dbnullkeys
DBNULLKEYS = [ NO | YES ]
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… }
qualifier
QUALIFIER = qualifer-name
Type: String
quote_char
QUOTE_CHAR = character
Type: String
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
Reference for language elementsVersion 3.3
1436
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
Reference for language elementsVersion 3.3
1437
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
tracefile
TRACEFILE = filepath
Type: String
WPS Engine for ODBC
ODBC
LIBNAME library-name ODBC[ Connection-options |
Bulkload-options |Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Reference for language elementsVersion 3.3
1438
Connection options
access
ACCESS = READONLY
complete
COMPLETE = string
Type: String
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
datasrc
[ DATASRC | DSN | DS | DATABASE ] = datasource-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
noprompt
NOPROMPT = option-list
Type: String
Reference for language elementsVersion 3.3
1439
password
[ PASSWORD |PWD |PW |PASS |USING
] = user-passwd
Type: String
prompt
PROMPT = option-list
Type: String
required
REQUIRED = option-list
Type: String
schema
SCHEMA = schema-name
Type: String
use_odbc_cl
USE_ODBC_CL = [ NO | YES ]
user
[ USER | UID ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
bl_log
BL_LOG = filepath
Type: String
This option can be used on 32-bit Windows, 64-bit Windows.
Reference for language elementsVersion 3.3
1440
bl_options
BL_OPTIONS = options-list
Type: String
This option can be used on 32-bit Windows, 64-bit Windows.
bulkload
[ BULKLOAD | BCP ] = [ NO | YES ]
This option can be used on 32-bit Windows, 64-bit Windows.
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1441
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
insert_sql
INSERT_SQL = [ NO | YES ]
qualifier
QUALIFIER = qualifer-name
Type: String
quote_char
QUOTE_CHAR = character
Type: String
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
Reference for language elementsVersion 3.3
1442
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
update_sql
UPDATE_SQL = [ NO | YES ]
SQL metadata
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
cursor_type
CURSOR_TYPE =[ DYNAMIC |
FORWARD_ONLY |KEYSET_DRIVEN |STATIC
]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
Reference for language elementsVersion 3.3
1443
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
Default value: 1000
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
keyset_size
KEYSET_SIZE = buffer-size
Type: Numeric
Minimum value: 0
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
Reference for language elementsVersion 3.3
1444
tracefile
TRACEFILE = filepath
Type: String
Table locking options
read_isolation_level
READ_ISOLATION_LEVEL = [ RC | RR | RU | S | V ]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
update_isolation_level
UPDATE_ISOLATION_LEVEL = [ RC | RR | S | V ]
update_lock_type
UPDATE_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
WPS Engine for OLEDB
OLEDB
LIBNAME library-name OLEDB[ Connection-options |
Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
Reference for language elementsVersion 3.3
1445
complete
COMPLETE = [ NO | YES ]
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
datasource
DATASOURCE = datasource-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
init_string
INIT_STRING = initialisation-options
Type: String
oledb_services
OLEDB_SERVICES = [ NO | YES ]
password
PASSWORD = user-passwd
Type: String
prompt
PROMPT = [ NO | YES ]
properties
PROPERTIES = ( { option … } )
option
"Provider"
"Provider" = value
Reference for language elementsVersion 3.3
1446
Type: String
"Integrated Security"
"Integrated Security" = value
Type: String
"Password"
"Password" = value
Type: String
"Initial Catalog"
"Initial Catalog" = value
Type: String
"Location"
"Location" = value
Type: String
"User ID"
"User ID" = value
Type: String
"Data Source"
"Data Source" = value
Type: String
"Extended Properties"
"Extended Properties" = value
Type: String
"Cache Authentication"
"Cache Authentication" = [ FALSE | TRUE ]
"Encrypt Password"
"Encrypt Password" = [ FALSE | TRUE ]
"Mask Password"
"Mask Password" = [ FALSE | TRUE ]
Reference for language elementsVersion 3.3
1447
"Persist Encrypted"
"Persist Encrypted" = [ FALSE | TRUE ]
"Persist Security Info"
"Persist Security Info" = [ FALSE | TRUE ]
"General Timeout"
"General Timeout" = value
Type: Numeric
"Window Handle"
"Window Handle" = value
Type: Numeric
"Connection Timeout"
"Connection Timeout" = value
Type: Numeric
"Locale Identifier"
"Locale Identifier" = value
Type: Numeric
"Impersonation Level"
"Impersonation Level" =[ "ANONYMOUS" |
"DELEGATE" |"IDENTIFY" |"IMPERSONATE"
]
"Mode"
"Mode" =[ "READ" |
"READWRITE" |"SHARE DENY READ" |"SHARE DENY WRITE" |"SHARE EXCLUSIVE" |"WRITE"
]
Reference for language elementsVersion 3.3
1448
"OLE DB Services"
"OLE DB Services" =[ "AGRAFTERSESSION" |
"CLIENTCURSOR" |"DISABLEALL" |"ENABLEALL" |"RESOURCEPOOLING" |"TXNENLISTMENT"
]
"Prompt"
"Prompt" =[ "COMPLETE" |
"COMPLETEREQUIRED" |"NOPROMPT" |"PROMPT"
]
provider
PROVIDER = provider-name
Type: String
provider_string
PROVIDER_STRING = provider-string
Type: String
required
REQUIRED = [ NO | YES ]
schema
SCHEMA = schema-name
Type: String
udl
[ UDL | UDL_FILE ] = filepath
Type: String
user
USER = user-name
Type: String
Reference for language elementsVersion 3.3
1449
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
qualifier
QUALIFIER = qualifer-name
Type: String
Reference for language elementsVersion 3.3
1450
quote_char
QUOTE_CHAR = character
Type: String
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
SQL metadata
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
command_timeout
COMMAND_TIMEOUT = duration
Type: Numeric
Minimum value: 0
cursor_type
CURSOR_TYPE = [ DYNAMIC | KEYSET_DRIVEN | STATIC ]
Reference for language elementsVersion 3.3
1451
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
Table locking options
read_isolation_level
READ_ISOLATION_LEVEL = [ RC | RR | RU | S ]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW ]
update_isolation_level
UPDATE_ISOLATION_LEVEL = [ RC | RR | S ]
update_lock_type
UPDATE_LOCK_TYPE = [ NOLOCK | ROW ]
Reference for language elementsVersion 3.3
1452
WPS Engine for Oracle
ORACLE
LIBNAME library-name ORACLE[ Connection-options |
Bulkload-options |Encoding-options |Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
password
[ PASSWORD |PWD |PW |PASS |USING |ORAPW
] = user-passwd
Reference for language elementsVersion 3.3
1453
Type: String
path
PATH = TNS-name
Type: String
schema
SCHEMA = schema-name
Type: String
user
USER = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
bl_badfile
BL_BADFILE = filepath
Type: String
bl_control
BL_CONTROL = filepath
Type: String
bl_datafile
BL_DATAFILE = filepath
Type: String
bl_datecache_size
BL_DATECACHE_SIZE = buffer-size
Type: Numeric
Minimum value: 0
Default value: 65536
Reference for language elementsVersion 3.3
1454
bl_default_dir
BL_DEFAULT_DIR = filepath
Type: String
bl_delete_datafile
BL_DELETE_DATAFILE = [ NO | YES ]
bl_delete_only_datafile
BL_DELETE_ONLY_DATAFILE = [ NO | YES ]
bl_direct_path
BL_DIRECT_PATH = [ NO | YES ]
bl_discardfile
BL_DISCARDFILE = filepath
Type: String
bl_index_options
BL_INDEX_OPTIONS = options-list
Type: String
bl_load_method
BL_LOAD_METHOD =[ APPEND |
INSERT |REPLACE |TRUNCATE
]
bl_log
BL_LOG = filepath
Type: String
bl_options
BL_OPTIONS = options-list
Type: String
bl_parfile
BL_PARFILE = filepath
Reference for language elementsVersion 3.3
1455
Type: String
bl_preserve_blanks
BL_PRESERVE_BLANKS = [ NO | YES ]
bl_recoverable
BL_RECOVERABLE = [ NO | YES ]
bl_return_warnings_as_errors
BL_RETURN_WARNINGS_AS_ERRORS = [ NO | YES ]
bl_sqlldr_path
BL_SQLLDR_PATH = filepath
Type: String
bl_stream_size
BL_STREAM_SIZE = buffer-size
Type: Numeric
Minimum value: 0
bl_suppress_nullif
BL_SUPPRESS_NULLIF = ( { variable = [ NO | YES ] … } )
bl_use_sqlldr
BL_USE_SQLLDR = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
Encoding options
adjust_byte_semantic_column_lengths
ADJUST_BYTE_SEMANTIC_COLUMN_LENGTHS = [ NO | YES ]
adjust_nchar_column_lengths
ADJUST_NCHAR_COLUMN_LENGTHS = [ NO | YES ]
db_length_semantics_byte
DB_LENGTH_SEMANTICS_BYTE = [ NO | YES ]
Reference for language elementsVersion 3.3
1456
dbclient_max_bytes
DBCLIENT_MAX_BYTES = bytes-per-character
Type: Numeric
Minimum value: 1
dbserver_max_bytes
DBSERVER_MAX_BYTES = bytes-per-character
Type: Numeric
Minimum value: 1
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1457
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
show_synonyms
SHOW_SYNONYMS = [ NO | YES ]
SQL transaction
Reference for language elementsVersion 3.3
1458
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dblink
DBLINK = link-name
Type: String
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
Default value: 1000
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
Default value: 10
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
Default value: 250
spool
SPOOL = [ DBMS | NO | YES ]
Table locking options
Reference for language elementsVersion 3.3
1459
lockwait
LOCKWAIT = [ NO | YES ]
read_isolation_level
READ_ISOLATION_LEVEL = [ READCOMMITTED | SERIALIZABLE ]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
update_isolation_level
UPDATE_ISOLATION_LEVEL = [ READCOMMITTED | SERIALIZABLE ]
update_lock_type
UPDATE_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
ORACLE Dataset Options
bl_badfile
BL_BADFILE = filepath
Type: String
bl_control
BL_CONTROL = filepath
Type: String
bl_datafile
BL_DATAFILE = filepath
Type: String
bl_default_dir
BL_DEFAULT_DIR = filepath
Type: String
bl_delete_datafile
BL_DELETE_DATAFILE = [ NO | YES ]
Reference for language elementsVersion 3.3
1460
bl_delete_only_datafile
BL_DELETE_ONLY_DATAFILE = [ NO | YES ]
bl_direct_path
BL_DIRECT_PATH = [ NO | YES ]
bl_discardfile
BL_DISCARDFILE = filepath
Type: String
bl_index_options
BL_INDEX_OPTIONS = options-list
Type: String
bl_load_method
BL_LOAD_METHOD =[ APPEND |
INSERT |REPLACE |TRUNCATE
]
bl_log
BL_LOG = filepath
Type: String
bl_options
BL_OPTIONS = options-list
Type: String
bl_parfile
BL_PARFILE = filepath
Type: String
bl_preserve_blanks
BL_PRESERVE_BLANKS = [ NO | YES ]
bl_recoverable
BL_RECOVERABLE = [ NO | YES ]
Reference for language elementsVersion 3.3
1461
bl_return_warnings_as_errors
BL_RETURN_WARNINGS_AS_ERRORS = [ NO | YES ]
bl_sqlldr_path
BL_SQLLDR_PATH = filepath
Type: String
bl_suppress_nullif
BL_SUPPRESS_NULLIF = ( { variable = [ NO | YES ] … } )
bl_use_sqlldr
BL_USE_SQLLDR = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
schema
[ SCHEMA | AUTHID ] = schema-name
Type: String
ORACLEM
LIBNAME library-name ORACLEM[ Connection-options |
Bulkload-options |Encoding-options |Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
Reference for language elementsVersion 3.3
1462
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHAREDREAD |UNIQUE
]
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
password
[ PASSWORD |PWD |PW |PASS |USING |ORAPW
] = user-passwd
Type: String
path
PATH = TNS-name
Type: String
schema
SCHEMA = schema-name
Type: String
user
USER = user-name
Type: String
Reference for language elementsVersion 3.3
1463
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
bl_badfile
BL_BADFILE = filepath
bl_control
BL_CONTROL = filepath
bl_datafile
BL_DATAFILE = filepath
bl_datecache_size
BL_DATECACHE_SIZE = buffer-size
bl_default_dir
BL_DEFAULT_DIR = filepath
Type: String
bl_delete_datafile
BL_DELETE_DATAFILE = [ NO | YES ]
bl_delete_only_datafile
BL_DELETE_ONLY_DATAFILE = [ NO | YES ]
bl_direct_path
BL_DIRECT_PATH = [ NO | YES ]
bl_discardfile
BL_DISCARDFILE = filepath
bl_index_options
BL_INDEX_OPTIONS = options-list
Type: String
Reference for language elementsVersion 3.3
1464
bl_load_method
BL_LOAD_METHOD ={ APPEND |
INSERT |REPLACE |TRUNCATE
… }
bl_log
BL_LOG = filepath
bl_options
BL_OPTIONS = filepath
Type: String
bl_parfile
BL_PARFILE = filepath
bl_preserve_blanks
BL_PRESERVE_BLANKS = [ NO | YES ]
bl_recoverable
BL_RECOVERABLE = [ NO | YES ]
bl_return_warnings_as_errors
BL_RETURN_WARNINGS_AS_ERRORS = [ NO | YES ]
bl_sqlldr_path
BL_SQLLDR_PATH = filepath
Type: String
This option can only be used on z/OS for System z.
bl_stream_size
BL_STREAM_SIZE = buffer-size
bl_suppress_nullif
BL_SUPPRESS_NULLIF = ( { variable = [ NO | YES ] … } )
Reference for language elementsVersion 3.3
1465
bl_use_sqlldr
BL_USE_SQLLDR = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
Encoding options
adjust_byte_semantic_column_lengths
ADJUST_BYTE_SEMANTIC_COLUMN_LENGTHS = [ NO | YES ]
adjust_nchar_column_lengths
ADJUST_NCHAR_COLUMN_LENGTHS = [ NO | YES ]
db_length_semantics_byte
DB_LENGTH_SEMANTICS_BYTE = [ NO | YES ]
dbclient_max_bytes
DBCLIENT_MAX_BYTES = bytes-per-character
Type: Numeric
Minimum value: 1
dbserver_max_bytes
DBSERVER_MAX_BYTES = bytes-per-character
Type: Numeric
Minimum value: 1
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
Reference for language elementsVersion 3.3
1466
dbnullkeys
DBNULLKEYS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… }
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_comments
PRESERVE_COMMENTS = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
show_synonyms
SHOW_SYNONYMS = [ NO | YES ]
SQL transaction
Reference for language elementsVersion 3.3
1467
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dblink
DBLINK = link-name
Type: String
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
spool
SPOOL = [ DBMS | NO | YES ]
updatebuff
UPDATEBUFF = buffer-size
Type: Numeric
Minimum value: 1
Table locking options
Reference for language elementsVersion 3.3
1468
lockwait
LOCKWAIT = [ NO | YES ]
read_isolation_level
READ_ISOLATION_LEVEL = { READCOMMITTED | SERIALIZABLE … }
read_lock_type
READ_LOCK_TYPE = { NOLOCK | ROW | TABLE … }
update_isolation_level
UPDATE_ISOLATION_LEVEL = { READCOMMITTED | SERIALIZABLE … }
update_lock_type
UPDATE_LOCK_TYPE = { NOLOCK | ROW | TABLE … }
ORACLEM Dataset Options
bl_badfile
BL_BADFILE = filepath
bl_control
BL_CONTROL = filepath
bl_datafile
BL_DATAFILE = filepath
bl_default_dir
BL_DEFAULT_DIR = filepath
Type: String
bl_delete_datafile
BL_DELETE_DATAFILE = [ NO | YES ]
bl_delete_only_datafile
BL_DELETE_ONLY_DATAFILE = [ NO | YES ]
Reference for language elementsVersion 3.3
1469
bl_direct_path
BL_DIRECT_PATH = [ NO | YES ]
bl_discardfile
BL_DISCARDFILE = filepath
bl_index_options
BL_INDEX_OPTIONS = options-list
Type: String
bl_load_method
BL_LOAD_METHOD ={ APPEND |
INSERT |REPLACE |TRUNCATE
… }
bl_log
BL_LOG = filepath
bl_options
BL_OPTIONS = options-list
Type: String
bl_parfile
BL_PARFILE = filepath
bl_preserve_blanks
BL_PRESERVE_BLANKS = [ NO | YES ]
bl_recoverable
BL_RECOVERABLE = [ NO | YES ]
bl_return_warnings_as_errors
BL_RETURN_WARNINGS_AS_ERRORS = [ NO | YES ]
bl_sqlldr_path
BL_SQLLDR_PATH = filepath
Reference for language elementsVersion 3.3
1470
Type: String
This option can only be used on z/OS for System z.
bl_suppress_nullif
BL_SUPPRESS_NULLIF = ( { variable = [ NO | YES ] … } )
bl_use_sqlldr
BL_USE_SQLLDR = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbslice
DBSLICE = ( { Where-clause … } )
dbsliceparm
DBSLICEPARM =[ NONE |
THREADED_APPS |ALL |( [ THREADED_APPS | ALL ] [ | , max-threads | max-threads ] )
]
dbtype
DBTYPE = ( { column-name = DBMS-type … } )
schema
[ SCHEMA | AUTHID ] = [ NO | YES ]
Reference for language elementsVersion 3.3
1471
WPS Engine for PostgreSQL
POSTGRESQL
LIBNAME library-name [ POSTGRESQL | PGRESQL | POSTGSQL ] [ Connection-options |
Bulkload-options |Sql-generation |Sql-metadata |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
database
[ DATABASE | DB ] = database-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
host
[ HOST | SERVER ] = remote-id
Type: String
Reference for language elementsVersion 3.3
1472
options
OPTIONS = option-list
Type: String
password
[ PASSWORD | PASS | PW ] = user-passwd
Type: String
port
PORT = port-number
Type: String
schema
SCHEMA = schema-name
Type: String
tty
TTY = tty-options
Type: String
user
[ USER | USR ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
bl_buffersize
BL_BUFFERSIZE = buffer-size
Type: String
bl_delimiter
BL_DELIMITER = delimiter-option
Type: String
Reference for language elementsVersion 3.3
1473
bl_nullstring
BL_NULLSTRING = null-option
Type: String
bulkload
BULKLOAD = [ NO | YES ]
bulkunload
BULKUNLOAD = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Reference for language elementsVersion 3.3
1474
Default value: YES
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
insertbuff
INSERTBUFF = buffer-size
Reference for language elementsVersion 3.3
1475
Type: Numeric
Minimum value: 1
Maximum value: 32767
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
WPS Engine for Sand
SAND
LIBNAME library-name SAND[ Connection-options |
Bulkload-options |Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
Reference for language elementsVersion 3.3
1476
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
connection_name
CONNECTION_NAME = connection-id
Type: String
database
DATABASE = database-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
host
[ HOST | SERVER ] = remote-id
Type: String
password
[ PASSWORD | PASS | PW ] = user-passwd
Type: String
port
PORT = port-number
Type: Numeric
Reference for language elementsVersion 3.3
1477
schema
SCHEMA = schema-name
Type: String
user
USER = user-name
Type: String
Bulkload options
bulkload
BULKLOAD = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1478
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
Reference for language elementsVersion 3.3
1479
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
spool
SPOOL = [ DBMS | NO | YES ]
Table locking options
read_isolation_level
READ_ISOLATION_LEVEL = [ RC | RR | RU | S ]
update_isolation_level
UPDATE_ISOLATION_LEVEL = [ RC | RR | S ]
Reference for language elementsVersion 3.3
1480
WPS Engine for SQL Server
SQLSERVER
LIBNAME library-name [ SQLSERVER | SQLSERVR | SQLSVR ] [ Connection-options |
Bulkload-options |Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
database
[ DATABASE | DATABASENAME ] = database-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
Reference for language elementsVersion 3.3
1481
driver
DRIVER = driver-name
Type: String
password
[ PASSWORD |PWD |PW |PASS |USING
] = user-passwd
Type: String
port
[ PORT | PORTNUMBER ] = port-number
Type: Numeric
Default value: 1433
schema
SCHEMA = schema-name
Type: String
server
SERVER = remote-id
Type: String
use_odbc_cl
USE_ODBC_CL = [ NO | YES ]
user
[ USER | UID ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Bulkload options
Reference for language elementsVersion 3.3
1482
bl_log
BL_LOG = filepath
Type: String
This option can be used on 32-bit Windows, 64-bit Windows.
bl_options
BL_OPTIONS = options-list
Type: String
This option can be used on 32-bit Windows, 64-bit Windows.
bulkload
[ BULKLOAD | BCP ] = [ NO | YES ]
This option can be used on 32-bit Windows, 64-bit Windows.
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1483
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
insert_sql
INSERT_SQL = [ NO | YES ]
qualifier
QUALIFIER = qualifer-name
Type: String
quote_char
QUOTE_CHAR = character
Type: String
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
Reference for language elementsVersion 3.3
1484
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
update_sql
UPDATE_SQL = [ NO | YES ]
SQL metadata
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
cursor_type
CURSOR_TYPE =[ DYNAMIC |
FORWARD_ONLY |KEYSET_DRIVEN |STATIC
]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
Reference for language elementsVersion 3.3
1485
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
Default value: 10000
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
keyset_size
KEYSET_SIZE = buffer-size
Type: Numeric
Minimum value: 0
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
Reference for language elementsVersion 3.3
1486
tracefile
TRACEFILE = filepath
Type: String
Table locking options
read_isolation_level
READ_ISOLATION_LEVEL = [ RC | RR | RU | S | V ]
read_lock_type
READ_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
update_isolation_level
UPDATE_ISOLATION_LEVEL = [ RC | RR | S | V ]
update_lock_type
UPDATE_LOCK_TYPE = [ NOLOCK | ROW | TABLE ]
WPS Engine for Sybase
SYBASE
LIBNAME library-name SYBASE[ Connection-options |
Sql-generation |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
Reference for language elementsVersion 3.3
1487
connection
CONNECTION = [ GLOBALREAD | SHAREDREAD | UNIQUE ]
database
[ DATABASE | DB ] = database-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
password
[ PASSWORD |PWD |PWD |PW |PASS |USING
] = user-passwd
Type: String
schema
SCHEMA = schema-name
Type: String
server
[ SERVER | HOST ] = remote-id
Type: String
user
[ USER | UID ] = user-name
Type: String
Reference for language elementsVersion 3.3
1488
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
quoted_identifier
QUOTED_IDENTIFIER = [ NO | YES ]
sql_functions
SQL_FUNCTIONS = ALL
Reference for language elementsVersion 3.3
1489
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
max_connects
MAX_CONNECTS = total-connections
Type: Numeric
packetsize
PACKETSIZE = maximum-packetsize
Type: Numeric
readbuff
READBUFF = buffer-size
Type: Numeric
spool
SPOOL = [ DBMS | NO | YES ]
Table locking options
Reference for language elementsVersion 3.3
1490
read_lock_type
READ_LOCK_TYPE = NOLOCK
update_isolation_level
UPDATE_ISOLATION_LEVEL = isolation-level
Type: Numeric
WPS Engine for Sybase IQ
SYBASEIQ
LIBNAME library-name SYBASEIQ[ Connection-options |
Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
database
[ DATABASE | DB | DATABASE-NAME ] = string
Type: String
Reference for language elementsVersion 3.3
1491
datasrc
[ DATASRC | DSN | DS ] = datasource-name
Type: String
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
host
HOST = remote-id
Type: String
password
[ PASSWORD |PWD |PW |PASS |USING
] = user-passwd
Type: String
port
PORT = port-number
Type: String
schema
SCHEMA = schema-name
Type: String
server
SERVER = remote-id
Type: String
Reference for language elementsVersion 3.3
1492
user
[ USER | UID ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Reference for language elementsVersion 3.3
1493
Default value: YES
quote_char
QUOTE_CHAR = character
Type: String
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
SQL metadata
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
Reference for language elementsVersion 3.3
1494
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
readbuff
[ READBUFF | ROWSET_SIZE | ROWSET ] = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 65535
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
tracefile
TRACEFILE = filepath
Type: String
Table locking options
read_isolation_level
READ_ISOLATION_LEVEL = [ RC | RR | RU | S ]
Reference for language elementsVersion 3.3
1495
read_lock_type
READ_LOCK_TYPE = [ ROW | TABLE ]
update_isolation_level
UPDATE_ISOLATION_LEVEL = [ RC | RR | S ]
update_lock_type
UPDATE_LOCK_TYPE = [ ROW | TABLE ]
SYBASEIQ Dataset Options
bl_client_datafile
BL_CLIENT_DATAFILE = filepath
Type: String
bl_datafile
BL_DATAFILE = filepath
Type: String
bl_delete_datafile
BL_DELETE_DATAFILE = [ NO | YES ]
bl_delimiter
BL_DELIMITER = delimiter-character
Type: String
bl_options
BL_OPTIONS = options-list
Type: String
bl_use_pipe
BL_USE_PIPE = [ NO | YES ]
bulkload
BULKLOAD = [ NO | YES ]
Reference for language elementsVersion 3.3
1496
WPS Engine for Teradata
TERADATA
LIBNAME library-name TERADATA[ Connection-options |
Sql-generation |Sql-metadata |Sql-transaction |Table-locking-options
] ;
Connection options
access
ACCESS = READONLY
account
ACCOUNT = user-account
Type: String
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
Reference for language elementsVersion 3.3
1497
password
[ PASSWORD | PASS | PW ] = user-passwd
Type: String
schema
[ SCHEMA | DATABASE ] = schema-name
Type: String
tdpid
[ TDPID | SERVER ] = remote-id
Type: String
user
USER = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
direct_exe
DIRECT_EXE = DELETE
Reference for language elementsVersion 3.3
1498
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
SQL metadata
preserve_col_names
PRESERVE_COL_NAMES = [ NO | YES ]
preserve_names
PRESERVE_NAMES = [ NO | YES ]
preserve_tab_names
PRESERVE_TAB_NAMES = [ NO | YES ]
SQL transaction
Reference for language elementsVersion 3.3
1499
cast_overhead_maxpercent
CAST_OVERHEAD_MAXPERCENT = value
Type: Numeric
Minimum value: 0
Minimum value: 100
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
mode
MODE = [ ANSI | TERADATA ]
query_band
QUERY_BAND = value
Type: String
spool
SPOOL = [ DBMS | NO | YES ]
Table locking options
read_isolation_level
READ_ISOLATION_LEVEL = [ ACCESS | READ | WRITE ]
read_lock_type
READ_LOCK_TYPE = [ TABLE | VIEW ]
read_mode_wait
READ_MODE_WAIT = [ NO | YES ]
update_isolation_level
UPDATE_ISOLATION_LEVEL = [ ACCESS | READ | WRITE ]
update_lock_type
UPDATE_LOCK_TYPE = [ TABLE | VIEW ]
Reference for language elementsVersion 3.3
1500
update_mode_wait
UPDATE_MODE_WAIT = [ NO | YES ]
WPS Engine for Vertica
VERTICA
LIBNAME library-name VERTICA[ Connection-options |
Sql-generation |Sql-metadata |Sql-transaction
] ;
Connection options
access
ACCESS = READONLY
connection
CONNECTION =[ GLOBAL |
GLOBALREAD |SHARED |SHAREDREAD |UNIQUE
]
database
[ DATABASE | DB ] = database-name
Type: String
datasrc
[ DATASRC | DSN | DS ] = datasource-name
Type: String
Reference for language elementsVersion 3.3
1501
dbconinit
DBCONINIT = initialisation-options
Type: String
dbconterm
DBCONTERM = termination-options
Type: String
password
[ PASSWORD |PWD |PW |PASS |USING
] = user-passwd
Type: String
port
PORT = port-number
Type: String
schema
SCHEMA = schema-name
Type: String
server
[ SERVER | HOST ] = remote-id
Type: String
use_odbc_cl
USE_ODBC_CL = [ NO | YES ]
user
[ USER | UID ] = user-name
Type: String
utilconn_transient
UTILCONN_TRANSIENT = [ NO | YES ]
Reference for language elementsVersion 3.3
1502
SQL generation
dbcreate_table_opts
DBCREATE_TABLE_OPTS = table-options
Type: String
dbgen_name
DBGEN_NAME = [ DBMS | SAS ]
delete_mult_rows
DELETE_MULT_ROWS = [ NO | YES ]
direct_exe
DIRECT_EXE = DELETE
direct_sql
DIRECT_SQL ={ NO |
NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES |(
{ NO |NOFUNCTIONS |NOGENSQL |NOMULTOUTJOINS |NONE |NOWHERE |YES
… } )… }
Default value: YES
quote_char
QUOTE_CHAR = character
Type: String
Reference for language elementsVersion 3.3
1503
sql_functions
SQL_FUNCTIONS = ALL
sqlgeneration
SQLGENERATION = [ DBMS | NONE ]
stringdates
STRINGDATES = [ NO | YES ]
update_mult_rows
UPDATE_MULT_ROWS = [ NO | YES ]
SQL metadata
ignore_read_only_columns
IGNORE_READ_ONLY_COLUMNS = [ NO | YES ]
SQL transaction
autocommit
AUTOCOMMIT = [ NO | YES ]
dbcommit
DBCOMMIT = number-of-records
Type: Numeric
Minimum value: 0
dbmax_text
DBMAX_TEXT = max-string-length
Type: Numeric
Minimum value: 1
Maximum value: 32767
dbmstemp
DBMSTEMP = [ NO | YES ]
Reference for language elementsVersion 3.3
1504
insertbuff
INSERTBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
query_timeout
QUERY_TIMEOUT = duration
Type: Numeric
Minimum value: 0
readbuff
READBUFF = buffer-size
Type: Numeric
Minimum value: 1
Maximum value: 32767
spool
SPOOL = [ DBMS | NO | YES ]
trace
TRACE = [ NO | YES ]
tracefile
TRACEFILE = filepath
Type: String
Reference for language elementsVersion 3.3
1505
Legal Notices© 2021 World Programming.
All rights reserved. This information is confidential and subject to copyright. No part of this publicationmay be reproduced or transmitted in any form or by any means, electronic or mechanical, includingphotocopying, recording, or by any information storage and retrieval system.
TrademarksWPS and World Programming are registered trademarks or trademarks of World Programming Limitedin the European Union and other countries. (r) or ® indicates a Community trademark.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarksof SAS Institute Inc. in the USA and other countries. ® indicates USA registration.
All other trademarks are the property of their respective owner.
General NoticesWorld Programming Limited is not associated in any way with the SAS Institute.
WPS is not the SAS System.
The phrases "SAS", "SAS language", and "language of SAS" used in this document are used to refer tothe computer programming language often referred to in any of these ways.
The phrases "program", "SAS program", and "SAS language program" used in this document are usedto refer to programs written in the SAS language. These may also be referred to as "scripts", "SASscripts", or "SAS language scripts".
The phrases "IML", "IML language", "IML syntax", "Interactive Matrix Language", and "language of IML"used in this document are used to refer to the computer programming language often referred to in anyof these ways.
WPS includes software developed by third parties. More information can be found in the THANKS oracknowledgments.txt file included in the WPS installation.