Add value labels to hidden variables

I created a hidden variable using a Free Format question (see below) for age groups based on a numeric age question, assigning numeric values (1 to 6). I want to add labels to those values so they are reflected in the data export to SPSS, as in 1=18- 24, 2=25-34, 3=35-44, etc. I want to keep the numeric values (1 to 6) but add labels to them, not replace them with labels.

Here is my code:

[code]

<input name="hage_grp" id="hage_grp" type="hidden" value="

[% Begin Unverified Perl

my $agegrp=0;

if ((GETVALUE("Age")>18) && (GETVALUE("Age")<25))

{ $agegrp=1;

} elsif ((GETVALUE("Age")>24)&& (GETVALUE("Age")<35))

{ $agegrp=2;

}elsif ((GETVALUE("Age")>34)&& (GETVALUE("Age")<45))

{ $agegrp=3;

} elsif ((GETVALUE("Age")>44)&& (GETVALUE("Age")<55))

{ $agegrp=4;

}elsif ((GETVALUE("Age")>54)&& (GETVALUE("Age")<65))

{ $agegrp=5;

} elsif (GETVALUE("Age")>64)

{ $agegrp=6;

} return $agegrp;

End Unverified %]

">

[/code]

I would like to label the values for the values being stored in the hidden variable hage_grp before being exported. Is there code to do this?

1 reply