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;
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;
So in the first, obs you want 12 in the first column and 356 in the second, correct?
Hi Dracut
output like below
Value | Integer value | Float value |
12.356 | 12 | 356 |
45.257 | 45 | 257 |
15.12 | 15 | 12 |
120.12 | 120 | 12 |
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 🙂
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.