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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.