DATA Step, Macro, Functions and more

Variable Account_Name contain both character and numeric

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Variable Account_Name contain both character and numeric

Hi, 

I am studying Base SAS , i have doubt on topic 

 

for example in one variable i have both numeric and character 

I need to separate numeric as one new variable and characters as one new variable

 

RAW DATA

 

Account_Name

AQI2

A347B

89CDI

7890

ABCD

A1Z1D2

 

I need output as

 

AccId

AQI

AB

CDI

.

ABCD 

AZD

 

AccCode

2

347

89

7890

.

112

 

 

Any one help me 

i need ans for this ???

Thanks in advance

 


Accepted Solutions
Solution
‎02-17-2017 01:05 AM
Super User
Posts: 5,082

Re: Variable Account_Name contain both character and numeric

Accld = compress(account_name, , 'd');

 

AccCode = compress(account_name, , 'kd');

 

In the third parameter of COMPRESS: d=digits, k=keep

View solution in original post


All Replies
Solution
‎02-17-2017 01:05 AM
Super User
Posts: 5,082

Re: Variable Account_Name contain both character and numeric

Accld = compress(account_name, , 'd');

 

AccCode = compress(account_name, , 'kd');

 

In the third parameter of COMPRESS: d=digits, k=keep

New Contributor
Posts: 2

Re: Variable Account_Name contain both character and numeric

Thanks it worked


12.JPG
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 119 views
  • 1 like
  • 2 in conversation