I need to show numeric values on Y axis and X axis with values like Hbase, Hwk20,Hwk38, Ebase, Ewk20,Ewk38. I need to draw solid lines for values Hbase, Hwk20, Hwk38 but show dash lines for Ebase,Ewk20, Ewk38.
I moved to "Graphics Programming"-board !
Then choose your graph and visualize the code for it!
BR, Koen
Not opening DOCX files from any unknown source.
You can insert images into a post using the camera icon above the message window.
Provide data that you want graphed.
Actually your description of different color/line types based on the value of a variable(?) is a GROUP=thatvariablename
option and if you want specific combinations then perhaps look at examples using a DATTRMAP data set to provide attributes for graph elements based on the values of the group variable.
Or use the Series plot options GROUPLC and GROUPLP to point to a variable that you add to your data set to use for the color and the line pattern.
The following link shows creating a data set with variables to plot and additional variable to control line color with the Grouplc option.
I have attached my code along with output i am getting. I would like to dispplay lines as dash lines when my visits on x axis are EBASE, EWK20, EWK38, etc. Also I want to control colors for the grouping variable
data have;
set sashelp.stocks;
keep stock date close;
run;
proc sort data=have;
by date stock;
run;
proc transpose data=have out=want;
by date;
id stock;
var close;
run;
data want;
set want end=last;
group=ifc(date>='01jan1998'd,'Future','Actual');
label group='02'x;
if last then do;text1='IBM';text2='Intel';end;
run;
ods graphics/attrpriority=none;
proc sgplot data=want;
styleattrs datalinepatterns=(solid dash);
series x=date y=IBM/group=group lineattrs=(thickness=2px color=red) name='a' ;
series x=date y=Intel/group=group lineattrs=(thickness=2px color=green);
scatter x=date y=IBM /markerattrs=(size=0) datalabel=text1 datalabelattrs=(color=red size=12) datalabelpos=right;
scatter x=date y=Intel /markerattrs=(size=0) datalabel=text2 datalabelattrs=(color=green size=12) datalabelpos=right;
refline '01jan1998'd/axis=x;
keylegend 'a' /location=inside across=1 position=ne;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: