This is the SAS code I use to import data from excel file. The excel file doesn't belong to me so i can't change data appearance within the file:
Proc Import Out = Net_Yields
Datafile = "File.xlsx"
dbms = xlsx
replace;
Getnames = YES;
Sheet = "Gtee Vector";
Range = "S5:V45";
Run;
I import data from excel and it comes to SAS in this format:
Years | X | Gross | Net |
---|---|---|---|
2008 | 1 | (18.13%) | (19.3%) |
2009 | 1 | 25.50% | 23.8% |
2010 | 1 | 8.55% | 7.0% |
2011 | 1 | ( 6.42%) | ( 7.7%) |
I'm working with very large numbers so every decimals after decimal point make sense and is very important.
I need to convert the percents to real numbers format so it will look like this:
Years | X | Gross | Net |
---|---|---|---|
2008 | 1 | -0.1812793769191860 | -0.1925832119518600 |
2009 | 1 | 0.2550005600450760 | 0.2376731361391290 |
2010 | 1 | 0.0854571645604569 | 0.0704705764896025 |
2011 | 1 | -0.0641682597261736 | -0.0770890135366603 |
I tried to format the data but the best result I could get is 5 digits after the decimal point.
Any help appreciated.
Thanks in advance.
Use the format to control numer of decimals. n.p. "n" number of columns with "p" decimal points.
data have;
percent=-0.1812793769191860;
format percent percent9.2;
run;
data want;
set have;
format percent 20.15;
run;
But note that the precision and decimal considerations when working with at large number of decimals