
735 A.2d 709 (1999)
COMMONWEALTH of Pennsylvania, Appellee,
v.
Russell GUTH, Appellant.
Superior Court of Pennsylvania.
Argued February 9, 1999.
Filed June 24, 1999.
*710 Jeanette D. Dickerson, Public Defender, Hatboro, for appellant.
Patricia E. Coonahan, Asst. Dist. Atty., Norristown, for Com., appellee.
Before STEVENS, LALLY-GREEN and OLSZEWSKI, JJ.
STEVENS, J.:
¶ 1 This is an appeal from the judgment of sentence entered in the Court of Common Pleas of Montgomery County following Appellant's guilty plea to the charge of criminal attempt at burglary. Herein, Appellant's sole contention is that the sentencing court abused its discretion in sentencing Appellant outside of the Sentencing Code's aggravated range. We affirm.
¶ 2 The relevant facts and procedural history are as follows: On October 11, 1997, Appellant left the Norristown State Hospital and proceeded to a residence located on Forest Avenue in West Norristown Township. After attempting to break into the residence, Appellant was arrested and charged with various offenses in connection with the incident.[1] On March 19, 1998, Appellant entered an open plea of guilty but mentally ill to the charge of attempted burglary,[2] and, on May 14, 1998, Appellant was sentenced to four to twenty years imprisonment. Following the denial of Appellant's motion for reconsideration of sentence, this appeal was filed.
¶ 3 On appeal, Appellant contends that the sentencing court abused its discretion in sentencing Appellant above the aggravated range outlined in the sentencing guideline and that such a departure resulted in an unreasonable sentence.[3] Because Appellant's issue challenges the discretionary aspects of sentencing, we must first decide whether to accept Appellant's *711 appeal.[4] 42 Pa.C.S.A. § 9781. "Appellant's brief contains the requisite statement of reasons relied upon in support of appeal as required by Pa.R.A.P. 2119(f).... Therefore, we must determine if Appellant ha[s] raised a substantial question that the sentence imposed is not appropriate under the Sentencing Code." Commonwealth v. Nixon, 718 A.2d 311, 315 (Pa.Super.1998) (citation omitted). "Whether a claim constitutes a substantial question must be evaluated on a case by case basis." Commonwealth v. Ellis, 700 A.2d 948, 958 (Pa.Super.1997) (citation omitted).
¶ 4 The sentencing court sentenced Appellant above the aggravated range outlined in the Sentencing Code. As such, a substantial question is raised only if the sentence is unreasonable. Commonwealth v. Smith, 543 Pa. 566, 673 A.2d 893 (1996); Nixon, supra. In his Pa.R.A.P. 2119(f) statement, Appellant avers that we have jurisdiction to hear this appeal since "[t]he sentence imposed is outside the guidelines and unreasonable." Appellant's Brief at 10. This Court has held "that an appeal from the discretionary aspects of a sentence will be allowed where a defendant alleges that his sentence is outside the guidelines and unreasonable." Commonwealth v. Gibson, 716 A.2d 1275, 1276 (Pa.Super.1998) (citation omitted). Accordingly, we find that Appellant has raised a substantial question as to the appropriateness of his sentence and we shall consider the merits of this issue on appeal. Id.
¶ 5 "The standard of review in sentencing is well settled. Sentencing is a matter vested in the sound discretion of the sentencing judge, and a sentence will not be disturbed on appeal absent a manifest abuse of discretion." Commonwealth v. Burkholder, 719 A.2d 346, 350 (Pa.Super.1998) (citation omitted).
In sentencing outside the guidelines, the sentencing judge must follow the mandate of § 9721(b) of the Sentencing Code, which provides in pertinent part:
In every case where the court imposes a sentence outside the sentencing guidelines adopted by the Pennsylvania Commission on Sentencing . . . the court shall provide a contemporaneous written statement of the reasons or reasons for the deviation from the guidelines. Failure to comply shall be grounds for vacating the sentence and re-sentencing the defendant.
Gibson, 716 A.2d at 1276-77 (citations omitted).
[Moreover,] [i]n exercising its discretion, the trial court must consider the character of the defendant and the particular circumstances of the offense in light of the legislative guidelines for sentencing, and the court must impose a sentence that is consistent with the protection of the public, the gravity of the offense, and the rehabilitative needs of the defendant.
Burkholder, 719 A.2d at 350 (citations omitted).
¶ 6 In this case, we find that the sentencing court made a sufficient contemporaneous statement when it imposed Appellant's sentence. For example, the sentencing court considered the gravity of the offense, noting that Appellant was apprehended while attempting to enter a home so that he could have sex with a child. N.T. 5/14/98 at 26, 28. The sentencing *712 court also considered the need to protect the public from Appellant, indicating that Appellant's attitude demonstrated that he would attempt to molest a child again if given the opportunity.[5] N.T. 5/14/98 at 25. Moreover, the sentencing court indicated that Appellant had not responded well to medications, and that he was uncooperative with the Norristown State Hospital's personnel.[6] N.T. 5/14/98 at 26. Thus, the sentencing court concluded that Appellant would be rehabilitated only if he were sentenced to a period of incarceration. In addition, it is clear that the sentencing court reviewed Appellant's pre-sentence investigation report. Where a pre-sentence investigation report exists, we presume that the sentencing judge was aware of the relevant information regarding the defendant's character and weighed those considerations along with mitigating statutory factors. Commonwealth v. Devers, 519 Pa. 88, 546 A.2d 12 (1988). Also, a review of the entire sentencing transcript indicates that the sentencing court had a recognition of the applicable sentencing range and the deviation of the sentence from that range. See Commonwealth v. Rodda, 723 A.2d 212 (Pa.Super.1999).
¶ 7 Finally, we note that Appellant suggests that the sentencing court should not have imposed a term of incarceration since the victims did not want Appellant to be imprisoned and the court-ordered psychiatrist recommended that Appellant continue his treatment at the Norristown State Hospital. From the record, it is clear that the sentencing court considered the victims' desires and the psychiatrist's recommendation; however, the court concluded that the evidence as a whole required a period of incarceration. We find no abuse of discretion in this regard.
¶ 8 For all of the foregoing reasons, we affirm.
¶ 9 Affirm.
NOTES
[1]  Upon investigation, it was learned that Appellant was attempting to enter the residence because he believed that a child lived in the residence and he wanted to have sex with the child.
[2]  Prior to the plea, Appellant was found competent to participate in the legal proceedings and capable of forming the necessary criminal intent.
[3]  Upon entry of a guilty plea, a defendant generally waives all defects and defenses except those concerning the validity of the plea, the jurisdiction of the trial court, and the legality of the sentence imposed. Commonwealth v. Reichle, 404 Pa.Super. 1, 589 A.2d 1140 (1991). However, when the plea agreement is open, containing no bargain for a specific or stated term of sentence, the defendant will not be precluded from appealing the discretionary aspects of his sentence. Commonwealth v. Dalberto, 436 Pa.Super. 391, 648 A.2d 16 (1994).
[4]  We note that Appellant's sentence was within the statutory limits. 42 Pa.C.S.A. § 9727(a) provides that "[a] defendant found guilty but mentally ill or whose plea of guilty but mentally ill is accepted under the provisions of 18 Pa.C.S. § 314 (relating to guilty but mentally ill) may have any sentence imposed on him which may lawfully be imposed on any defendant convicted of the same offense." 18 Pa.C.S.A. § 3502(c) provides that burglary is a felony of the first degree, and 18 Pa.C.S.A. § 1103 provides that the statutory maximum for a felony of the first degree is twenty years imprisonment. Thus, Appellant's sentence of four to twenty years imprisonment was within the statutory limit.
[5]  We note that Appellant testified during the sentencing hearing, thereby giving the sentencing court an opportunity to observe Appellant's attitude thoroughly.
[6]  During the sentencing hearing, Appellant admitted that he was resistant to the mental treatment he was receiving at the hospital, that he did not like the hospital's employees, and that he believed his medications were not working. N.T. 5/14/98 at 13-15.
