(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.)
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.
Look at procs freq, tabulate, means, report, and sgplot to get started.
Look at procs freq, tabulate, means, report, and sgplot to get started.
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)?
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 🙂
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.
Just to notify I changed the inserted photo to the replicate made-up one!
Thanks for the advice!
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
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!!
Anytime, glad to help 🙂
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.
OK, I will.
Thanks for the reply.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.