Here is what I'm using to create the chart it's in the result window /* Define the line chart template */ proc template; define statgraph linechart; begingraph; /* Create a dynamic variable for the year */ dynamic year; /* Define the display attributes for each stock. Since DISCRETEATTRMAP does not support the MARKERATTRS= suboption SIZE=, the marker size is set separately. */ discreteattrmap name="company" / ignorecase=true ; value "shoe" / markerattrs=(color=blue symbol=trianglefilled) lineattrs=(color=lightblue pattern=solid); value "skirt" / markerattrs=(color=red symbol=circlefilled) lineattrs=(color=verylightred pattern=solid); value "pants" / markerattrs=(color=orange symbol=squarefilled) lineattrs=(color=verylightorange pattern=solid); enddiscreteattrmap ; /* Associate the attribute map with input data column Stock and assign the name STOCKATTRS to the named association */ discreteattrvar attrvar=companyattrs var=company attrmap="company" ; entrytitle "company Index Performance in " year; layout overlay / /* Add a grid */ xaxisopts=(griddisplay=on gridattrs=(pattern=dot color=lightgray)) yaxisopts=(griddisplay=on gridattrs=(pattern=dot color=lightgray)); linechart category=date response=close / name="linechart" /* Compute the mean */ stat=mean /* Group by stock using the specified attributes */ group=companyattrs /* Display the lines and markers */ display=(line markers) /* Set the marker size */ markerattrs=(size=6) /* Show vertex labels and specify their attributes */ vertexlabel=true vertexlabelattrs=(size=7pt) vertexlabelformat=dollar4.0; /* Add a legend */ discretelegend "linechart"; endlayout; endgraph; end; run; /* Create a macro that generates a line chart for a specific year */ %macro genchart(year=); /* Generate the chart */ proc sgrender data=companys template=linechart; where year(date)=&year; /* Get the data for the specified year */ format date monname3.; /* Format the date as 3-letter month */ dynamic year="&year;"; /* Pass the year to the template */ run; %mend genchart; /* Generate a chart for 2001 */ %genchart(year=2020);
... View more