Help using Base SAS procedures

Need Help for SAS Data Integration Studio 3.4

Reply
N/A
Posts: 0

Need Help for SAS Data Integration Studio 3.4

Hi,

I have just getting started to use SAS Data Integratino Studion 3.4 I have a question to ask.

Problem:
The length of the target column is shorter than the source column. A derived mapping is required between these columns. Do you wan to create an expression?

Eg src data field: student_id; data type numeric; data size 8
target data field: student_id; data type numeric; data size 7

How can I overcome this problem?

Thanks. =)

Yours Sincerely,
helphelp
Super Contributor
Posts: 474

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to deleted_user
Actually this is quite wrong.
You are trying to populate a variable that is shorter in size (1 byte less) than the source expression, so truncation may occur.

The right way to avoid this, would be resize BOTH variables to a desired value.
What is the range of values of the student_id var?

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.
N/A
Posts: 0

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to DanielSantos
Thanks for the reply.

What if there is a situation like this, what should be done when you are mapping the source column to the target column? Is there any function to change the data size?

Thanks.

Yours Sincerely,
helphelp
Super Contributor
Posts: 474

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to deleted_user
Yes there is.

Check the online documentation for the TRUNC function:
http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000245963.htm

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.
Super Contributor
Posts: 474

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to DanielSantos
Have you tried this?

> Yes there is.
>
> Check the online documentation for the TRUNC
> function:
> http://support.sas.com/documentation/cdl/en/lrdict/617
> 24/HTML/default/a000245963.htm
>
> Cheers from Portugal.
>
> Daniel Santos @ www.cgd.pt.
Valued Guide
Posts: 2,177

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to DanielSantos
nope
looking at it now, it is interesting and useful outside of DI, but...
but in the DI environment, you need to register such column attributes, or you lose them.. Possibly the same will happen in E.G.

PeterC
Super Contributor
Posts: 474

Re: Need Help for SAS Data Integration Studio 3.4

Hello Peter.

I was actually asking HelpHelp, because he/she had already posted the question before, and that was my answer.

From my SAS DI Studio experience there is nothing wrong mapping different variable sizes (bigger to smaller, which is the case), IF an expression is specified to convert/truncate the source value. SAS DI Studio uses the same principle, as stated in the error message.

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.
Super User
Posts: 5,428

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to DanielSantos
The easiest way I found in these situations is just to map using a derived expression, and just pick/print the source columns name.
As discussed earlier, you need to be sure that truncation (loss of numeric precision) will not occur, but going from 8 to 7 bytes should in most cases be safe, at least if only integers is to be stored.

/Linus
Data never sleeps
SAS Employee
Posts: 174

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to deleted_user
When mapping you can create an expression using i.e. trim(), strip(), substr() or another function to change the length.

But remember to look into why you wan't to change the length on your target table.
Super Contributor
Posts: 474

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to GertNissen
> When mapping you can create an expression using i.e.
> trim(), strip(), substr() or another function to
> change the length.
>
> But remember to look into why you wan't to change the
> length on your target table.

True for alphanumeric variables, which is not the case.

Of course you could always convert them to alpha, trim, then back to numeric. But, a little bit confusing to do.

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.
SAS Employee
Posts: 174

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to DanielSantos
ups, sorry your right - had not seen it was a numeric variable - my fault.
N/A
Posts: 0

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to GertNissen
Is there a function to cahnge the data size of the numeric data type without changing the data?

E.g. student id = 12345678 data size 7 (source)

same as

student id = 12345678 data size 8 (target)

Thanks

Yours Sincerely,
helphelp
Valued Guide
Posts: 2,177

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to deleted_user
it is not a function that sets a numeric variable's length, but the data definition.
In the mapping where the variable is first defined, see if you can set its properties, including its length.

PeterC
N/A
Posts: 0

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to deleted_user
Hi Guys,

Thanks for helping me out.


the trunc function only allows you change from a smaller size ( i.e from a data size 8 to 7)

What if I am needed the other way round ( E.g. from a data size 7 to data size 8)
the trunc function will not allow me to do that.

So, is there any function that allows me to do this kind of upsizing the data size? )

Thanks

Yours Sincerely,
helphelp
Super User
Posts: 5,428

Re: Need Help for SAS Data Integration Studio 3.4

Posted in reply to deleted_user
To "upscale" a column, numeric or char, you don't need any function, both SAS programming wise and in DI Studio, you just map the columns 1:1.
/Linus
Data never sleeps
Ask a Question
Discussion stats
  • 17 replies
  • 182 views
  • 0 likes
  • 5 in conversation