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

(Sorry if I post this to the wrong location)

Hello,

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.)

example.jpg

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.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Ammonite | Level 13

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

View solution in original post

10 REPLIES 10
WarrenKuhfeld
Ammonite | Level 13

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

Turtle
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)?

 

PeterClemmensen
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 🙂

Turtle
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.

Turtle
Obsidian | Level 7

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

Thanks for the advice!

PeterClemmensen
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;
datalines;
Apple 3 1 2 3
Pear 1 3 0 2
Banana 1.5 2 1 2.5
;

proc sort data=have;
	by Fruits;
run;

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

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";
run;
title;

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

 

Turtle
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!!

Kurt_Bremser
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;
cards;
Tom Apple 3
Tom Pear 1
Tom Banana 1.5
Michael Apple 1
;
run;

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.

Turtle
Obsidian | Level 7

OK, I will.

 

Thanks for the reply.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 10 replies
  • 2726 views
  • 4 likes
  • 4 in conversation