   program define myprog
     syntax varlist, [sp *]

	 if (`"`sp'"'!="") _myprogsp `varlist', `options'
	 else _myprog `varlist', `options'
   end

   program define _myprog
     _myprogcommon `0'
   end

   program define _myprogsp, sortpreserve
     _myprogcommon `0'
   end

   program define _myprogcommon
     // do whatever

   end