Data visualization with SAS programming

Stored Process Macro_ Generating Graph

Reply
Contributor
Posts: 21

Stored Process Macro_ Generating Graph

Hi Team,

 

I have developed the sas code for generating the Graph for the dynamic data. I have created the stored process for the same. But in the Stored process data is coming but SAS GRAPH is not populating agaainst to the data which I am fetching from the dataset.

 

Please help me to rsolve this issue ASAP.

 

Here is the code:

 

data ds2;
set GRAPH;
n=_n_;
rename newdate=year;
run;

data _null_;
set ds2 end=eof;
if eof then call symput('skip',left(n));

run;

data ds2;
set ds2;
resp=Provider_Review_Opened; mid='Provider_Review_Opened'; output;
resp=Consumer_Review_Closed; mid='Consumer_Review_Closed'; output;
run;

proc sort;
by year mid;
run;
data ds2;
set ds2;
array change _NUMERIC_;
do over change;
if change=. then change=0;
end;
run;

data attrmap;
input id $ value $27. @30 fillcolor $10.;
datalines;
Type Consumer Reviews Closed #ffff00
Type Provider Reviews Opened #0000ff
;


goptions gsfname=_webout gsfmode=replace;
goptions device=png;



proc sgplot data=ds2 dattrmap=attrmap;
vbar year / group=mid response=resp groupdisplay=cluster
dataskin=gloss attrid=flavor;
xaxis display=(nolabel noticks);
yaxis label='Number of Cases Opened/Closed';
keylegend / title='Consumer/Provider Reviews';
run;

 

Contributor
Posts: 21

Re: Stored Process Macro_ Generating Graph

Hi guys Please help me on this...
SAS Super FREQ
Posts: 302

Re: Stored Process Macro_ Generating Graph

Try changing your code from this:

 

goptions gsfname=_webout gsfmode=replace;
goptions device=png;

proc sgplot data=ds2 dattrmap=attrmap;
  vbar year / group=mid response=resp 
              groupdisplay=cluster
              dataskin=gloss attrid=flavor;
  xaxis display=(nolabel noticks);
  yaxis label='Number of Cases Opened/Closed';
  keylegend / title='Consumer/Provider Reviews';
run;

 

To this:

 

%STPBEGIN;

ods graphics on / imagefmt=png;

proc sgplot data=ds2 dattrmap=attrmap;
  vbar year / group=mid response=resp 
              groupdisplay=cluster
              dataskin=gloss attrid=flavor;
  xaxis display=(nolabel noticks);
  yaxis label='Number of Cases Opened/Closed';
  keylegend / title='Consumer/Provider Reviews';
run;

%STPEND;

 

Vince DelGobbo

SAS R&D

Contributor
Posts: 21

Re: Stored Process Macro_ Generating Graph

Hi Vince,

 

Thanks for the quick reply.

 

I have tried with the given code but still no lcuk to get the graph.In this report I should get the data Layout and also garph also.I am attaching the code andoutput required.Please help me to get the answer soon.

 

 

 

 

Thanks,

Harish

 

 

 

SAS Super FREQ
Posts: 302

Re: Stored Process Macro_ Generating Graph

Do you get the PROC TABLUATE output?  Are there any warning, error, or other messages in the SAS log near the PROC SGPLOT code?

 

To simplify matters, replace your PROC SGPLOT code with this to see if you get the chart:

 

proc sgplot data=sashelp.class;
  vbar age;
run; quit;

 

You also need to attach the SAS log.

 

Vince DelGobbo

SAS R&D

 

Contributor
Posts: 21

Re: Stored Process Macro_ Generating Graph

Hi Vince,

 

Yes I am getting the output for the proc tabulate and I am getting below error for the sgplot and please help me correct the code for the stored process.

 

 

600 ods graphics on / imagefmt=png;
601 proc sgplot data=ds2 dattrmap=attrmap;
602 vbar year / group=mid response=resp
603 groupdisplay=cluster
604 dataskin=gloss attrid=flavor;
605 xaxis display=(nolabel noticks);
606 yaxis label='Number of Cases Opened/Closed';
607 keylegend / title='Consumer/Provider Reviews';
608 run;

WARNING: Invalid attrid "FLAVOR" specified. The attrid will be ignored.
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 2.43 seconds
user cpu time 0.03 seconds
system cpu time 0.04 seconds
memory 2923.92k
OS Memory 29880.00k
Timestamp 07/12/2017 05:25:10 AM
Step Count 6469 Switch Count 34
Page Faults 0
Page Reclaims 412
Page Swaps 0
Voluntary Context Switches 118
Involuntary Context Switches 5
Block Input Operations 0
Block Output Operations 280

ERROR: Unable to load the Java Virtual Machine. Please see the installation instructions or system administrator.
ERROR: Unable to load the Java Virtual Machine. Please see the installation instructions or system administrator.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 24 observations read from the data set WORK.DS2.
NOTE: There were 2 observations read from the data set WORK.ATTRMAP.

 

 

Thanks,

Harish

Contributor
Posts: 21

Re: Stored Process Macro_ Generating Graph

Hi Vince,

 

To be Precise on what i have required is, I need the putput of the graph in the attached. By using only GCHART and I am attaching the below code for your refernece.

 

PROC SQL;

CREATE TABLE Consumer_NEW AS 

SELECT DISTINCT A.*,COUNT(Consumer_Closed) AS Consumer_Review_Closed

FROM Consumer A

group by newdate;

quit;

 

 

PROC SQL;

CREATE TABLE OPENED1_NEW_repo AS 

SELECT DISTINCT A.*,COUNT(CASE_RK) AS Provider_Review_Opened

FROM OPENED1_NEW_1 A

group by newdate;

quit;

 

 

PROC SQL;

CREATE TABLE GRAPH AS 

SELECT distinct (A.newdate),A.Consumer_Review_Closed,B.Provider_Review_Opened FROM Consumer_NEW A

INNER JOIN OPENED1_NEW_repo B

ON A.newdate=B.newdate;

quit;

 

 data ds2;

    set GRAPH;                                                                                                                             

   n=_n_; 

rename newdate=year; 

run;                                                                                                                                     

                                                                                                                                        

data _null_;                                                                                                                             

   set ds2 end=eof;                                                                                                                     

   if eof then call symput('skip',left(n));  

 

run;                                                                                                                                    

                                                                                                                                        

data ds2;                                                                                                                                

   set ds2;                                                                                                                             

   resp=Provider_Review_Opened; mid='Provider_Review_Opened'; output;                                                                                                          

   resp=Consumer_Review_Closed; mid='Consumer_Review_Closed'; output;                                                                                                         

run;                                                                                                                                    

                                                                                                                                         

proc sort;                                                                                                                              

   by year mid;                                                                                                                          

run;

data ds2;

   set ds2;

   array change _NUMERIC_;

            do over change;

            if change=. then change=0;

            end;

   run;

 

I need to get the graph of this by using only GCHART.please reply at the earliest.

 

Thanks,

harish

SAS Super FREQ
Posts: 302

Re: Stored Process Macro_ Generating Graph

The graphic isn't created because of this error:

 

ERROR: Unable to load the Java Virtual Machine. Please see the installation instructions or system administrator.

 

Open a track with our Technical Support Department and then they will help you to correct the problem:

 

http://support.sas.com/ctx/supportform/createForm

 

A simple stored process with only this code should reproduce the problem:

 

%STPBEGIN;

ods graphics on / imagefmt=png;

proc sgplot data=sashelp.class;
  vbar age;
run; quit;

%STPEND;

 

If so, then include that code with the track.

 

Vince DelGobbo

SAS R&D

Ask a Question
Discussion stats
  • 7 replies
  • 222 views
  • 0 likes
  • 2 in conversation