Not enough subxcripts

Discussions about tabulating data in the designer or in batch mode
Post Reply
Guest

Not enough subxcripts

Post by Guest »

When trying to tabulate multiple occurence fields, I sometimes have a "not enough subscripts" error message.

I do not understand what does that mean and how I can I fix the problem.

Could you please someone advise? Thank you.

****** A red dot would appear before ENDUNIT ******
PROC TABLE8GH
{Generated Code}
Tally
CROSSTAB TABLE8GH Q65_A_3_VS1, SYSTEM_TOTAL
STAT Q65_A_3_VS1 (FREQ, TOTAL) SYSTEM_TOTAL (TOTAL)
UNIT (Q65_A_3_VS1 by SYSTEM_TOTAL) Q65_A_3
ENDUNIT
;

Not enough subscripts
Guest

Re: Not enough subxcripts

Post by Guest »

(following)

Actually, this problem accur only when I try to tabulate multi-occurrence items on a multi-occurrence records (multi-occurrence items on single occurrence records can be tabulated without problem).

Thank you for help
Gregory Martin
Posts: 1801
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Not enough subxcripts

Post by Gregory Martin »

(After looking at this user's dictionary, here is a response for advanced users.)

Creating the table you want in CSPro is not particularly straightforward, but hopefully this will help you:

1) Create a table. For my example, I am creating TABLE1, which is just a tally of Q68_A_6. You should create the tables that you will run in batch mode in a separate application. In other words, I wouldn't mix and match the normal tables that you create with these tricky ones. Create a separate tabulation application exclusively for these tables.

2) If you run the program, you'll get the "Not enough subscripts" error. You'll see that CSPro shows you the logic that runs your table. You can always get to this screen by pressing Control+L.

3) Right-click on TABLE1 in the Tables window on the left and unselect Generate Logic. This will prevent CSPro from constatly overwriting your code with the standard logic for your table.

4) Create a new batch application using the same dictionary and attaching the same working storage dictionary.

5) Cut the TABLE1 logic code from the tabulation application and put it in the batch program, slightly modified. Ultimately it will look like this:
PROC GLOBAL

CROSSTAB TABLE1 Q68_A_6_VS1, SYSTEM_TOTAL
STAT Q68_A_6_VS1 (TOTAL, FREQ) SYSTEM_TOTAL (TOTAL)


PROC GDC_DOSSIERS_FF


PROC Q68_A_6000

    
xtab TABLE1;
6) You'll note that I got rid of the UNIT/ENDUNIT stuff. That was specifying where the program should tally your values, and it doesn't work well with multiply-occurring items on multiply-occurring records, because it doesn't know at which level you want to tally. Thus in the batch program, we tell CSPro when we want to tally it, with the xtab command in PROC Q65_A_3000.

7) Run the batch program.

8) Go back to the tabulation program and get rid of the UNIT/ENDUNIT stuff so that the code will compile. You will be left with code like this:
PROC GLOBAL

PROC TABLE1
Tally
CROSSTAB TABLE1 Q68_A_6_VS1, SYSTEM_TOTAL
STAT Q68_A_6_VS1 (TOTAL, FREQ) SYSTEM_TOTAL (TOTAL)
;
9) Press Control+L to go back to the table view, select File -> Run in Parts, click Format, and choose the output from the batch program. This output will have the extension .TAB.

10) And thus, you should have a table!

Obviously this is rather complicated. Some people exclusively use batch mode to create their tables, so in this case, the extra step for formatting is not a big deal. You can have much more control over your tables if you create them in batch mode. The downside is that creating them is much harder, particularly because the crosstab and xtab statements are not documented in the main CSPro helps.


Last bumped by Anonymous on February 6th, 2012, 4:32 am.
Post Reply