Data in KEYS format is missing or corrupt

44 views
Skip to first unread message

Beatriz Diaz Pauli

unread,
Jun 25, 2025, 6:12:01 AMJun 25
to pcaxis
Hello, 


I get the error message:  "Data in KEYS format is missing or corrupt", when I select the values in the Kommune variable through the link "Gå til: Velg verdier fra gruppe".

However, everything works fine if I select the same values directly from the Kommune box in the "Choose variable" site.

Could please anyone help me understand what is causing the error and how to fix it?

Many thanks for your help.

Beatriz
Skjermbilde 2025-06-25 115817.png

Hans Baumgartner

unread,
Jun 27, 2025, 6:17:33 AMJun 27
to pca...@googlegroups.com

Hi,

>https://statistikkbanken.fiskeridir.no/PxWeb/pxweb/no/Fiskeridirektoratet/Fiskeridirektoratet__F_Fiskeri__F_01_Fiskefart%C3%B8y/F01002.px/
I can see, you are using the file based PxWeb (F01002.px)

We have not been able to get the advanced group select to work with aggregations at all.
When we tested it, we got figures that made no sense. That’s why our selection view looks like this.
https://pxdata.stat.fi/PxWeb/pxweb/en/StatFin/StatFin__vaerak/statfin_vaerak_pxt_11re.px/
Why make it too complicated?
The aggregation files (.vs .agg – file based PxWeb) work with no problems at all but you should keep
the amount of agg and vs files below 3000 if possible. We have 7000 and loading these files takes a
long time every time the service is started, or caches are cleared (PxAdmin or PxAdminAPI).

>
"Data in KEYS format is missing or corrupt",

1. I have never seen this error so i would first test the px-file that you have generated in in
KEYES- px-format ( 0-packing format/Sparse matrix).
If your px-file is in the ordinary px-format the error, you get does not make any sense.
Use this program to test your px.file:
https://pxweb2.stat.fi/pxedit/pxedit.zip
From this page:
https://stat.fi/tup/tilastotietokannat/px-tuoteperhe_en.html
This tool tells you exactly what is wrong with your px-file and saves it in the optimal
px-format (original or sparse matrix can be selected)
PxJob is the same tool but command line usable for automation.

2. Then test the aggregation files with PxWin (made with PxWeb components):
https://www.scb.se/pxwin
Also, the tool with which you can make/generate aggregation files.

I could tell you much more if I saw your px, vs and agg -files.

Also, if I got it right, your file is in KEYES px-format and does not benefit from it
in any way because it only works optimally if table contain mostly zeros (0).
Your px-file has mostly “-“ absolute zero, and dot codes and only some zeroes.
Changing the  “-“ absolute zero to zero “0” could be a solution. Or converting
the file to the normal px-format is another possibility.

Is there a reason why you don’t use the TIMEVAL keyword for the time?
-Time is not inverted in the time selection box (latest first)
-In saved query I can’t select get the latest data or the latest series.


Hans

Lähettäjä: pca...@googlegroups.com <pca...@googlegroups.com> Puolesta Beatriz Diaz Pauli
Lähetetty: keskiviikko 25. kesäkuuta 2025 13.12
Vastaanottaja: pcaxis <pca...@googlegroups.com>
Aihe: Data in KEYS format is missing or corrupt

--
You received this message because you are subscribed to the Google Groups "pcaxis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pcaxis+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pcaxis/20a40871-3e25-414a-888b-6a8fcf62c3e0n%40googlegroups.com.

Beatriz Diaz Pauli

unread,
Jun 30, 2025, 9:06:14 AMJun 30
to pcaxis

Hi Hans,

 

Thanks a lot for help.

 

I did try using PxEdit to check my px file. Even after saving it with PXEdit, I still got the same  "Data in KEYS format is missing or corrupt", again only when selecting the Kommune values through "Go to: Select values ​​from group". So you suggest, I should just remove that link, as it does not work too well?

 

 As far as I know I am not using the KEYS format, at least not willingly.  I make my px file in R using package pxmake. The R package replaces all 0 with "-" be default. 

But if I replace "-" back to 0 with PxEdit, and I try to select Kommune values through  "Go to: Select values ​​from group" I get an error: "An error has occurred. The error has been registered" which opens a new website (see attachment). I attache also my px, vs and agg files.

 

Thanks for the TIMEVAL  tip. I did not know about it, I am just new to the px family, but I will use it from now on.


Thank you very much for your help. 


Beatriz

Kommune.vs
F03002.px
Fylke -2019.agg
Error_message.png

Hans Baumgartner

unread,
Aug 15, 2025, 4:14:47 AMAug 15
to pca...@googlegroups.com

Hi,

If someone still finds some interest in this?

Your px-file gives an error in PxEdit:

"F.03.002 Torsketrål-, rignot- og konvensjonell fartøyflåten, etter type (hoved- og tilleggstillatel.."

[C:\Users\baumgart\Desktop\Uusi kansio (4)\F03002.px]

 

There is a VARIABLECODE reference to a variable 'Verdier' which does not exist in the table.


In your vs and agg -files your texts and your codes are the same (not nice if someone needs only the codes)

Your aggregation file is really complex
Data source px-file  “Kommune” 111 Kommunes
Your aggregation file “Kommune” 895 Kommunes
So, this agg-file is supposedly used to convert any old Kommune to the latest Kommune classification
There is a real possibility to make all kinds of complex errors here
Also, I think you might get problems when trying aggregating missing data (old non existent communes) from the px-file.
We have used files like this in the past, but I don’t know if the PxWeb of today still can do this.
Would it be possible for you to generate the vs and agg files with PxWin aggregation file editor
to get the best results in the beginning. Also testing your vs and agg -files is a lot easier with PxWin.




>As far as I know I am not using the KEYS format, at least not willingly. 

You are right you are not using the PX-KEYES (sparse matrix) format in your px-file



>I make my px file in R using package pxmake. The R package replaces all 0 with "-" be default.
 


Wow if 0 is always replaced with “-“ (absolute zero) this could be a problem. In certain cases

the absolute zero “-“ is not the same as 0. There must be a possibility to control this.
In this case it is OK.



To disable the complex aggregation feature, use the ADMIN config pages.
Selection from group  NO

Aggregation files have worked verry well for us. We have close to 10 000 aggregation files in our PxWeb services.
We are not using the “Selection from group “ feature with the aggregation files.



Hans


Lähettäjä: pca...@googlegroups.com <pca...@googlegroups.com> Puolesta Beatriz Diaz Pauli
Lähetetty: maanantai 30. kesäkuuta 2025 16.06
Vastaanottaja: pcaxis <pca...@googlegroups.com>
Aihe: Re: Data in KEYS format is missing or corrupt

--

You received this message because you are subscribed to the Google Groups "pcaxis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pcaxis+un...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages