BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rajdeep
Pyrite | Level 9
ODS ESCAPECHAR="^" ;
ods graphics on / width=10in HEIGHT=10in   imagemap=on; 

/*options orientation=landscape; */
/*options papersize=(10in 10in);*/
/*options pdfpageview=fitwidth;*/
proc sgpanel data=Test_Dataset noautolegend;
format name $na. ;
format MTH fmn_ffym3.;
   panelby name / layout=COLUMNLATTICE onepanel 
                 colheaderpos=bottom rows=20 NOHEADERBORDER nowall novarname spacing=20
                       noborder headerattrs=(size=07) sort=data;
					  
  vbar &mcv_sort. / group=&mcv_sort. response=Percent stat=percent
                      nostatlabel 
                      barwidth=0.6 tip=(Percent);
                    

  colaxis VALUESROTATE=VERTICAL valueattrs=(size=10) display=(nolabel noline) ;
  rowaxis grid label="Test"  ;

  Footnote ' ';   
  run;
  title;
  
proc sgpanel data=Test_Dataset noautolegend nocycleattrs;
format name $n.;

format Disbursements DOLLAR21.2;
format MTH fmn_ffym.;
  panelby name / layout=COLUMNLATTICE onepanel 
                 colheaderpos=bottom nowall novarname spacing=11
                       noborder noheaderborder headerattrs=(size=8) sort=data;

  vbar &mcv_sort. / group=&mcv_sort. response=Disbursements nostatlabel 
                      barwidth=0.6  tip=(Disbursements);
                    
  colaxis &MCV_VR. valueattrs=(size=6) display=(nolabel noticks);
  rowaxis  grid LABEL="Disbursements"  ;

  run;

Hi Team,

 

I have written the below code and the Bargraph is also coming with the below code, but if I am clicking on the refresh icon in the Internet Explorer then the Bars size are changing in the graph on every refresh. I don't understand why it's happening like this though the dataset and the values are same no new data is flowing.

 

Please help me what I am missing or it's a defect in SGpanel in SAS, please let me know if anyone have any idea.

1 ACCEPTED SOLUTION

Accepted Solutions
rajdeep
Pyrite | Level 9

Thanks Rick for your reply. I think the Graph was behaving random because of the Data. I had checked the same code over Enterprise Guide and I found out that the order was changing for X axis and Y axis columns.

 

So I tried to fix  the order and now if we clicking on the refresh icon of the Browser, the plot is fixed and it's not changing.

 

Thanks a lot for sharing the workarounds. Cheers..

View solution in original post

6 REPLIES 6
Rick_SAS
SAS Super FREQ

1. Is this program running in the same browser that you are refreshing, or are you outputting the graph to the HTML destination and only refreshing the output?

 

2. How are you running SAS?

A. SAS University Edition 

B. SAS On-Demand for Academics

C. SAS Studio connecting to a licensed version of SAS

D. Enterprise Guide

E. SAS Windowing Environment

F. Other (please specify)

 

3. You posted two calls to SGPANEL. Do both outputs show bar sizes that change? If you run only one PROC SGPANEL, does the problem still occur?

rajdeep
Pyrite | Level 9

Hey Rick, Thanks for the reply.

 

I am running the program inside a Stored Process, so while viewing the output over the browser, the Bars are not stable, so it's changing in every page refresh.

 

Infact I have enabled the PDF download button inside the program in order to save the output in PDF format, but surprise thing is after PDF download sometimes the graph is coming or sometimes the bars are not coming like a blank container.

 

For an Example, Suppose I have 3 values for the Year 2017 2018 and 2019 in x_axis and I have Disbursement percentage in Y-axis, so by default for 2017 -> 50%, 2018->60% and 2019-> 70% suppose to come, so it's coming as per the first load or run, but If I refresh the graph or refresh the browser then the size of the bars are changing randomly, so in the other way the percentage is changing. Why it's happening like this I am not getting, Dataset is same and static, there is no such kind of macro is been used for the dataset name.

 

Please let me know if there is any disconnect. Thanks in advance

Rick_SAS
SAS Super FREQ

Although I do not fully understand your program, it sounds like you are using a macro to generate the same image many times and then using a browser refresh to view the changing image. If so, you might want to switch to BY-group animation. Explanations and examples at

 

https://blogs.sas.com/content/iml/2016/08/22/animation-by-statement-proc-sgplot.html

https://blogs.sas.com/content/graphicallyspeaking/2013/05/23/animation-using-sgplot/

https://communities.sas.com/t5/SAS-Communities-Library/How-to-Create-an-Animated-BarChart-using-SGPl...

 

rajdeep
Pyrite | Level 9

HI Rick,

 

No, I am not changing the image repeatedly neither we want the view should be changed repeatedly on page refresh.

 

1.Inside a stored process the complete program is written.

2.Running the same stored process with the stored process server link (http://stp_server:7980/SASStoredProcess/do) over Internet Explorer.

3.We don't want to refresh the graph to get another image, but ideally the bar graph or any plot graph should not change if at all we are clicking on the refresh browser icon.

4. We are running the same stp on Windows 7 Env.

5. In simple words, the requirement is not to change the view or plot of a graph on every refresh, but if at all you had clicked mistakenly the refresh icon of the browser then the plot should not change ideally, no matter how many times you refresh.

6. Atleast, if you want to save the same Graph plot in a pdf format, then it should download the same what you see in the browser, but currently after opening the PDF file the plot is scattered and random. It's not the same currently, it's a mismatch between PDF file and browser plot.

 

Hope I am clear this time. Please let me know if any disconnect.

Rick_SAS
SAS Super FREQ

OK, my guess is that your program is overwriting graphic image files. See the SAS/STAT doc for a discussion of how image files are named.

 

If your program specifies the IMAGENAME= option, uses an ODS GRAPHICS / RESET statement, or uses an ODS <destination> FILE= statement, then your program will overwrite previous image files on disk. When you hit refresh, the browser re-reads the image file in its current form. The original image is lost.

 

For example, if you run the following program and refresh the HTML destination, you will see that the first image does not show the first (red) scatter plot, but shows the third (green) scatter plot.

 

ods graphics / reset;           /* reset index counter */

title "1. RED SGPlot.png";
proc sgplot data=sashelp.class; /* creates SGPlot.PNG */
scatter x=Height y=Weight / markerattrs=(color=RED);
run;

title "2. BLUE SGPlot1.png";
proc sgplot data=sashelp.class; /* creates SGPlot1.PNG */
scatter x=Height y=Weight / markerattrs=(color=BLUE);
run;

ods graphics / reset;  /* reset the index counter */

title "3. New GREEN SGPlot.png";
proc sgplot data=sashelp.class; /* creates SGPlot.PNG */
scatter x=Height y=Weight / markerattrs=(color=GREEN);
run;

/* Notice that first image is replaced by the third image.
   If necessary, hit REFRESH is HTML destination.  */
rajdeep
Pyrite | Level 9

Thanks Rick for your reply. I think the Graph was behaving random because of the Data. I had checked the same code over Enterprise Guide and I found out that the order was changing for X axis and Y axis columns.

 

So I tried to fix  the order and now if we clicking on the refresh icon of the Browser, the plot is fixed and it's not changing.

 

Thanks a lot for sharing the workarounds. Cheers..

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
  • 6 replies
  • 1167 views
  • 0 likes
  • 2 in conversation