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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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