| Functions and CALL Routines |
| Requirement: | Schemes using SAS format are required in the z/OS operating environment. |
| Valid in: | DATA step and SCL |
| Syntax | |
| Details | |
| Example | |
| See Also |
Syntax |
| CALL DQSCHEMEAPPLY(char, output-variable, `scheme', `scheme-format'<, `mode', transform-count-variable, `scheme-lookup-method', `match-definition', sensitivity, `locale'>) |
is the value to which the specified scheme will be applied. The value can be the name of a character variable, a character value in quotation marks, or an expression that evaluates to a variable name or a quoted value.
identifies the character variable that receives the transformed input value.
identifies the scheme that is applied to the input value. For schemes using SAS format, the scheme argument is a fully-qualified SAS data set name in quotation marks. For schemes using Blue Fusion Data format, the scheme argument is the name of an existing fileref in quotation marks. For all operating environments other than z/OS, the fileref must reference a fully-qualified path that ends in .sch.bfd. Lowercase letters are required. In the z/OS operating environment, the normal naming conventions apply for the partitioned data set (PDS) that contains the scheme.
identifies the file format of the scheme. Valid values are as follows:
indicates that the specified scheme is stored in Blue Fusion Data format. This is the default value.
indicates that the specified scheme is stored in SAS format.
specifies how the scheme is to be applied to the values of the input character variable. The default value of the mode argument is the mode that is stored in the scheme. If a mode is not stored in the scheme, then the default mode is PHRASE. If the value of the scheme-lookup-method argument is USE_MATCHDEF, and if a value is not specified for the mode argument, then the default mode is PHRASE.
Valid values for the mode argument are defined as follows:
compares the entire input character value to the entire length of each of the DATA values in the scheme. When the value of the scheme-lookup-method argument is USE_MATCHDEF, the match code of the entire input character value is compared to the match codes of the DATA values in the scheme. A transformation occurs when a match is found between the input character value (or match code) and a DATA value (or match code) in the scheme.
compares each element in the input character value to each of the DATA values in the scheme. When the value of the scheme-lookup-method argument is USE_MATCHDEF, the match code of each element in the input character value is compared to the match codes of the DATA values in the scheme. A transformation occurs when a match is found between an element in the input character value (or match code of an element) and a DATA value (or match code) in the scheme.
(optional) identifies the numeric variable that receives the returned number of transformations that were performed on the input value.
If the value of the mode argument is PHRASE and if the input value is not transformed, then the value of the transform-count variable is 0. If the input variable is transformed, then the value of the transform-count variable is 1.
If the value of the mode argument is ELEMENT and if the input value is not transformed, then the value of the transform-count variable is 0. If the input variable is transformed, then the value is a positive integer that represents the number of elements in the input value that were transformed.
Note: The transformation count might appear to be inaccurate if the
transformation value in the scheme is the same as the input value (or any
element in the input value). ![[cautionend]](../../../../common/61925/HTML/default/images/cautend.gif)
specifies one of three mutually-exclusive methods of applying the scheme. Valid values are as follows:
this default value specifies that the input value is to be compared to the DATA values in the scheme without changing the input value in any way. The transformation value in the scheme is written into the output data set only when the input value exactly matches a DATA value in the scheme. Any adjacent blank spaces in the input value are replaced with single blank spaces before comparison.
specifies that capitalization is to be ignored when the input value is compared to the DATA values in the scheme. Any adjacent blank spaces in the input value are replaced with single blank spaces before comparison.
specifies that the match code of the input value is to be compared to the match codes of the DATA values in the scheme. A transformation occurs when the two match codes are identical.
Specifying USE_MATCHDEF enables the arguments locale, match-definition, and sensitivity, which can be used to override the default values that might be stored in the scheme.
Note: The arguments locale, match-definition, and sensitivity
are valid only when the value of the scheme-lookup-method option is
USE_MATCHDEF. ![[cautionend]](../../../../common/61925/HTML/default/images/cautend.gif)
specifies the name of the match definition in the specified locale that will be used to create match codes during the application of the scheme.
Note: The match-definition argument is
valid only when the value of the scheme-lookup-method
argument is USE_MATCHDEF. ![[cautionend]](../../../../common/61925/HTML/default/images/cautend.gif)
If USE_MATCHDEF is specified and the match-definition argument is not specified, then the default match definition is the one that is stored in the scheme. If USE_MATCHDEF is specified and a match definition is not stored in the scheme, then a value is required for the match-definition argument.
specifies the amount of information in the match codes that are created during the application of the scheme. With higher sensitivity values, two values must be increasingly similar to create the same match code. At lower sensitivity values, two values receive the same match code despite their dissimilarities. Valid values range from 50 to 95.
Note: The sensitivity argument is valid
only when the value of the scheme-lookup-method
argument is USE_MATCHDEF. ![[cautionend]](../../../../common/61925/HTML/default/images/cautend.gif)
When USE_MATCHDEF is specified and the sensitivity argument is not specified, the default sensitivity is the sensitivity value that is stored in the scheme. When USE_MATCHDEF is specified and when a sensitivity value is not stored in the scheme, the default sensitivity value is 85.
specifies the locale that contains the specified match definition that will be referenced during the application of the scheme. The value can be a locale name in quotation marks or the name of a variable whose value resolves to a locale name.
Note: The locale argument is valid only
when the value of the scheme-lookup-method argument
is USE_MATCHDEF. ![[cautionend]](../../../../common/61925/HTML/default/images/cautend.gif)
The specified locale must be loaded into memory as part of the locale list. If no value is specified, the default locale is used. The default locale is the first locale in the locale list. For information on the locale list, see Load and Unload Locales.
| Details |
The CALL routine DQSCHEMEAPPLY transforms an input value by applying a scheme. The scheme can be in SAS format or Blue Fusion Data format. Schemes using SAS format can be created with the DQSCHEME procedure (see The DQSCHEME Procedure). Schemes using Blue Fusion Data format can be created with the DQSCHEME procedure or with the dfPower Studio software from DataFlux (a SAS company).
| Example |
The following example generates a scheme using Blue Fusion Data format with the DQSCHEME procedure and then applies that scheme to a data set with CALL DQSCHEMEAPPLY. The example assumes that ENUSA has been loaded into memory as the default locale.
/* Create the input data set. */ data suppliers; length company $ 50; input company $char50.; datalines; Ford Motor Company Walmart Inc. Federal Reserve Bank Walmart Ernest & Young TRW INC - Space Defense Wal-Mart Corp. The Jackson Data Corp. Ernest & Young Federal Reserve Bank 12th District Ernest and Young Jackson Data Corp. Farmers Insurance Group Kaiser Permantente Ernest and Young LLP TRW Space & Defense Ford Motor Jackson Data Corp Federal Reserve Bank Target ; run; /* Create the scheme. */ proc dqscheme data=suppliers nobfd; create matchdef='Organization (Scheme Build)' var=company scheme=work.myscheme locale='ENUSA'; run; /* Print the scheme. */ proc print data=work.myscheme; title 'Organization Scheme'; run; /* Apply the scheme and display the results. */ data suppliers; set suppliers; length outCompany $ 50; call dqSchemeApply(company, outCompany, 'work.myscheme', 'nobfd', 'phrase', numTrans); put 'Before applying the scheme: ' company / 'After applying the scheme: ' outCompany / 'Transformation count: ' numTrans /; run;
The value of the NUMTRANS variable is 0 if the organization name is not transformed, and 1 if the organization name is transformed. In the output of this example, a transformation count of 1 is shown in several instances, when no transformation appears to have been made, as shown in the following PROC PRINT output:
Before applying the scheme: Jackson Data Corp After applying the scheme: Jackson Data Corp Transformation count: 1
Instances such as these are not errors because in these cases the transformation value is the same as the input value.
| See Also |
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.