I have found an issue when replaying the output from PROC SGRENDER with a user defined template with a discrete attribute map, the replay called by PROC DOCUMENT does not preserve the attributes contained in the dattrmap. Is there a solution to this or is this a bug?
Here is an example of the behavior:
/* Create the attribute map data set */
data attrmap;
length ID VALUE MARKERCOLOR MARKERSYMBOL LINECOLOR LINEPATTERN $15;
input ID$ VALUE$ MARKERCOLOR$ MARKERSYMBOL$ LINECOLOR$ LINEPATTERN$;
datalines;
stockname IBM red circlefilled red solid
stockname Intel green trianglefilled green shortdash
stockname Microsoft blue squarefilled blue dot
;
run;
/* Create a stock data set for the year 2002 */
proc sort data=sashelp.stocks out=stocks;
by stock date;
where date between '01JAN02'd and '30DEC02'd;
run;
/* Create a template for IBM, Microsoft, and Intel stocks */
proc template;
define statgraph stockchart;
begingraph;
entrytitle "Trends for IBM, Intel, and Microsoft";
discreteattrvar attrvar=stockmarkers var=stock
attrmap="stockname";
layout overlay;
seriesplot x=date y=close /
group=stockmarkers
display=(markers)
name="trends";
discretelegend "trends" / title="Stock Trends";
endlayout;
endgraph;
end;
run;
ods document name=work.test;
/* Plot the stock trends */
proc sgrender data=stocks dattrmap=attrmap template=stockchart;
run;
ods document close;
/* replay PROC SGRENDER output */
proc document name=work.test;
replay;
run;
quit;
The output of the above code is below. Clearly, the output from the PROC DOCUMENT replay is missing the attributes contained in work.attrmap . Any help on this would be appreciated.
Yes, this is an issue that needs to be addressed, I would recommend calling Technical Supporting and entering a ticket. In the meantime, there are two workarounds to consider:
1. If you embed the attribute map in the GTL instead of using a data set, you will not have this replay issue.
2. The other SG procedures do not have this replay issue with attribute map data sets. If you can recreate your graph using the other procedures, the data-driven attribute map will work for you.
Hope this helps!
Dan
Yes, this is an issue that needs to be addressed, I would recommend calling Technical Supporting and entering a ticket. In the meantime, there are two workarounds to consider:
1. If you embed the attribute map in the GTL instead of using a data set, you will not have this replay issue.
2. The other SG procedures do not have this replay issue with attribute map data sets. If you can recreate your graph using the other procedures, the data-driven attribute map will work for you.
Hope this helps!
Dan
Hi Dan,
I was hoping to avoid embedding the attribute within the GTL itself as the rest of my workflow references the attribute maps. Anyways, thank you for your insight.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.