Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Dollar signs from SAS Column

I have an SAS dataset that has $'s in with some of the columns. So instead of reading 67,349 it reads $67,349. How do I remove all the $'s from all the columns and have SAS recognize them as numbers?

There are only a few columns with the dollar signs so I can do each column one at a time. I am using the free university edition of SAS.

like image 484
user18101 Avatar asked Dec 14 '22 04:12

user18101


1 Answers

If you just want to remove the $ and still have a character variable then use the compress() function.

data want;
  set have;
  myvar = compress(myvar,'$');
run;

If you want to convert the character string to a new numeric variable then see this existing question. The COMMA. informat will automatically ignore the $ and , characters in the string. Converting character variabls to numeric in SAS

like image 74
Tom Avatar answered Dec 29 '22 15:12

Tom