BookmarkSubscribeRSS Feed
Hagay
SAS Employee

בשבוע שעבר ראינו כמה דוגמאות לשימוש ב – proc sgplot ליצירת גרף מסוג סדרה (series). סוג הגרף הזה הוא רק אחד מרבים שניתן לייצר בעזרת sgplot. הנה עוד כמה דוגמאות לסוגי גרפים נוספים.

 

נתחיל עם הגרף המוכר – גרף עמודות:

 

ods graphics/height=800px;
proc sgplot data=sashelp.class;
	vbar age;
run;

 

 

הוא יכול להיות גם אופקי, שימושי במיוחד אם התיאורים של כל עמודה הם ארוכים:

 

proc sgplot data=sashelp.cars;
	hbar make/categoryorder=respdesc;
run;

 

 

סוג גרף שימוש נוסף הוא גרף הפיזור:

 

proc sgplot data=sashelp.class;
	scatter x=weight y=height/group=sex markerattrs=(symbol=CircleFilled size=10px);
run; 

 

 

כמובן מכיוון שמדובר ב – SAS אפשר לשלב קצת סטטיסטיקה בגרף:

 

proc sgplot data=sashelp.class;
	reg x=weight y=height/group=sex markerattrs=(symbol=CircleFilled size=10px) clm clmtransparency=0.1;
run;

 

אפשר גם להציג את משוואת הרגרסיה עצמה על הגרף אם רוצים אבל, לצערי, זה דורש קצת יותר קוד ממה שזה אמור.

 

גרף נוסף, שלא משתמשים בו מספיק לדעתי, הוא ה - box plot שמאפשר לקבל המון מידע במעט מקום. גם הוא זמין בגירסא אופקית ובגירסא האנכית הקלאסית:

 

proc sgplot data=sashelp.cars;
	hbox msrp/category=make;
run; 

 

 

לסוגי גרפים רבים ניתן להוסיף גם קווי ייחוס על כל אחד מהצירים:

 

proc sgplot data=sashelp.class;
	scatter x=weight y=height/group=sex markerattrs=(symbol=CircleFilled size=10px);
	refline 100/ axis=x lineattrs=(thickness=3px);
	refline 65/ axis=y lineattrs=(thickness=3px);
run; 

 

 

חגי

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Discussion stats
  • 0 replies
  • 336 views
  • 1 like
  • 1 in conversation