BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BrahmanandaRao
Lapis Lazuli | Level 10

Hi Guys Good Evening

 

i want splt the value as integer and float with seperate columns

data test;
input value;
cards;
12.356
45.257
15.12
120.12
;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

And if you wanna keep as character-->

data want;
 set test;
 length int float $8.;
 int=scan(put(value,best. -l),1,'.');
 float=scan(put(value,best. -l),-1,'.');
run;

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

So in the first, obs you want 12 in the first column and 356 in the second, correct?

BrahmanandaRao
Lapis Lazuli | Level 10

Hi Dracut 

output like below

 

ValueInteger valueFloat value
12.35612356
45.25745257
15.121512
120.1212012
novinosrin
Tourmaline | Level 20

data test;
input value;
cards;
12.356
45.257
15.12
120.12
;
run;

data want;
 set test;
 int=int(value);
 float=value-int;
run;

Hi @BrahmanandaRao  Funny question though 🙂

novinosrin
Tourmaline | Level 20

And if you wanna keep as character-->

data want;
 set test;
 length int float $8.;
 int=scan(put(value,best. -l),1,'.');
 float=scan(put(value,best. -l),-1,'.');
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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