Hi,
I want to prefix field values with a tab. (NOTE: It cannot be spaces). Currently I'm using below logic. Field "Sep" should have a vlaue of tab.
Data test;
set qa_accts;
sep=' '; /*** THIS SHOULD BE TAB ***/
ends=''; /** THIS SHOULD BE SPACE **/
var1='V$_dpd';
dpd = actual_dpd;
ltr_variable_data = catx(sep,var1,dpd,ends);
run;
Please try tab space with "09"x
Data test;
set qa_accts;
sep='"09"x; /*** THIS SHOULD BE TAB ***/
ends=''; /** THIS SHOULD BE SPACE **/
var1='V$_dpd';
dpd = actual_dpd;
ltr_variable_data = cat(sep,var1,dpd,ends);
run;
, but again if you are concatenating the variables with catx function, this function will strip the blank spaces in the new variable created i.e., ltr_variable_data. so the best way to avoid it is just use cat function instead of catx. It does not strip or trim the spaces and keeps the spaces as is in the new variable.
Thanks! I used cat function but var1 is having trailing blanks. How to remove them?
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.