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...
Exercise (9-9)

The last digit of the barcode is called the Check Digit. It is used as an error detection for the barcode.

It is calculated as follow:

Example
Barcode without check digit: 

54156897431x
1. Add the digits in the odd-numbered positions 
(5+1+6+9+4+1 = 26)

2. Multiply the Sum by 3. 
(26x3 = 78)

3. Add the digits in the even-numbered positions 
(4+5+8+7+3 = 27)

4. Add up the two values 
(78+27 = 105). Calculating modulo ten 
(105 mod 10 = 5)

5. If the result is not zero, subtract the result from ten. 
(10-5 = 5)

The check digit for 54156897431x is 5.

For more details about the check digit calculation, please visit here. 

Task

Write a SAS program to check if the check digit is reported correctly for each barcode.

Create any data set or variable if needed.


Next
Already a member? Go to member's area.