BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
hhchenfx
Rhodochrosite | Level 12

Hi Everyone,

I have number 15.699997 and I want to create variable with value 15.69***.

Can you please modify the code below to get it work?

Thanks,

HHC

 

 

data have;
	input a;
	datalines;
15.699997
;
run;

data want;
	set have;
	c=catt(a, " **** ");
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
AhmedAl_Attar
Ammonite | Level 13
data want;
set have;
c=catt(PUT(a,8.2), "****");
run;

View solution in original post

4 REPLIES 4
AhmedAl_Attar
Ammonite | Level 13
data want;
set have;
c=catt(PUT(a,8.2), "****");
run;
ballardw
Super User

This works for that single value.

God knows why you want that. Smacks of the social sciences * ** and *** for "significance levels"

data have;
	input a;
   x = cats(substr(put(a,f9.6),1,5),"***");
datalines;
15.699997
;

If you have a more generic question you should make it so as the proposed solution won't work for values above 100 most likely and may have issues with small values of A

hhchenfx
Rhodochrosite | Level 12

Thank you for your help.

The *** is just an example. I add text to number.

HHC

ballardw
Super User

@hhchenfx wrote:

Thank you for your help.

The *** is just an example. I add text to number.

HHC


I thought you wanted 15.69***. Using 8.2 format results in 15.70***.

 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 869 views
  • 0 likes
  • 3 in conversation