Hi all,
I started to learn SAS university edition.
When I import .csv file and convert to SAS table, the result will be stored in WORK library. When I close the session and open next time I could not find the table in WORK library. How to do?
I am trying to plot Sg plot. I would like to specify major and minor axis grid . I would like to show minor axis and major axis with more division. How do I achive ? How do I edit graph like I need to draw a line inside the graph write something inside the graph etc after I get regression line
proc sgplot data=work.CAR_DATA;
title 'time vs speed';
scatter x=time y=speed;
Thank you for your support.
Regards
Govind
Hi,
Question 1: Work is a temporary library pointing to the temporary SAS area, when SAS is closed work is removed. Set a libname to a physical network path and put data you want to store there.
Question 2: To learn about SGPLOT, or Graph Template Language, rather than me give a long winded example, pop over to this blog. Examples of all types of graphs, layouts etc.
Use the AXIS statements to control grids and tick marks. The GRID option puts grid lines at each tick location. The VALUES= option enables you to specify the location of ticks, like this:
proc sgplot data=sashelp.cars;
scatter x=weight y=mpg_city;
xaxis grid values=(2000 to 7000 by 1000);
yaxis grid values=(10 to 60 by 5);
run;
The easiest way to edit a graph and add custom lables, arrows, text boxes, etc, is to use the Graphics Editor. An example and discussion is available in the article "Change a plot title by using the ODS Graphics Editor."
The GRID and VALUES= options enable you to control the lies and ticks. You can often use the DATALABELS= option on the SCATTER statement to label individual observations.
There is also the TEXT statement and the VECTOR statement, which enables you to draw text and arrows at arbitrary locations.
You say, "I need to draw a line inside the graph write something inside the graph etc after I get regression line." Please clarify. Specify what you want to do, perhaps by referring to the graph that I created. For example, I can add a line to a plot by using the LINEPARM statement, and information about the line by using the INSET statements:
proc sgplot data=sashelp.cars;
scatter x=weight y=mpg_city;
lineparm x=0 y=38 slope=-0.005;
inset "Intercept = 38" "Slope = -0.005" /
border title="Parameter Estimates" position=topright;
xaxis grid values=(2000 to 7000 by 1000);
yaxis grid values=(10 to 60 by 5);
run;
ODS Graphics Editor is really meant for use for editing of graphs from stat procedures, where you do not have access to the code that made the graph. When you are using SGPLOT, you can easily change the code yourself, which is better than using Editor.
This is true, except for the free form annotation. In your case using University Edition, you can add the annotation using the SGANNOTATE feature. See SGF 2016 paper. Or, you can use any image editor like Microsoft Publisher to add hard coded annotations after the fact.
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 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.
Ready to level-up your skills? Choose your own adventure.