Hi ,
new to SAS
I have data where i need to extract the % without the "%"
Data (character values):
column 1
11(21.2%)
0(0.0%)
9(17.3%)
5.(9.6%)
want (in numeric values):
column2
21.2
0.0
17.3
9.6
You identified the proper tool for the job. Try:
column_2 = scan(column_1, 1, '(' );
You identified the proper tool for the job. Try:
column_2 = scan(column_1, 1, '(' );
Scan will return the Character value, so you will need to use an input.
The question, since you are starting with a percent is do you actually want a Percent value: i.e. 21.2% = 0.212 as decimal or 100*0.212 or 21.2
Either of the Y or Z yields 21.2 for the first.
data junk; x="11(21.2%)"; y= input(scan(x,2,'(%)'),6.); z= input(scan(x,2,'()'),comma6.); run;
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.