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)"
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.