Prior to attempting any character manipulation, an important aspect to understand is how length is assigned for character variables. Let's look at the following character variable default length example:
DATA Cars;
INPUT Make $;
DATALINES;
Porsche_Cayenne
Audi
BMW
;
PROC CONTENTS;
RUN;
Using PROC CONTENTS, we get the following output:
Even though, in the first observation, we have has 15 characters, the output of the first observation will get restricted to Porsche_ (the first eight characters) due to the default length of 8 for the character variable. In Chapter 1, Introduction to SAS Programming, we specified the length of the City variable, by using the $12. format in the input statement. In the case of the preceding program, no length has been specified. We have, however, specified a character format using the $ option. Please ensure that the length of the...