08-20-2014 12:21 PM
I have this code and my output is displaying 0.000315686 but I need it to read 3.15. I have tried to do this on the code but im not getting the result. Can someone please confirm the issues?
create table work.dtv1 as
balance_outstanding as balance,
curr_index_val as val,
round(balance/val denominator,0.00001) as dtv
where optimum_platform = 'Optimum'
and Arrears_lit_stage_code not in ('L4','L5','L6')
order by month_date;
08-20-2014 01:12 PM
That doesn't quite look like correct SAS code with the space in the variable name, I'll assume the editor ate a symbol or something.
round(balance/val denominator,0.00001)*10000 as dtv format=8.2
08-21-2014 05:02 AM
Ove tried running the code but now error with this message?
85 round(balance/val Denominator,0.00001)*10000 as dtv format=8.2
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, ',', -, '.',
/, <, <=, <>, =, >, >=, ?, AND, CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE,
LT, LTT, NE, NET, OR, ^=, |, ||, ~=.
08-21-2014 10:37 AM
the first argument to the round function isn't valid.
val denominator? Is that two separate variables or a single with a underscore?
As initially indicated your code was not correct to start off with.
08-21-2014 10:40 PM
I think Reeza's and Jaap's comments are on point (including checking for bad variables names and the like). Please consider the nature of the comments and don't just copy and paste. The moral of the story is to know how formats work.
Keep in mind that what SAS stores as data is not the same as what you see on the screen in output. You should use FORMAT to control what you see in output (and other output related things), as suggested by others above. Formats can be changed on the fly; defining a format in a dataset is only for convenience.
I would avoid using the round function. See below for why you may not want to use the round function.