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;
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!
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.