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.
Hi ,
Check this..
expression:
put(SERIAL_NO ,best.)
output:
2) case when varnum='' then InstrumentID else varnum end
Thanks,
Shiva
Hi ,
Check this..
expression:
put(SERIAL_NO ,best.)
output:
2) case when varnum='' then InstrumentID else varnum end
Thanks,
Shiva
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)"
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.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.