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!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
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.