Problems with the sort

Discussions about tools to complement CSPro data processing
dduarte05
Posts: 6
Joined: July 8th, 2014, 12:47 pm
Location: República Dominicana

Problems with the sort

Postby dduarte05 » December 1st, 2017, 10:09 pm

I'm trying to sort the test_ref.dat file from the example "Two Level Application" and the sort does not work
Attachments
CSPro70_Sort.zip
(2.13 KiB) Downloaded 22 times

Gregory Martin
Posts: 997
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Problems with the sort

Postby Gregory Martin » December 4th, 2017, 12:27 pm

You can't sort the data because it is not in a good state. See these lines:

1010101001001 11002
1010101001002 22001
2010101001001001111
2010101001001002121
2010101001002001223

The first two lines are for different cases (building number 001 and 002). Then the third and fourth lines are for building number 001 and the fifth line is for building number 002. In CSPro, all case lines be together, so the above should instead be:

1010101001001 11002
2010101001001001111
2010101001001002121
1010101001002 22001
2010101001002001223

The same goes for the records of type 3.

dduarte05
Posts: 6
Joined: July 8th, 2014, 12:47 pm
Location: República Dominicana

Re: Problems with the sort

Postby dduarte05 » December 10th, 2017, 9:05 pm

My input file is test_ref.dat and it is not sorted, I need to sort it with CSPro. If I use CSPro 6.3 I order it correctly, but CSPro 7.0 does not. Attached sort of test_ref.dat made with CSPro 6.1
Attachments
CSPro61_sort.zip
(1.94 KiB) Downloaded 17 times

Gregory Martin
Posts: 997
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Problems with the sort

Postby Gregory Martin » December 13th, 2017, 6:05 pm

You are right that this was handled correctly in earlier versions of CSPro but that it fails in CSPro 7.0. The data file input reading algorithm changed in CSPro 7.0, and there is less allowance for incorrectly constructed cases. CSPro reads your lines with record types 2 and 3 as separate cases, and because they don't have a first level record type 1, the case is discarded.

Unfortunately, this makes a two-level record sort impossible. Thank you for bringing this to our attention, as we may not have tested two-level record sorts.

Do you need this functionality for something that you are working on? Very few people use two-level applications, so fixing this may not be a high priority unless it is something that you need for a production application.

dduarte05
Posts: 6
Joined: July 8th, 2014, 12:47 pm
Location: República Dominicana

Re: Problems with the sort

Postby dduarte05 » December 22nd, 2017, 9:25 am

In the statistical office of the Dominican Republic we use CSPro with a two-level dictionary in censuses and surveys, but we can solve the situation with CSPro 6.3
Attachments
Two-level-Dictionary.pdf
(174.02 KiB) Downloaded 21 times


Return to “Tools”