BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HitmonTran
Pyrite | Level 9

Hi,

 

New to SAS.  I need an idea on where to get started on creating a line graph based on #of subjects (y-axis) & month (x-axis). Shoud I use proc sgplot? Sorry, no example data here. Thanks!

 

HitmonTran_0-1608152798311.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

An example:

 

proc sort data=sashelp.class out=sortedClass; by sex height;
run;

proc sgplot data=sortedClass noautolegend;
where sex="M";
reg x=height y=weight / lineattrs=(pattern=shortdash);
series x=height y=weight;
yaxis grid;
run;

PGStats_0-1608153835034.png

 

PG

View solution in original post

3 REPLIES 3
Reeza
Super User
Find the plot you like and then look at the example code. SGPLOT is the right place to start.
https://support.sas.com/sassamples/graphgallery/PROC_SGPLOT.html
PGStats
Opal | Level 21

An example:

 

proc sort data=sashelp.class out=sortedClass; by sex height;
run;

proc sgplot data=sortedClass noautolegend;
where sex="M";
reg x=height y=weight / lineattrs=(pattern=shortdash);
series x=height y=weight;
yaxis grid;
run;

PGStats_0-1608153835034.png

 

PG
ballardw
Super User

One large hint if you have not worked with SAS and dates much: make sure that your "month" is actually a SAS date, meaning a numeric value with a SAS format applied that displays the date as desired.

Other forms of "date-like values" will either not sort properly (generally) or often have tickmarks way out of relation to as needed.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 905 views
  • 4 likes
  • 4 in conversation