I am looking to assign a weight to respondents from particular zip codes for my study. I am trying to use a perl hash to lookup the weight value needed and save it in the free format variable I have called "ZipAdjustment_weight" - actual zips are captured in the value S25. I need to save as a variable in the study to do a calculation with a later response.
Similar to question asked here, and I got this to work to return the value:
https://legacy.sawtoothsoftware.com/forum/30866/look-up-value-based-on-zip-code?show=30866
I just can't get this value to be stored in a variable - Thoughts?
[%Begin Unverified Perl
my $zipCodeQuestion = 'S25';
my %zipCodes = (
12345 => 0.88,
12344 => 0.97,
12356 => 0.97,
12332 => 0.88
);
SETVALUE("ZipAdjustment_weight", $zipCodes{GETVALUE($zipCodeQuestion)};
End Unverified%]