data want;
txt = "100/50 mg medicin";
c = compress(txt,"0123456789.,/ ","K"); *K is to keep the chars you specified.;
txt_b = compress(txt,"0123456789.,/");
run;
Maybe this will help:
data want;
txt = "10mg-25mg";
a = scan(txt, 1, '-'); /* get text before the dash */
b = scan(txt, 2, '-'); /* get text after the dash */
a_val = input(compress(a,' ', 'A'), 10.); /* get rid of letters, convert to number */
b_val = input(compress(b,' ', 'A'), 10.);
run;
proc print;run;
proc contents; run;
Your words and your code don't match.
You words say that you want to separate 10 from the rest of the text, and yet in your code there is no 10. Could you clarify this, please?
Drug | Strength |
A/B | 10 MG-25MG |
Drug | Dose | Unit |
A/B | 1025 | MG-MG |
Drug | Dose | Unit |
A/B | 10 | MG-25MG |
Maybe this will help:
data want;
txt = "10mg-25mg";
a = scan(txt, 1, '-'); /* get text before the dash */
b = scan(txt, 2, '-'); /* get text after the dash */
a_val = input(compress(a,' ', 'A'), 10.); /* get rid of letters, convert to number */
b_val = input(compress(b,' ', 'A'), 10.);
run;
proc print;run;
proc contents; run;
Thank you Rick!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.