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.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

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