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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 814 views
  • 0 likes
  • 2 in conversation