BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sjb1
Fluorite | Level 6

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.

 

 

PROC SGRENDER outputPROC SGRENDER outputPROC DOCUMENT Replay outputPROC DOCUMENT Replay output

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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

 

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

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

 

sjb1
Fluorite | Level 6

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.

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 855 views
  • 0 likes
  • 2 in conversation