Hi all
My data set has a column of numbers. Some numbers in the column have *, so for example
1
2
4*
3
2*
5*
2
How do i remove *?
Thanks
Gene
Assuming the data set is in SAS and the column is character, use the COMPRESS() function to remove the *.
Also assuming you would like that value as numeric, you can nest it with an INPUT function as well.
num_var = input(compress(original_var, '*'), 8.);
Documentation on compress function.
May be worth taking a look at the k and d modifiers if you have more than one character to remove.
@geneshackman wrote:
Hi all
My data set has a column of numbers. Some numbers in the column have *, so for example
1
2
4*
3
2*
5*
2How do i remove *?
Thanks
Gene
Hi Reeza. Thanks for responding. My only concern was that the character I'm removing is the asterisk, "*". I wasn't sure whether SAS would read it as a wild card and remove everything.
My question with data like this would be "what does the the asterisk represent?" If there is some meaning that may be needed at a later date perhaps you need some approach other than just removing it.
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.