BookmarkSubscribeRSS Feed
barbier
Calcite | Level 5

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.

screen_DI.bmp

4 REPLIES 4
Patrick
Opal | Level 21

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.

ballardw
Super User

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.

Ksharp
Super User

Or you can use dataset option OUTREP= to generate a UNIX version dataset .Just a workaround.

Ksharp

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1150 views
  • 0 likes
  • 5 in conversation