Additional Guidelines

Inputting String Variables with the Same Prefix and Different Numeric Suffixes

In this section, prefix refers to the first part of a variable’s name, while suffix refers to the last part. For example, think about our variables Q1, Q2, Q3, Q4, Q5, Q6, and Q7. These are multiple variables with the same prefix (Q) and different numeric suffixes (i.e., 1, 2, 3, 4, 5, 6, and 7). Variables such as this are sometimes referred to as string variables. Earlier, this chapter provided one way of inputting these variables; the original INPUT statement is repeated here:

INPUT   #1   @1   Q1      1.
             @2   Q2      1.
             @3   Q3      1.
             @4   Q4      1.
             @5   Q5      1.
             @6   Q6      1.
             @7   Q7      1.
             @9   AGE     2.
             @12  IQ      3.
             @16  NUMBER  2.  ;

However, with string variables named in this way, there is ...

Get A Step-by-Step Approach to Using SAS® for Univariate & Multivariate Statistics, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.