using variables in case statement

is it possible to call a variable in a case statement, for example

lsmonth=Jan|Feb
l |while read ans
do
   mymonth=`echo $ans |awk '{print $6}'`
   case $mymonth in
    $lsmonth) echo do something
    ;;
    *) echo do something else
    ;;
  esac
done   

I want to use $lsmonth after the case $mymonth in

lsmonth='Jan|Feb'
while read ans
do
	cmd=$(
		echo "
		case $ans in
		$lsmonth) echo do something
		;;
		*) echo do something else
		;;
		esac
		" )
eval $cmd
done

Please use code tags.

That will not work in most shells. The variable will be considered a single string, not as two choices.

And there's no need for command substitution:

case $ans in
     a|b) cmd='echo "do something"' ;;
     *) cmd='echo "do something else"' ;;
esac
eval "$cmd"

but doesn't that defeat the purpose of using a variable as valid 'choice'?
Is there a way to do it the way the OPed wanted originally?
I remember seeing something very similar done somewhere...

There is no purpose in using syntax that is not supported.

eval "case \$ans in $lsmonth) .... esac"

thanks - appreciated.

lsmonth1=Jan; lsmonth2=Feb
l |while read ans
do
   mymonth=`echo $ans |awk '{print $6}'`
   case $mymonth in
    $lsmonth1|$lsmonth2) echo do something
    ;;
    *) echo do something else
    ;;
  esac
done

There's no need for awk:

ls -l |
while read perms links owner group size month day time file x link
do
  case $month in
    $lsmonth1|$lsmonth2) echo do something
    ;;
    *) echo do something else
    ;;
  esac
done

I know, I wanted to make as few modifications to the OP's script as possible to better illustrate the use of the variables.. Good point though of course...