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