Invalid CrossTab parameter

Discussions about tabulating data in the designer or in batch mode
Forum rules
New release: CSPro 8.0
Post Reply
CathyGarlick
Posts: 13
Joined: July 29th, 2013, 11:49 am

Invalid CrossTab parameter

Post by CathyGarlick »

Hi
I'm trying to run some old code for a batch tabulation. It is code that I've inherited and I wanted to rerun it to replicate the original results and then run it with a subset of the data (long story). It looks as though the code was originally created in version 4.1 - I was using version 6.3 but couldn't get it to compile - I then installed version 4.1 and got the same problem. The compilation error message I'm getting is "Invalid CrossTab parameter" - I've seen other posts referring to the system environment variable "OLD_TABS" but I've checked and don't have one of those. The section of code that is causing the problem is:

Code: Select all

crosstab float(0) txxx unweight runday+runmonth+runyear
  exclude(specval, rowzero, colzero, totals, percents)
{+US}
  title( "Tables for chapter 2, Country 2011" );
{US+}
it seems to fail at the "exclude" line - if I comment out this line it then moves onto the next "crosstab" command (there are loads of them!) where it again fails to compile at the next "exclude" line.

Can't attach the entire app I'm afraid as (1) it's pretty big and (2) it's not mine to circulate, but if anyone can point me in the right direction that would be much appreciated. I should mention I haven't used the tabulation application before so I feel like I'm flailing around in the deep end!

Thanks
Cathy Garlick
Data Management Consultant
Statistical Services Centre
University of Reading, UK

c.a.garlick@reading.ac.uk
www.reading.ac.uk/ssc
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Invalid CrossTab parameter

Post by Gregory Martin »

Hey Cathy,

You mention OLD_TABS. Did you try running the tables with that mode on? If you're running DHS-style (and maybe MICS) tables, you'll need that environment setting on for your tables to properly compile and execute.

Let me know if you have questions about how to set OLD_TABS=Y.
CathyGarlick
Posts: 13
Joined: July 29th, 2013, 11:49 am

Re: Invalid CrossTab parameter

Post by CathyGarlick »

Thanks Greg - that seems to have got past that bit of the code, now to the next problem ;)

The batch file I have includes an "Include" line; i.e. the batch file contents are:

Code: Select all

[CRPro Application]
Version =CSPro 4.1
Label=CHAPT2
Name=CHAPT2
AppType=Batch
[External Dictionaries]
File=12/9/2014 9:40:16 AM, ..\Dicts\MRECODE6.dcf
File=12/9/2014 9:55:54 AM, ..\TABWORK.DCF
[AppCode]
File=12/12/2014 2:54:14 PM, .\chapt2.app
Include=12/9/2014 9:55:54 AM, .\TableFunctions.app
[Message]
File=12/9/2014 9:58:13 AM, .\tables.mgf
[Order]
File=12/12/2014 10:53:39 AM, .\tables.ord
[Dictionary Types]
Dict-Type=..\Dicts\RECODE6.dcf, Input, .\tables.ord
Dict-Type=..\Dicts\MRECODE6.dcf, External
Dict-Type=.\TABWORK.DCF, Working
When I try running it I get the message "Invalid line at 11 Include" and it doesn't load the Table Functions. When I try compiling it fails at the point where it tries to use one of the table functions.

Is there another way to include the table functions I have?

Thanks
Cathy Garlick
Data Management Consultant
Statistical Services Centre
University of Reading, UK

c.a.garlick@reading.ac.uk
www.reading.ac.uk/ssc
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Invalid CrossTab parameter

Post by Gregory Martin »

I can't remember when the external logic include files were added to CSPro. If they were in the original 4.1 application, then I'm surprised that it's having a problem with that.

If you just want to quickly get things working, open TableFunctions.app in a text editor and copy the contents and then paste them right after the PROC GLOBAL line in your main application.

That should compile and work.
CathyGarlick
Posts: 13
Joined: July 29th, 2013, 11:49 am

Re: Invalid CrossTab parameter

Post by CathyGarlick »

Thanks Greg
That's moved it on a bit but interestingly it still doesn't compile in version 4.1 - complains when it gets to the second function

Code: Select all

function Col2Dim(alpha(15) TabName, array TableW(,), ColBeg, ColEnd, array TableU(,), ColNu)
...
end;
function Row2Dim(alpha(15) TabName, array TableW(,), RowBeg, RowEnd, array TableU(,), RowNu)
...
end;
The first function seems to compile okay but when it gets to the second one I get the message "Symbol name already defined near line 50 in GLOBAL procedure".

I tried loading it into version 6.3 and it compiles okay there. I then run it and it seems to be happy but (and here's the silly question!) where can I find the tables? It produces a TBD file and a TBI file but how do I get into them?

Time for coffee ...
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Invalid CrossTab parameter

Post by Gregory Martin »

In 4.1, the alpha variables in functions had global scope, I believe, so TabName wouldn't be able to be used twice. You could probably run it if you changed TabName to TabName2, and you might have to change the array names too.

If you look at the CSPro install directory, there's actually a program, tbdview, that displays the contents of a .tbd file, but in an unfriendly way.

Most people use the Table Viewer program that ICF (DHS) has created to view their tables. You'll want to ask the person who designed these programs for that viewer.
CathyGarlick
Posts: 13
Joined: July 29th, 2013, 11:49 am

Re: Invalid CrossTab parameter

Post by CathyGarlick »

Thanks Greg
I tried the tbdview program but it kept saying the file didn't exist (although it did!). I started again and this time when I run it I get the message

A 589 Cannot open TBD file $$CTAB$$.TMP

any idea what might be causing that? When I click on OK it then tells me "Fatal error in engine. CSBatch closing down". I'm running this in version 6.3 but I also have versions 4.1, 6.2 and the beta version of 7.0 installed on my PC - is that likely to be causing any problems?

Thanks
Cathy Garlick
Data Management Consultant
Statistical Services Centre
University of Reading, UK

c.a.garlick@reading.ac.uk
www.reading.ac.uk/ssc
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Invalid CrossTab parameter

Post by Gregory Martin »

I'm not sure. Honestly, we (Census Bureau) never use this old tabs feature, so this isn't something I really know much about. It's still in CSPro mostly to allow DHS to keep running their tables. That's why they have the Table Viewer program to format and view the .tbd files.

Without seeing your application, it's hard to know what might be going on.
CathyGarlick
Posts: 13
Joined: July 29th, 2013, 11:49 am

Re: Invalid CrossTab parameter

Post by CathyGarlick »

no worries - thanks anyway. I've discovered a "tables.exe" file which could be the table viewer program from IFC but can't currently get it to work. I've contacted them directly and will see what they say.
Cathy Garlick
Data Management Consultant
Statistical Services Centre
University of Reading, UK

c.a.garlick@reading.ac.uk
www.reading.ac.uk/ssc
Post Reply