- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
But can I use SGMAP to animate a graph if it does not support the by statement?
How would you change the boundaries?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't know how to control the SGMAP boundaries and not seeing one in the documentation. I suspect you can kludge it - but you likely have to add some fake data with the four corner points of the map is my guess, which is definitely annoying.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The best way to control the boundaries, in this case, is to overlay a CHOROMAP over the OpenStreetMap, without a response variable in the CHOROMAP. statement. Use a WHERE on the MAPDATA so that only the areas showing the flu data are drawn. This should give you consistency in what OSM tiles are used.
Giving credit where credit's due, @GraphGuy used this trick in his blog post about the recent California earthquakes.
Hope this helps!
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes I did see your example. It did not run on my SAS and I had to terminate it. When attempting to use that code with my data, it runs but there is no output file.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output
features.
73
74 %macro mapAnnually(dsn=, start=, end=);
75 %let start=%sysfunc(inputn(&start,date9.));
76 %let end=%sysfunc(inputn(&end,date9.));
77 %let dif=%sysfunc(intck(day,&start,&end));
78 %do i=0 %to &dif;
79 %let date=%sysfunc(intnx(day,&start,&i,b));
80
81
82 proc sgmap
83
84 plotdata=&dsn;
85 where date_processed <= &date.;
86 openstreetmap;
87
88 scatter x=LONGitude y=LATitude/ markerattrs=(size=5
88 ! symbol=circlefilled);
89 run;
90
91
92 %end;
93 %mend mapAnnually;
94
95 ods html close;
96 /*--Create animation--*/
97 options papersize=('11 in', '7 in')
98 printerpath=gif
99 animation=start
100 animduration=0.1
101 animloop=yes
102 noanimoverlay
103 nodate;
104 ods printer
104 ! file='C:/Users/lindsey/documents/gifs/demoMap.gif';
NOTE: Writing ODS PRINTER output to DISK destination
"C:\Users\lindsey\documents\gifs\demoMap.gif", printer "gif".
105
106 ods graphics / width=10in height=6in imagefmt=GIF;
107
108 %mapAnnually(dsn=full_week, start=01Jan2019, end = 07Jan2019);
NOTE: PROCEDURE SGMAP used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
NOTE: PROCEDURE SGMAP used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds
NOTE: PROCEDURE SGMAP used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
NOTE: PROCEDURE SGMAP used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
NOTE: PROCEDURE SGMAP used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
NOTE: PROCEDURE SGMAP used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
NOTE: PROCEDURE SGMAP used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
109
110 options printerpath=gif animation=stop;
111 ods printer close;
NOTE: ODS PRINTER printed no output.
(This sometimes results from failing to place a RUN statement before
the ODS PRINTER CLOSE statement.)
112 ods html;
NOTE: Writing HTML Body file: sashtml6.htm
113
114 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
126
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ods listing gpath = '/folders/myfolders/';
What version of SAS are you using? It works in 9.4M5 and M6 - I tested it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I got it to work! Not sure why it was not working earlier. If my date is entered as "01Jan19:00:00:00" could that be why this method is not working with my data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
%let start=%sysfunc(inputn(&start,date9.));
76 %let end=%sysfunc(inputn(&end,date9.));
77 %let dif=%sysfunc(intck(day,&start,&end));
78 %do i=0 %to &dif;
79 %let date=%sysfunc(intnx(day,&start,&i,b));
I have narrowed it down to this part of the code being what I need to change to work the datetime column I have. I have been trying to play around with it but cannot seem to pinpoint what exactly needs to be altered. This is my first time working with code like thi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
new_var_date = datepart(datetime_variable);
Then the code above should work. Or you can change the increment to DTDAY instead of day. You need to do one of these, not both.
- « Previous
-
- 1
- 2
- Next »