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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: