it all depends....the way I do it is this...
the TYPE of yarn doesn't matter too much to me, unless I need it to do what I want the pattern to do (felting for example)
So, I'd find a yarn that matches the guage as closely as possible. You don't mention that here, but in the pattern , it SHOULD give you a guage, try and find a yarn that will knit up the same guage. (Stitches per inch)
Second the length, I always go by the length, because if the guage is slightly different then you will know for sure you have the right LENGTH of yarn necessary. You might get a ball that is double in length.....so you won't need as many balls as "required" by the pattern.