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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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