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

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
Rhodochrosite | Level 12
data want;
set have;
c=catt(PUT(a,8.2), "****");
run;

View solution in original post

4 REPLIES 4
AhmedAl_Attar
Rhodochrosite | Level 12
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
Barite | Level 11

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-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!

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