I did not quite understand the question-related example. But you can loop through the sequence (1 to 100) and one through the directions (top, right, bottom and left) and create classes for each of the situations.
Ex.
SASS:
$_DIRECTIONS: (top right bottom left)
@for $i from 1 through 100
.margin-#{$i}
margin: #{$i}px
@each $direction in $_DIRECTIONS
.margin-#{$direction}-#{$i}
margin-#{$direction}: #{$i}px
SCSS:
$_DIRECTIONS: (top right bottom left);
@for $i from 1 through 100 {
.margin-#{$i} { margin: #{$i}px; }
@each $direction in $_DIRECTIONS {
.margin-#{$direction}-#{$i} { margin-#{$direction}: #{$i}px; }
}
}
HTML:
<div class="container margin-top-12 margin-left-15 margin-bottom-88"></div>