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

(Sorry if I post this to the wrong location)


I just started using SAS Univ. Edition(latest version) and I have several questions.

I'm trying to create a table and corresponding line chart, which I found in the previous research paper of my research field.

(The following is the replicate of the original table and graph by myself. Numbers or names etc are all made-up. What I want to make is this type of table and chart.)


This table and charts are made with SAS (it's what the paragraph above states.), so there should be any way to create this.

However, since I'm not getting used to this yet, I couldn't find any at this stage. 

Could any of you have a solution for this?

Any help will be welcome!

If you have any question regarding this photo, just reply to my post and I'll answer it.

Thanks in advance.


Accepted Solutions
Rhodochrosite | Level 12

Look at procs freq, tabulate, means, report, and sgplot to get started.

View solution in original post

Rhodochrosite | Level 12

Look at procs freq, tabulate, means, report, and sgplot to get started.

Obsidian | Level 7

Thanks for the reply.

I just want to confirm whether I'm understanding what you've adviced me correctly or not.


proc freq-???

proc tabulate-for making a table

proc means-for getting the average

proc report-for printing the data


proc sgplot-for drawing graph connecting average points?(using vline?)


I wonder what proc freq for... could you explain what it is for(and anything if I'm misunderstanding)?


Tourmaline | Level 20

Replicate the data in your photo with made-up values and post it along with a drawing/sketch of what you want you output table and graph to look like. That way, we are able to give you a usable code answer, you can apply the code to your actual problem and you don't have to worry about copyright issues 🙂

Obsidian | Level 7

Thank you for the reply.

OK, I'll make the made-up table and graph from now, and add it to the original post as attachments.

Obsidian | Level 7

Just to notify I changed the inserted photo to the replicate made-up one!

Thanks for the advice!

Tourmaline | Level 20

You are welcome. If your data looks like what you have posted, this might get you started on the graph you want to create


data have;
input Fruits$ Tom Michael Kelly Emi;
Apple 3 1 2 3
Pear 1 3 0 2
Banana 1.5 2 1 2.5

proc sort data=have;
	by Fruits;

proc transpose data=have out=have_long(rename=(_NAME_=Name COL1=eat));
	by Fruits;

proc sgplot data=have_long noautolegend;
	title "Fruits";
	styleattrs datasymbols=(CircleFilled SquareFilled TriangleFilled);
	series x=Name y=eat / group=Fruits markers;
	xaxis display=(nolabel) grid;
	yaxis values=(0 to 3 by 1) grid label="Frequency of Eating";

If you want to further edit the visual aspects of the plot, consult the PROC SGPLOT Documentation


Obsidian | Level 7

Thank you very much for your help!!


I copied the code and paste it into the program area, and it perfectly worked!!

Amazing! I should've waited for your reply before deciding best solution...


it seems there are lots of stuff which I can customize.

I'll have a look at the page and see what I need to do to make it closer to what I imagined it to be.

(like changing ● in the graph to ■ and ◆, changing lines, adding explanatory notes etc)


Thank you again for helping me a lot!!

Super User

First of all, start out by creating a dataset. Creating test data works in the same way that we prefer for posting example data here:

data have;
input name $ fruit $ eating;
Tom Apple 3
Tom Pear 1
Tom Banana 1.5
Michael Apple 1

Expand the step so it creates all your data. Understanding this simple data step is your first learning step.


Next, tinker around with applying the procedures named by the others to your dataset and see what happens.

Obsidian | Level 7

OK, I will.


Thanks for the reply.


Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 4 in conversation