BookmarkSubscribeRSS Feed
RDS2020
Calcite | Level 5

Hi All,

I am trying to fix value shown by Statemnt PICTURE:-

 

Existing program is using below format

 

proc format;
picture dollarydoos
1000 - 9999 = '0999.9' (prefix= '$' multiplier = 0.1 )

 

Actual Value-1234

Shown as -012.3

 

even when i am trying this

1000 - 9999 = '999.9' (prefix= '$' multiplier = 0.1 ) still result is same.

 

How can i make 1234 shown as 123.4 or even 123. I would like to remove this extra 0

 

7 REPLIES 7
ballardw
Super User

@RDS2020 wrote:

Hi All,

I am trying to fix value shown by Statemnt PICTURE:-

 

Existing program is using below format

 

proc format;
picture dollarydoos
1000 - 9999 = '0999.9' (prefix= '$' multiplier = 0.1 )

 

Actual Value-1234

Shown as -012.3

 

even when i am trying this

1000 - 9999 = '999.9' (prefix= '$' multiplier = 0.1 ) still result is same.

 

How can i make 1234 shown as 123.4 or even 123. I would like to remove this extra 0

 


Do yo actually mean that your value is a negative 1234?

I don't believe any of your "results" as none of them show a dollar sign.

I am not sure what you mean by "remove this extra 0". I don't see any 0 in the result either.

 

Consider:

proc format;
picture dollarydoos
100 - 9999 = '0009.9' (prefix= '$' 
                         multiplier=1
                         )
;


data _null_;
  x= 1234;
  put x= dollarydoos.;
run;

After the multiple you used was applied the result 123.4 was outside of the range of 1000-9999 specified for the format.

 

Please show code for exactly how you are testing the result of the format. Include assigning the value and using it to display the value.

RDS2020
Calcite | Level 5
Nope its not negative. it is converting 1234 value to 012.3instead of 123.4. 1234 is well in range of 1000-9999
Kurt_Bremser
Super User

First, the multiplier is applied to the value; then, the integer value resulting from that calculation is placed into the picture:

proc format;
picture dollarydoos
  1000 - 9999 = '0009.9' (
    prefix= '$' 
    multiplier=1
  )
;
run;

data _null_;
x= 1234.555;
put x= dollarydoos.;
run;
ballardw
Super User

@RDS2020 wrote:
Nope its not negative. it is converting 1234 value to 012.3instead of 123.4. 1234 is well in range of 1000-9999

Did you run my code example?

RDS2020
Calcite | Level 5

Hi @ballardw ,

Yes i tries it. It is giving 

x=$123.4

so since it is multiplied by 1 shudnt it show 1234.5 and shouldnt have changed the value.

 

Formatting shouldnt change the actual value, isnt it so?

 

Thanks,

RDS

ballardw
Super User

@RDS2020 wrote:

Hi @ballardw ,

Yes i tries it. It is giving 

x=$123.4

so since it is multiplied by 1 shudnt it show 1234.5 and shouldnt have changed the value.

 

Formatting shouldnt change the actual value, isnt it so?

 

Thanks,

RDS


So what exactly is your question? You started off claiming that you wanted, or expected, 123.4 as the output.

Formatting does NOT change the value of any variable. Ever. However it will significantly change how the value may appear in output.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 1079 views
  • 0 likes
  • 3 in conversation