* The value and value labels are in an ASCII file. Have to read them and apply the labels to a data file. * Raynald Levesque rlevesque@videotron.ca. NEW FILE. INPUT PROGRAM. * syntax assumes that if there is a blank is column 2 and that the line contains a variable name. DATA LIST FIXED /KIND 2-2(A). DO IF (kind EQ ' '). REREAD. DATA LIST /v_value 1-1(F) lab1 3-15(A). END CASE. ELSE. REREAD. DATA LIST /v_name 1-8(A). LEAVE v_name. END CASE. END IF. END INPUT PROGRAM. * This is the file which contains the value labels. BEGIN DATA var1 1 small 2 big var2 1 strong 2 weak 3 dont know var3 1 frequently 2 infrequently 4 once a week 6 once a month END DATA. LIST. SELECT IF ~MISSING(v_value). STRING q1(A1). COMPUTE q1='"'. SORT CASES BY v_name. MATCH FILES FILE=* /BY=v_name /FIRST=first. * ------- write a syntax file to assign the value labels. WRITE OUTFILE 'c:\\temp\\temp1.sps' /"ADD VALUE LABELS " v_name " " v_value " " q1 lab1 q1".". EXE. *Say this is your data file (without the labels); read it. NEW FILE. DATA LIST LIST /var1 var2 var3. BEGIN DATA 1 1 1 2 2 2 1 3 4 2 1 6 1 3 4 END DATA. LIST. * then apply the labels. INCLUDE 'c:\\temp\\temp1.sps'. * that's it!.