Search the site...

SASCRUNCH TRAINING
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
Sentry Page Protection
Please Wait...
Variable Attributes [6-17]


Attribute #3: Variable Type (Character)
Picture

​Character variable is used when you have text values such as:
  • Name
  • ID
  • Comment
  • Description

Let's take a look at an example.
Picture

All of the variables in this data set are character variables.
Picture
​
What about the Age?

You might have noticed that the AGE variable is also listed as a character variable.
Picture

It is indeed:
Picture

Unlike a numeric variable, there is no restriction on the type of data a character variable can capture.

A character variable can handle either text values (e.g. ID, comments) or numeric values (e.g. age, dollar amount). 

However, it is generally a good programming practice to keep the numeric values under a numeric variable for computation purposes.
Picture

Data Truncation with Character Variable

Data Truncation (cutoff) is a very common error for character variable.

This will be explained in details in the next session.


Summary of Character Variable
  • Character variable is used when working with text values such as name, comment, and description.
  • Character variable can handle both numeric and character values. However, it is a good programming practice to keep the numeric values under a numeric variable for computation purposes.
  • Data truncation is a very common problem with character variable.

Exercise
Which of the following values are best kept under a character variable?

(a) This is a comment.
(b) CUSTID10010
(c) NA
(d) (a) and (b)
(e) all of the above
Next

Need some help? 


HINT:
Can any value(s) above be used in the summary statistics calculation?


SOLUTION:
(e)


Fill out my online form.

Already a member? Go to member's area.