g*********n 发帖数: 441 | 1 hey guys, i have format like 10175996, means the 10:17:59 in the morning,
however, if the digits behind the second larger than 30,i need to transfer
it to 101760. So in this case, 96 is larger than 30, it would be rounding
to 101760. Otherwise, if is 10175929 it still would be 101759. and i need
this format could be character.
I know it is not hard, but when i run some logic, the code would not work.
Any help would be highly appreciated!
Will send baozi, if any SAS code works.
Thanks a lot! | c***z 发帖数: 6348 | 2 use %% and %/% if you are using R | g*********n 发帖数: 441 | 3 i need to fix it by SAS. thanks! | x******n 发帖数: 173 | 4 if (mod(data, 100))>=30 then time = strip(data%1000000)||":"strip(mod(data,
1000000)%10000)||":"||...
something like that
you can figure out
【在 g*********n 的大作中提到】 : hey guys, i have format like 10175996, means the 10:17:59 in the morning, : however, if the digits behind the second larger than 30,i need to transfer : it to 101760. So in this case, 96 is larger than 30, it would be rounding : to 101760. Otherwise, if is 10175929 it still would be 101759. and i need : this format could be character. : I know it is not hard, but when i run some logic, the code would not work. : Any help would be highly appreciated! : Will send baozi, if any SAS code works. : Thanks a lot!
| w*******n 发帖数: 469 | 5 is there the % operator in SAS?
【在 x******n 的大作中提到】 : if (mod(data, 100))>=30 then time = strip(data%1000000)||":"strip(mod(data, : 1000000)%10000)||":"||... : something like that : you can figure out
| x******n 发帖数: 173 | 6 that's what I said probably like that :)
I meant to provide a possible idea, not a final solution for that problem
【在 w*******n 的大作中提到】 : is there the % operator in SAS?
| j******o 发帖数: 127 | 7 Not fancy, but should works.
------------------------------------
data have;
input time $;
datalines;
10175996
10175925
;
run;
data obtain;
set have;
if input(substr(time, 7,2), best12.)<=30 then time1=substr(time, 1, 6);
else do ;
x=input(substr(time, 1,6), best12.)+1;
time1=put(x,z6.);
end;
run;
------------------------------------
【在 g*********n 的大作中提到】 : hey guys, i have format like 10175996, means the 10:17:59 in the morning, : however, if the digits behind the second larger than 30,i need to transfer : it to 101760. So in this case, 96 is larger than 30, it would be rounding : to 101760. Otherwise, if is 10175929 it still would be 101759. and i need : this format could be character. : I know it is not hard, but when i run some logic, the code would not work. : Any help would be highly appreciated! : Will send baozi, if any SAS code works. : Thanks a lot!
|
|