The initial datastep can easily be simplified as follows.
It demonstrates that you can easily re-read the same line both as a character string and as four distinct number simultaneously as follows:

1. using the @1 you start reading again the same line
2. by use of DLM='.' you define separator between adjacent columns
3. by re-writing your formula you only multiply 3 times i.s.o. 6 times.

data IP_numbers (keep = IP IPnum);
infile datalines dlm='.' missover;
input IP $char20. @1 p1 p2 p3 p4;
IPnum = ((p1 * 256 + p2) * 256 + p3) * 256 + p4;
datalines;
115.85.65.148
117.203.114.198
118.96.201.156
...
...