HI,
I have a set of data with percentages.
TotalC is a character variable.
TotalC
222,98
1,0.3
2,45
13,45
I need to extract only the part of string before , (210,1,2,13).
I need a numeric variable total:
Total
210
1
2
13
Please advise.
Thanks,
Archana
Where does the 210 come in? Did you mean the part before the comma:
A character variable could be:
Newvariable = scan(TotalC,1,',');
in a data step.
If you need more than before only the first comma then you will need to provide rules.
If there is no part before the comma what should the returned value be?
total = input(scan(totalc,1,","), best.);
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.
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.