7. Let $S$ be a subset of the set of numbers $\{1,2,3, \cdots, 1989\}$, and any two numbers in $S$ have a difference that is not equal to 4 or 7. How many numbers can $S$ contain at most?
$7.1,4,6,7,9$ These five numbers have the property that the difference between any two of them is not 4 or 7. Adding 11 to each gives $12,15,17,18,20$, which clearly also have this property, and the difference between any of these and any of the first five numbers is also not 4 or 7. By analogy, in each consecutive eleven numbers, five can be selected to form the set $S$ (note that $1989=11 \times 180+9$, and the last nine numbers are $1981,1982, \cdots, 1989$, from which five numbers 1981, $1984,1986,1987,1989$ can still be selected). Thus, the number of elements in $S$ is $5 \times 181=905$.

To prove that $S$ cannot contain more numbers, suppose otherwise, then at least one of the 181 groups of numbers can have six numbers selected such that the difference between any two is not 4 or 7. Consider the group $1,2, \cdots, 11$, and divide them into five subgroups: $(4,7,11),(3,10),(2,6)$, $(5,9),(1,8)$. At least one of these subgroups must have two numbers selected. Clearly, the last four pairs cannot both be selected, so only the first subgroup can have 4 and 7 selected. Then, in $(3,10)$, only 10 can be selected; in $(2,6)$, only 2 can be selected; in $(5,9)$, only 5 can be selected; and in $(1,8)$, neither number can be selected. This means it is impossible to select a sixth number, thus proving the claim.