Substituting One Value for Another in All Character Variables - SAS Programming

Let's use the previous technique here to set values of NA (Not Applicable) to blanks (character missing value) for all character variables in a data set. (Yes, some people do code things like this.)Here is the program:


This program needs very little explanation.To declare array YYY a character array, place a dollar sign ($) after the array name.As we mentioned before,the term _CHARACTER_ is used to represent all the character variables in the data set.

Specifying Lengths in an ARRAY Statement

To specify the length of the variables in an array of numeric variables, follow the array name with the number of bytes for the variables.To specify the length of variables in an array of character variables, place the length after the dollar sign.Here are two examples:

To specify an array X of numeric variables X1-X10, all of length 4, use this code:
ARRAY X[10] 4 X1-X10;
To specify an array Y of character variables Y1-Y10, all of length 1, use this code:
ARRAY Y[10] $ 1 Y1-Y10;

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

SAS Programming Topics