08-01-2012 05:53 AM
lI have a startdataset in Data Integration Studio 4.21.
Based on this startdataset, I make a derived dataset. For one numeric variables, I change the length.
I have a numeric variable with lentgh 8 from which I want to make a numeric variable with length 5.
I make a job for this. When I ran the job, I get of course a warning that the values will be truncated. (But that is not a problem for me.)
When I check the properties of the derived dataset, I see that the variable has a length of 5, like I have asked.
So far, so good.
Now I need to move the derived dataset from Data Integration Studio 4.21 on a Windowsmachine to SAS Base 9.1 on a Unixmachine.
Therefore, I use proc cport and proc cimport. This works fine except one thing. The length of the numeric variable is not 5 (as defined) but 6.
I did a test. When I define 6 as length in the derived dataset, after the proc cport/cimport, the length is 7.
So the length is always one more after the proc cport/cimport then before. How is this possible? How can I solve this?
I guess it has something to do with the fact that I have changed the length.
For an other numeric variable for which I did not changed the length, I don't see this. length is 8 before and after proc cport/cimport.
08-01-2012 07:00 AM
I could only guess that the variable length gets increased to maintain numeric precision - but this is a pure guess.
Much more important question: Why are you changing the length of a numeric variable at all? That's not really recommended. You are aware that the length of a numeric variable has not much to do with the "length" of the number you're storing but how many bites are used to store this number. It's very uncommon to change the length of numeric variables and you should have very very good reasons to do so.
08-01-2012 10:31 AM
Since the warning message says that the target is too short for specified source that makes me believe that you actually have values that are too large to be stored in 5 bytes, which would be 8 significant digits. Since you have a format associated of 11. that makes me believe that you are likely to have more digits. OR DI is using that format to assign the export length as a length of 6 is allows 11 significant digits.
I would 1) verify that the largest value of the variable has 8 or fewer significant digits and 2) try changing the format before the export to 8. before the export and see if that changes the behavior.
08-01-2012 11:31 AM
With cimport you have to set the EXTENDSN option to =NO see: http://support.sas.com/documentation/cdl/en/proc/63079/HTML/default/viewer.htm#p1be86uw07acoin1aodzs...