BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi All,

I have a variable whose values are both numeric and charaacters.e.g., 14.2 MG/DL, 19.2 %, no result 12.13 mmol/l, etc... its a mixed of different units r values. My question is 'Is it possible to read only the numeric portion of these values ie. 14.2, 19.2 (if it is text mark as .) 12.13, etc....Will this work with substring & scan function.

It would b helpful if I can have the solution ASAP.
Thanks in advance.
Priya
2 REPLIES 2
1162
Calcite | Level 5
I start with scan and see how far that gets you. You could even add a scan for the second 'word' if you want to capture the units of measure.

For example:
data work.values;
input valstr $16.;
cards;
14.2 MG/DL
19.2 %
no result
12.13 mmol/l
;
run;

data work.values;
set work.values;
length valnum 8.;
valnum = scan(valstr, 1, " ");
run;
deleted_user
Not applicable
hai,

i have seen once u posted that u have SAS certicifation question bank.Can u forward to me. I am planning to take Base SAS certification exam in next month.

Thanqs in advance.

sas-innovate-2024.png

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.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

Discussion stats
  • 2 replies
  • 834 views
  • 0 likes
  • 2 in conversation