BookmarkSubscribeRSS Feed
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
Hello all;
Hope everyone had a good holiday.
Question when using a compute statement-
So I have a define statement that dictates specific colors based on a specific compliance rate-
such that:
DEFINE FYTD1 /"FYTD" format=percent10. style={background=colors.};

But then I have one row that is not a percentage but rather a number that I would like to calculate as an actual integer-

So right now-420 becomes 42000%.
I managed to solve the background color issue but how do I fix the other problem-
So far I have tried:

compute FYTD1;
if _name_= 'Number Overall Observations' then do;

call define (_col_, 'style','style={background=white}');
call define (_col_, 'format','format=8.2');

end;
endcomp; */

Any suggestions would be much appreciated-Thank you.
LB
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
The percent format does an automatic multiply by 100. Not what you want. But I think you just have the syntax of the CALL DEFINE for format wrong. Try this:
[pre]
call define (_col_, 'format','8.2');
[/pre]
(without the format=)

cynthia
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
Cynthia;
That worked. Thank you.
LB

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 613 views
  • 0 likes
  • 2 in conversation