BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BrahmanandaRao
Lapis Lazuli | Level 10

Hi

Guys in below excel sheet i have text data in column  B so in that i want mobile number 

its highlighted by red color for your understanding

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
proc import datafile='c:\temp\New Microsoft Office Excel Worksheet (3).xlsx' out=have dbms=xlsx replace;
run;
data want;
 set have;
 phone_number=scan(___VIT_AP_University_campus__Ina,-2,',');
run;

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

Most of us will not or cannot download Excel files (or any files).

 

Please provide your data according to these instructions: https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/

--
Paige Miller
BrahmanandaRao
Lapis Lazuli | Level 10
Data like that only
PaigeMiller
Diamond | Level 26

@BrahmanandaRao wrote:
Data like that only

Then many of us can't help you. (But, yes you can, by putting in a little effort, turn your data into the format requested, and then we can help you)

--
Paige Miller
BrahmanandaRao
Lapis Lazuli | Level 10
I know solution in excel but i want SAS and Python
PaigeMiller
Diamond | Level 26

So put in a little effort and change it to a SAS data set and give it to us following the instructions. Then we can show you how to use SAS to extract the phone number.

--
Paige Miller
BrahmanandaRao
Lapis Lazuli | Level 10
I did solve using pandas
With same excel sheet without any format modifications after import the file
Ksharp
Super User
proc import datafile='c:\temp\New Microsoft Office Excel Worksheet (3).xlsx' out=have dbms=xlsx replace;
run;
data want;
 set have;
 phone_number=scan(___VIT_AP_University_campus__Ina,-2,',');
run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2237 views
  • 1 like
  • 3 in conversation