BookmarkSubscribeRSS Feed
dsam
Fluorite | Level 6

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.

7 REPLIES 7
dsam
Fluorite | Level 6
I checked all the graphs , it doesn't have what I am looking for
ballardw
Super User

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.

https://support.sas.com/kb/52/964.html

dsam
Fluorite | Level 6
Yes to this part of code but main issue is I need to show present study data with solid line and future study data with dashline continuous
dsam
Fluorite | Level 6

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 

Ksharp
Super User
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;

Ksharp_0-1699507886728.png

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 7 replies
  • 1789 views
  • 1 like
  • 4 in conversation