Can you explain what you are doing? Why do you need the digits after the period as a separate variable? How many digits do you need? What do want for a number like 1/3 that cannot be represented exactly in as a decimal fraction? Do you want 3? 33? 333? 3333? If you want 2 digits why do you want 10.9 to be 9 instead of 90?
If you just want the remainder use the MOD() function.
remainder = mod(NUM,1);
That will get you .9 and .78 for your two examples. You could multiply by 100 to get 90 and 78 instead.
If you just want the string then convert the number into (back into?) a string and use string functions. So assuming you want two digits after the decimal place you might do something like:
string=scan(put(NUM,32.2),2,'.');
But that will get you '90' and '78' for your examples. To get '9' and '78' use BEST32. instead as the format in the PUT() function call.
Can you explain what you are doing? Why do you need the digits after the period as a separate variable? How many digits do you need? What do want for a number like 1/3 that cannot be represented exactly in as a decimal fraction? Do you want 3? 33? 333? 3333? If you want 2 digits why do you want 10.9 to be 9 instead of 90?
If you just want the remainder use the MOD() function.
remainder = mod(NUM,1);
That will get you .9 and .78 for your two examples. You could multiply by 100 to get 90 and 78 instead.
If you just want the string then convert the number into (back into?) a string and use string functions. So assuming you want two digits after the decimal place you might do something like:
string=scan(put(NUM,32.2),2,'.');
But that will get you '90' and '78' for your examples. To get '9' and '78' use BEST32. instead as the format in the PUT() function call.
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.