09-13-2014 12:56 AM
I have imported a series of account numbers (not the real ones showing below) but imported as text. I have some account numbers that have a leading 0 and some account numbers are different lengths .. Below are some examples. I need to keep this account number field as numeric with the leading 0 where it should be and with the different length as required.
So they currently import as text, but I want them to be the way they are, however converted as numeric.
09-13-2014 02:04 AM
Impossilbe numeric, decimal numeric does not exist. See also: https://communities.sas.com/message/228508#228508. It is the digital age.
09-13-2014 03:55 PM
You seem confused on the concept of numbers versus character strings. If you store your account ids as numbers then there is no way to distinguish between the values 123 and 0000123 since when you convert those character strings into numbers they are both one hundred and twenty three.
You can attach formats to numbers to have them displayed in different ways. So you could store 123 as a number and attached the Z7. format to it. Then when it is printed in a a report it will look like 0000123. But the format is attached to the variable and not to just a particular value. SAS stores data in data sets and not in a cells like a spreadsheets. So you cannot use a different format on different observations of the data.
So you have two choices.
1) Store your account id as a character string. This is the most logical as it is NOT a number (even if people do call them account "numbers") but an identifier. You will not be taking the mean or square root of your account ids.
2) Add another variable. So if you wanted to treat 123 and 0000123 as different in some way you need another variable to distinguish them. It could be the number of digits. (123,3) vs (123,7) It could be an actual format (123,'Z3.') vs (123,'Z7.).