BookmarkSubscribeRSS Feed
aminkarimid
Lapis Lazuli | Level 10

Hello everybody,

 

Here is my code:

proc template;              /* basic heat map with continuous color ramp */
	define statgraph heatmap;
	dynamic _TRD_EVENT_tm _TRD_EVENT_dt _price _T;        /* dynamic variables */
		begingraph;
			entrytitle _T;             /* specify title at run time (optional) */  
			layout overlay;
				heatmapparm x=_TRD_EVENT_tm y=_TRD_EVENT_dt colorresponse=_price /  /* specify variables at run time */
				name="heatmap" primary=true
				xbinaxis=false ybinaxis=false;  /* tick marks based on range of X and Y */
				continuouslegend "heatmap";
			endlayout;
		endgraph;
	end;
run;
proc sgrender data=sampledata05 template=Heatmap; 
   dynamic _TRD_EVENT_tm='Time' _TRD_EVENT_dt='Date' _Price='Price' _T="Basic Heat Map";
run;

 

And, here is the log file:

WARNING: The heatmapparm statement named 'heatmap' will not be drawn because one or more of the
         required arguments were not supplied.
WARNING: CONTINUOUSLEGEND statement references a plot named (heatmap) that is not assigned to any
         plot. The name will be ignored.

All variables are numeric.

How can I fix that?

 

Thanks in advance.

 

9 REPLIES 9
art297
Opal | Level 21

I am NOT an expert with either PROC TEMPLATE or PROC SGRENDER, but tried your code anyhow.

 

It wouldn't run unless I removed all of the comments. You didn't provide your data so I couldn't complete the test (i.e., run PROC SGRENDER), but the PROC TEMPLATE ran without error. I ran:

proc template;
	define statgraph heatmap;
	dynamic _TRD_EVENT_tm _TRD_EVENT_dt _price _T;
		begingraph;
			entrytitle _T;             
			layout overlay;
				heatmapparm x=_TRD_EVENT_tm y=_TRD_EVENT_dt colorresponse=_price /  
				xbinaxis=false ybinaxis=false; 
				continuouslegend "heatmap";
			endlayout;
		endgraph;
	end;
run;

Art, CEO, AnalystFinder.com

 

aminkarimid
Lapis Lazuli | Level 10

Respected #art297, I appreciate your support.

However, warnings are still alive!

I attach a sample of my dataset.

Thanks in advance.

Rick_SAS
SAS Super FREQ

It looks like you copied the code from my blog post "Creating a basic heat map in SAS". The post includes sample data and output.

 

I assume the problem is the data, not the template. In the data that you attached, the TRD_EVENT_TM has the constant value 1/01/1900 and the variable TRD_EVENT_DT appears to have only two dates. You also have multiple repeated values. The HEATMAPPARM statement is expecting a regular grid of values with a unique response value for each cell.

aminkarimid
Lapis Lazuli | Level 10

Yes @Rick_SAShank you for everything you’ve done.

I work with big data and the sample, which I attached, has a time and date variables that are not constant.

 

I use @art297's rewritten codes, although there is an error:

 

ERROR: Unable to restore 'Heatmapparm' from template store!

Thanks in advance.

art297
Opal | Level 21

I agree with @Rick_SAS .. your variables don't match the one's you specified. Also, your time variable is a datetime variable.

 

The following worked for me:

proc import datafile='/folders/myfolders/test.xls'
    dbms=xls out=sampledata05 replace;
  sheet=test;
run;

data sampledata05;
  set sampledata05;
  format time time5.;
  time=timepart(trd_event_tm);
run;

proc template;
	define statgraph heatmap;
	dynamic _TRD_EVENT_tm _TRD_EVENT_dt _price _T;
		begingraph;
			entrytitle _T;             
			layout overlay;
				heatmapparm x=_TRD_EVENT_tm y=_TRD_EVENT_dt COLORRESPONSE=_price/
				name='heatmapparm' xbinaxis=false ybinaxis=false; 
				continuouslegend "heatmapparm" / location=outside valign=bottom;
			endlayout;
		endgraph;
	end;
run;
proc sgrender data=sampledata05 template=Heatmapparm; 
   dynamic _TRD_EVENT_tm='time' _TRD_EVENT_dt='TRD_EVENT_dt' _Price='Price' _T="Basic Heat Map";
run;

Art, CEO, AnalystFinder.com

aminkarimid
Lapis Lazuli | Level 10
Here is an error:
ERROR: Unable to restore 'Heatmapparm' from template store!
art297
Opal | Level 21

There was an error in the datastep I used, but the code produced a map (without any errors). The correct datastep should have been:

data sampledata05;
  set sampledata05;
  format time time5.;
  time=timepart(trd_event_tm);
run;

I corrected it in the post as well. However, it doesn't answer the question of why you are getting an error, as mine ran correctly whether it was corrected or not.

 

I'll have to leave it to someone like @Rick_SAS who is more familiar with the technique than I am. Sorry I couldn't be of more help.

 

Art, CEO, AnalystFinder.com

 

Rick_SAS
SAS Super FREQ

That's the error message you get if you can't overwrite a template. I encounter this sometimes when I am running two copies of SAS: The first copy locks the template files and the second can't overwrite.

 

The easiest thing to do it to exit all copies of SAS and then restart one copy.

aminkarimid
Lapis Lazuli | Level 10
Would you tell me how can I do that, please?
Thanks in advance.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 9 replies
  • 1628 views
  • 0 likes
  • 3 in conversation