Hi All,
Please kindly help me with the below query.
I am trying to create an account number using 2 different variables.
I have the following data:
Branch Account
1000 10090
I want the output to look like this:
Account number
100001009000
Please kindly assist me.
@MagD wrote:
Hi All,
Please kindly help me with the below query.
I am trying to create an account number using 2 different variables.
I have the following data:
Branch Account
1000 10090
I want the output to look like this:
Account number
100001009000
accountnumber = cats(branch,'0',account,'00');
if you want to concatenate you can try the below code
data want;
set have;
account_number=cats(branch,account);
run;
Are these character or numeric variables?
@MagD wrote:
Hi All,
Please kindly help me with the below query.
I am trying to create an account number using 2 different variables.
I have the following data:
Branch Account
1000 10090
I want the output to look like this:
Account number
100001009000
accountnumber = cats(branch,'0',account,'00');
Sir @PaigeMiller How did you make that assumption of the length? does that come from general banking experience with some standardization of branch code length and acctno lengths?
@novinosrin wrote:
Sir @PaigeMiller How did you make that assumption of the length? does that come from general banking experience with some standardization of branch code length and acctno lengths?
The original problem was stated as:
I want the output to look like this:
Account number
100001009000
Thanks, @PaigeMiller PaigeMiller it works!
is Branch always exactly 4 digits? If not what would the desired result be for a 1, 2, 3 or 5 digit branch?
Is Account always exactly 5 digits? If not describe what the result should be for a 1 to 7 digit account.
You likely would need to do something to adjust the concatenation for different lengths.
Question: Why were these numeric values? Did you import or read a file that stripped leading zeroes from values like 010090
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.