11-08-2017 06:06 AM - edited 11-08-2017 07:29 AM
(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.
11-08-2017 06:46 AM
Thanks for the reply.
I just want to confirm whether I'm understanding what you've adviced me correctly or not.
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)?
11-08-2017 06:40 AM
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
11-08-2017 10:52 AM
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
11-08-2017 11:39 AM
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!!
11-08-2017 08:41 AM
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.
Need further help from the community? Please ask a new question.