Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to combine two variables into one variable that has different length of number? So the pseudo data is as below.
dat:
load * inline [ identification, acct
101111, 150
101111, 170
101112, 180
101112, 2000
101113, 200
101113, 1500];
and what I want to create is as below.
101111-0150
101111-0170
101112-0180
101112-2000
101113-0200
101113-1500
(1) I need to add zero if acct length is three digit. like 150=>0150
(2) then add '-' between identification and acct
Thank you!
Try this,
dat:
load *, identification&'-'&Num(acct,'0000') As Out inline [
identification, acct
101111, 150
101111, 170
101112, 180
101112, 2000
101113, 200
101113, 1500];
Try this,
dat:
load *, identification&'-'&Num(acct,'0000') As Out inline [
identification, acct
101111, 150
101111, 170
101112, 180
101112, 2000
101113, 200
101113, 1500];
Output:
What if the acct consists with characters?, like
acct
N230
DR20
NPER
Then Num() is not working...
may be this
identification&'-'&
if(isnum(acct),num(acct,'0000'),acct) as out inline