*(Q) The AnswerNet solution 100001386 is great if you have only a single variable and you know which category has no respondents. * Unfortunately, I have 12 DB, with 5 to 20 variables in each DB. * Each variable does have the same possible values: 0.05, 1, 2, 3, 4, 17, 19, 20. * Is there any way to automate the process so that I don't have to run * all the frequencies for each DB, identify the variables and the * categories with no respondents, create separate files for each empty * category for each variable, etc.? *(A) Posted to SPSSX_L on 2001/12/06 by rlevesque@videotron.ca. * This is a fairly general solution. * You do not need to know the variable names nor which ones are missing category values before calling the macro. * You would call the macro once for each data file. (If you had many files you could use the technics described in the "Working with many files" section of this site to automate the process further). * errors are produced by macro when there are string variables in the data file but these can be ignored. SET MPRINT=no. *//////////////////////. DEFINE !fill (filenam=!TOKENS(1) /vlist=!CMDEND) GET FILE=!filenam. N OF CASES 1. !LET !cnt=!NULL !DO !val !IN (!vlist) DO REPEAT var=ALL. + COMPUTE var=!val. END REPEAT PRINT. !LET !cnt=!CONCAT(!cnt,!BLANK(1)) COMPUTE wgt=.00001. XSAVE OUTFILE=!QUOTE(!CONCAT('c:\\temp\\temp',!LENGTH(!cnt),'.sav')). !DOEND EXECUTE. GET FILE=!filenam. COMPUTE wgt=1. !LET !cntend=!LENGTH(!cnt) /* Add the dummy cases to the original data file */ !DO !cnt1=1 !TO !cntend ADD FILES FILE=* /FILE=!QUOTE(!CONCAT('c:\\temp\\temp',!cnt1,'.sav')). !DOEND EXECUTE. !ENDDEFINE. *//////////////////////. SET MPRINT=yes. * Call the macro to do the first data file. !fill filenam='C:\\program files\\spss\\employee data.sav' vlist=.05 1 2 3 4 7. * Show that it works. FORMAT jobcat minority (F8.2). WEIGHT BY wgt. * Basic Tables. TABLES /FORMAT BLANK MISSING('.') /TABLES jobcat BY minority > (STATISTICS) /STATISTICS count( ( F5.0 )). FREQUENCIES VARIABLES=jobcat /ORDER= ANALYSIS . * Note: Doing a Crosstab would not show the empty categories because that procedure round weights before preparing the table.