
21 So.3d 914 (2009)
STATE of Florida, Appellant,
v.
Horace HEWITT, Appellee.
No. 4D08-4008.
District Court of Appeal of Florida, Fourth District.
November 12, 2009.
Bill McCollum, Attorney General, Tallahassee, and Myra J. Fried, Assistant Attorney General, West Palm Beach, for appellant.
Carey Haughwout, Public Defender, and Ian Seldin, Assistant Public Defender, West Palm Beach, for appellee.
CIKLIN, J.
The State appeals a sentencing order, arguing that the trial court erred in not sentencing the defendant as a habitual felony offender without holding a hearing or making the required findings pursuant to section 775.084(3)(a), Florida Statutes (2008). We dismiss, finding sua sponte that a legal sentence is not an appealable order.
Under section 775.084(3)(a), before determining habitual felony offender status, a trial court is required to do the following:

*915 (3)(a) In a separate proceeding, the court shall determine if the defendant is a habitual felony offender or a habitual violent felony offender. The procedure shall be as follows:
1. The court shall obtain and consider a presentence investigation prior to the imposition of a sentence as a habitual felony offender or a habitual violent felony offender.
2. Written notice shall be served on the defendant and the defendant's attorney a sufficient time prior to the entry of a plea or prior to the imposition of sentence in order to allow the preparation of a submission on behalf of the defendant.
. . . .
6. For an offense committed on or after October 1, 1995, if the state attorney pursues a habitual felony offender sanction or a habitual violent felony offender sanction against the defendant and the court, in a separate proceeding pursuant to this paragraph, determines that the defendant meets the criteria under subsection (1) for imposing such sanction, the court must sentence the defendant as a habitual felony offender or a habitual violent felony offender, subject to imprisonment pursuant to this section unless the court finds that such sentence is not necessary for the protection of the public. If the court finds that it is not necessary for the protection of the public to sentence the defendant as a habitual felony offender or a habitual violent felony offender, the court shall provide written reasons; a written transcript of orally stated reasons is permissible, if filed by the court within 7 days after the date of sentencing. Each month, the court shall submit to the Office of Economic and Demographic Research of the Legislature the written reasons for transcripts in each case in which the court determines not to sentence a defendant as a habitual felony offender or a habitual violent felony offender as provided in this subparagraph.
Prior to the sentencing hearing, the State filed timely notice of intent to declare the defendant a habitual felony offender. At the sentencing hearing, the trial court was invited into the plea dialogue by defense counsel and therefore offered the defendant the lowest permissible prison sentence, according to the defendant's scoresheet of 43.8 months. See State v. Warner, 762 So.2d 507, 513 (Fla. 2000) (While a "trial court must not initiate a plea dialogue ... at its discretion, it may (but is not required to) participate in such discussions upon request of a party."). The State continued to press for a habitual felony offender designation. Over the State's objection, the trial court decided to sentence the defendant to 43.8 months in prison without designating him a habitual felony offender. The trial court did not conduct a separate habitual felony offender hearing or provide any written or oral reasons for its decision.
The trial court's failure to conduct a separate hearing or make written or oral findings on the defendant's habitual felony offender status was in error. However, while not raised on appeal, this court is obligated to find that it lacks subject matter jurisdiction to review this issue. See Ruffin v. Kingswood E. Condo. Ass'n, Inc., 719 So.2d 951, 952 (Fla. 4th DCA 1998) ("It is well settled that lack of subject matter jurisdiction may be raised sua sponte by an appellate court.") (citation omitted); Polk County v. Sofka, 702 So.2d 1243, 1245 (Fla.1997) ("However, `[c]ourts are bound to take notice of the limits of their authority and if want of jurisdiction appears at any stage of the proceedings, original or appellate, the court should notice *916 the defect and enter an appropriate order.'") (citation omitted).
Section 924.07(1)(e)(i), Florida Statutes (2008), permits the State to challenge a sentence "on the ground that it is illegal" or one that is "imposed below the lowest permissible sentence established by the Criminal Punishment Code under chapter 921." Neither of these grounds apply in this case. A sentence cannot be deemed illegal due to procedural error if it is within statutory limits. See State v. Riley, 648 So.2d 825, 826 (Fla. 3d DCA 1995). In Riley, the State appealed the trial court's refusal to make habitual felony offender findings and instead imposed a guidelines sentence. The appellate court affirmed, stating:
The State argues that the absence of mandatory findings renders the sentence illegal. ... We disagree. The sentence imposed on defendant is one which is within statutory limits and is therefore a legal sentence. ... There is no basis for vacating the guidelines sentence, which is a legal and permissible one.
Id. (citation omitted); see also State v. Figueroa, 728 So.2d 787 (Fla. 4th DCA 1999) (State could not appeal a final sentencing order imposing a legal sentence).
Although the trial court erred in not conducting a separate hearing or making findings, the sentence imposed was within the lowest permissible prison sentence of 43.8 months and, therefore, was not illegal or an appealable order by the State.
As a result, this appeal must be dismissed.
Dismissed.
MAY and DAMOORGIAN, JJ., concur.
