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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.