10-09-2013 03:31 PM
I have a list of numbers under variable A:
Now I want to get
Each number now will have 8 digits.
How to do it in SAS?
Thanks so much!
10-09-2013 03:35 PM
Is A numeric or character?
If numeric do you actually need a new variable or for it just to appear with leading zeroes? In this case you can just assign a format to display with zeroes: Format a z8. ;
If A is character there's a number of ways but
A = put(input(a, best8.),z8.) ; might work.
10-09-2013 04:18 PM
It is numeric, and I don't want to create a new variable.
If I want to merge two tables based on A (one table displays with zero, one table does not ), will changing formating work?
10-09-2013 04:30 PM
If A is numeric in both SAS tables you should be able to merge the tables without changing anything.
The internal representation of A (numeric variable) is the same in both tables. The diference in the display should be because of the format in the table: Z8. (with leading zeroes) v.s. 8. or best8. or none (without leading zeroes)