SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Transforming numeric to character, and indicating NULL characters, in DI Studio expressions

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 89
Accepted Solution

Transforming numeric to character, and indicating NULL characters, in DI Studio expressions

1) I'm setting up mappings in the File Reader transformation. What kind of expression can I use to transform a numeric variable into a character variable? I tried put(varname, $6.) without any success, and can't seem to find any solutions for the kind of syntax I need for typing expressions.

2) When writing expressions, how do I indicate a blank character? I've tried varname IS NULL, varname = NULL, varname = "", and more, to no avail.

Thanks for your time.


Accepted Solutions
Solution
‎09-13-2012 12:38 PM
Super Contributor
Posts: 349

Re: Transforming numeric to character, and indicating NULL characters, in DI Studio expressions

Hi ,

Check this..

file.PNG

expression:

put(SERIAL_NO ,best.)

output:

file1.PNG

2) case when varnum=''  then InstrumentID else varnum end

Thanks,

Shiva

View solution in original post


All Replies
Solution
‎09-13-2012 12:38 PM
Super Contributor
Posts: 349

Re: Transforming numeric to character, and indicating NULL characters, in DI Studio expressions

Hi ,

Check this..

file.PNG

expression:

put(SERIAL_NO ,best.)

output:

file1.PNG

2) case when varnum=''  then InstrumentID else varnum end

Thanks,

Shiva

Respected Advisor
Posts: 3,899

Re: Transforming numeric to character, and indicating NULL characters, in DI Studio expressions

The result of a put() function is a string but you need to use a numeric format for numeric variables so something like "put(varname,6.)"

The most generic SAS syntax to check for missings is function "missing()" as it deals with both character and numeric variables. "missing()" returns a '1' (='true') it the variable is missing.

For simple If..then..else situations using coalesce() is often an alternative. coalesce() will pick the first non-missing value from a list of values  "coalesce(variable1,variable2,0)"

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 491 views
  • 4 likes
  • 3 in conversation