Solutions Company Statit Training Home
 



Converting Statit Variables - Decode() vs Makelbl

Abstract: There is an important distinction between the Convert String to Numeric procedure and the decode() function. This article illustrates that distinction.

Products: Statit e-QC, Statit e-Server, Statit Custom QC

The Statit Custom QC menu gives you easy access to the makelbl commands through the Edit -> Variable dialogue, which makes a variable numeric assigning it value labels representing its numeric string. However, it does not show you the decode() function, which will convert the actual values within the string into a number. Try the following commands:

assign NumericVar 3 5 7 9 2
sassign StringVar "2" "4" "6" "8" "1"
describe all
NumericVar -- Cases = 5
StringVar -- Cases = 5 (length = 1)

Here, we can see that StringVar is a string because its length is published. Let's use both the makelbl and decode() function to see the difference in the two operations:

makelbl StringVar into makelblVar
decodeVar=decode(StringVar)
print makelblVar decodeVar /raw
Obs makelblVar decodeVar
 1      2         2
 2      3         4
 3      4         6
 4      5         8
 5      1         1

Looking at the raw values, we can see that the makelblVar has been numbered sequentially and given value labels to represent the string in StringVar. The decodeVar has been given the values of the numeric string of StringVar. Now we can safely do mathematically operation using decodeVar.

difference = NumericVar - decodeVar
Obs difference
 1      1
 2      1
 3      1
 4      1
 5      1

If you would like additional information, please call our Support staff at statit.support@conduent.com.