BookmarkSubscribeRSS Feed

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?

proc sql;

create table work.dtv1 as

select

distinct month_date,

balance_outstanding as balance,

curr_index_val as val,

round(balance/val denominator,0.00001) as dtv

from

  1. gbasel.baseljul14

where optimum_platform = 'Optimum'

and Arrears_lit_stage_code not in ('L4','L5','L6')

order by month_date;

quit;

5 REPLIES 5
Reeza
Super User

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

from

Ove tried running the code but now error with this message?  

85 round(balance/val Denominator,0.00001)*10000 as dtv format=8.2

-----------

22

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, ^=, |, ||, ~=.

Reeza
Super User

the first argument to the round function isn't valid.

round(balance/val Denominator,0.00001)

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.

jakarman
Barite | Level 11

same question: https://communities.sas.com/message/222621

---->-- ja karman --<-----
joe00033
Calcite | Level 5

Hi Brandon,

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 5075 views
  • 0 likes
  • 4 in conversation