Forums: Define.xml

j
Jozef

on August 20, 2021
"Length" is the longest length of the value as a string in number of characters. SignificantDigits, the longest length of what is after the decimal point.

So: 2.1, 3, 4, 11.3, 12.2, 99 => DataType=float Length=4, SignificantDigits=1

So, yes, the minus sign must be taken into account.

So: -1.1, -2.1, -10.0 => DataType=float Length=5, SignificantDigits=1

The original idea for these were that information is provided for storing the data in a relational database, e.g. automated generation of SQL "CREATE TABLE" statements.

With modern databases, this is usually not necessary anymore, except probably for "VARCHAR(n)".

With best regards,

Jozef Aerts

CDISC Define-XML Development Team

P.S. This is not about "P21 preferences", these are Define-XML rules from CDISC.

y
Yuta

on August 23, 2021
Hi Eunkyung and Jozef,

According to Section 2.4.2.1 of the Define-XML Version 2.0 Completion Guide issued by the PHUSE, Isn't the following correct?

- 2.1, 3, 4, 11.3, 12.2, 99 => DataType=float Length=3, SignificantDigits=1
- -1.1, -2.1, -10.0 => DataType=float, Length=3, SignificantDigits=1

At least, length of float for plus value was discussed in the Japanese Forum below.

https://www.pinnacle21.com/forum/definexml-1

Thank you,

j
Jozef

on August 24, 2021
Dear Yuta,

The "Completion Guide" that you mention is NOT the standard. Binding is ONLY the standard itself. The standard can be downloaded from:

https://www.cdisc.org/standards/data-exchange/define-xml

If you mean the draft version of that completion guide, published in 2018, it contained a large number of errors - I submitted over 100 comments.

Has there been a "final" version of that document? Then can you please provide me a link so that I can check whether the errors of the draft have been corrected?

With best regards,

Jozef

y
Yuta

on August 24, 2021
Dear Jozef,

Thank you as always for your help. I refer the Completion Guidelines issued by the PHUSE in 2019 below. Please see section 2.4.2.1.

https://phuse.s3.eu-central-1.amazonaws.com/Deliverables/Optimizing+the+Use+of+Data+Standards/Define-XML+Version+2.0+Completion+Guidelines.pdf

There are the following descriptions in the Completion Guidelines.

"DataType = ‘float’: Maximum value is 12786.5678, maximum precision is 0.0001. Length = “9” SignificantDigits = “4” This variable can process and store numeric values between -100000 (i.e. -10^9-4) and 100000 (i.e. 10^9-4) with four decimals."

So, I interpreted this description for length includes minus value because of the description of "between -100000 (i.e. -10^9-4) and 100000 (i.e. 10^9-4)".

And, of course, I read the CDISC Define-XML Specification Version 2.0 you mentioned.

There are descriptions regarding length for float values below in section 4.2.1 in the document.

"Define-XML Data Type="float""

"Length="The largest allowable whole number width plus the maximum number of decimal digits.""

I think there is not any discrepancy between descriptions in these documents above. Is my understand correct?

Best regards,

Yuta

j
Jozef

on August 24, 2021
Dear Yuta,

I think you are right, and I was wrong - my apologies for that!

I checked in the ODM v.1.3.1 specification, as that is the basis for the define.xml standard (also in ODM, "ItemDef" is used), and as I think it is much better explained in the ODM specification:

The define-xml specification (for v.2.1) states for "Length" (p.20):

"The largest allowable whole number width plus the maximum number of decimal digits."

The question here of course is what "whole number" and "number width" exactly mean. Does that incliude the decimal point?

The ODM-1-3-1 specification is i.m.o. clearer:

"*If DataType=float, Length=N and SignificantDigits=S is a requirement that the receiving system be able to process and store all numeric values of magnitude less than 10N-S that are multiples of 10-S. Larger values may be rejected. Intermediate values may be rounded to the nearest multiple of 10-S*".

So, suppose we have Length=5 and SignificantDigits=2.

Then, the receiving system must be able to process numeric values of less than 10power(5-2), which is 10power3, or 1000,

that is a multiple of 10power-2 (0.01). So, numbers up to 999.99 should be supported.

It however remains unclear what that means for negative values, unless one interpretes "magnitude" as being the absolute value, i.e. a magnitude cannot be negative, which may be a bit culture dependent ...

So, I believe you are right! You convinced me ... :-)

Now, how important is this?

For datatype "text", one of the original intents was to allow automated generation of database tables, e.g. VARCHAR(n) or CHAR(n) definitions.

For "float" and "integer", SQL had the datatype definition FLOAT(*size*, *d*), which I think works exactly the same as "Length" and "SignificantDigits" in Define-XML and ODM.

Modern databases however do not use this any more (in MySQL it is deprecated as of v.8.0.17). Instead DECIMAL(*size*, *d*) or DOUBLE(*size*, *d*) is used. Also FLOAT(*p*) is used instead. What a database would do when I use e.g. DECIMAL(5,2) and I try to add "1000.00" I don't know - I will try it out.

But maybe I am too much spoiled by modern programming languages like Java where in 99.999% of the cases it doesn't matter, where it covers 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative) anyway ...

y
Yuta

on August 25, 2021
Dear Jozef,

Thank you very much for your explanation in detail. I learned a lot from your reply. And I relieved that my understanding for Define-XML is correct. Thank you again!!

Best regards,

Yuta

I have a question about how to set the length of integer or float variables in Define.xml.

If the variable has the values like 2.1, 3, 4, 11.3, 12.2, 99 then I guess, the length will be set as '3' with significant digit 1 and its format is float.

However, if some minus values are included in this variable, like -1.1, -2.1, -10.0, how can I set the length of the variable?

Should the minus sign(-) be taken into account to calculate the length?

If the minus sign(-) is taken into account when calculating the length, the length will be set to 4 (1 for minus sign + 3 for number).

Or should I exclude the minus sign?

Please let us know your preferences.