BookmarkSubscribeRSS Feed
kk26
Calcite | Level 5

I am using CIF fuction but the graph that SAS produce that is not what we want , so i am tryinng to plot it with proc gplot function.

how can i make this below code work on 9.4. 


data work.test_ (label='Cumulative Incidence Estimates');
infile datalines dsd dlm='|' truncover;
input FAILCODE TRT01PN TIMELIST AVAL CIF STDERR ALPHA CONFTYPE :$8.
CIF_LCL CIF_UCL STRATUM
;
label FAILCODE='Event of Interest'
TRT01PN='Planned Treatment for Period 01 (N)'
TIMELIST='TIMELIST Value' AVAL='TIMELIST Value'
CIF='Cumulative Incidence Function Estimate'

;

datalines4;
1|1|3|3.12114989733059|0.05555823486857|0.01917166258327|0.05|LOGLOG|0.0259304913951|0.10154073438836|1
1|1|6|5.71663244353182|0.3661918909774|0.04065631947652|0.05|LOGLOG|0.28720258404364|0.44532647022326|1
1|1|9|9.00205338809035|0.41802117379745|0.04184609425768|0.05|LOGLOG|0.3354624419363|0.49831523632323|1
1|1|12|13.3388090349076|0.45042006543086|0.04260178335393|0.05|LOGLOG|0.36558121093365|0.53144069770751|1
1|1|15|15.441478439425|0.46470202582437|0.04397641735366|0.05|LOGLOG|0.37673682397083|0.54792359999247|1
1|1|18|15.441478439425|0.49326594661138|0.0506960225811|0.05|LOGLOG|0.39071110622104|0.58776162585648|1
1|1|21|15.441478439425|0.49326594661138|0.0506960225811|0.05|LOGLOG|0.39071110622104|0.58776162585648|1
1|1|24|15.441478439425|0.49326594661138|0.0506960225811|0.05|LOGLOG|0.39071110622104|0.58776162585648|1
1|2|3|3.3182751540041|0.10416666666666|0.04462731571423|0.05|LOGLOG|0.03768298618632|0.21006944634453|2
1|2|6|6.01232032854209|0.41666666666666|0.07253649610146|0.05|LOGLOG|0.27452452184132|0.55272421461974|2
1|2|9|9.00205338809035|0.49999999999999|0.07394081869766|0.05|LOGLOG|0.34889007916378|0.63364185819436|2
1|2|12|9.00205338809035|0.52380952380952|0.07454376340733|0.05|LOGLOG|0.36958387590151|0.65700186028427|2
1|2|15|14.5544147843942|0.5595238095238|0.0781499645192|0.05|LOGLOG|0.39439225935444|0.69600660930235|2
1|2|18|14.5544147843942|0.5595238095238|0.0781499645192|0.05|LOGLOG|0.39439225935444|0.69600660930235|2
1|2|21|||||LOGLOG|||2
1|2|24|||||LOGLOG|||2
;;;;

 

 

 

ods graphics on;
ods output ;


axis1 order=(0 to 30 by 5) ;
axis2 order=(0 to 1 by 0.1) ;

title1 "";
footnote1 "";
proc gplot data=test_(where=(AVAL^=.));
plot CIF*AVAL=trt01pn/ haxis=axis1 vaxis=axis2 ;
run;
quit;
ods output close;
ods graphics off;



3 REPLIES 3
ballardw
Super User

First you have to have SAS/Graph module licensed.

If you have the module licensed the code you provide creates a graph. If you are getting a graph and don't like the result the describe what you don't like or what you want that isn't appearing.

 

If you get an error that Proc Gplot isn't available then use SGPLOT which is most likely available though the  options are different

 

title1 "";
footnote1 "";
proc sgplot data=work.test_(where=(AVAL^=.));
   scatter y= CIF x=AVAL / group=trt01pn;
   xaxis values=(0 to 30 by 5);
   yaxis values=(0 to 1 by 0.1) ;
run;
kk26
Calcite | Level 5

First you have to have SAS/Graph module licensed. ::------ yes, i have licensed version 9.4. 

If you have the module licensed the code you provide creates a graph. If you are getting a graph and don't like the result the describe what you don't like or what you want that isn't appearing. ::------ it does not create a graph nor produce any error in log i am using 9.4. i am using 9.4 because CIF can only produced in 9.4 . 

here is log :


723 ods graphics on;
724 ods output ;
725
726 /*goptions reset=global ;*/
727 axis1 order=(0 to 30 by 5) ;
728 axis2 order=(0 to 1 by 0.1) ;
729
730 title1 "";
731 footnote1 "";
732 proc gplot data=test_(where=(AVAL^=.));
733 plot CIF*AVAL=trt01pn/ haxis=axis1 vaxis=axis2 ;
734 run;

735 quit;

NOTE: There were 14 observations read from the data set WORK.TEST_.
WHERE AVAL not = .;
NOTE: PROCEDURE GPLOT used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds

 

I am trying to produce a graph like below. i will deal with all the stats later and based .  

forumq_2.PNG

 

 

 

 

If you get an error that Proc Gplot isn't available then use SGPLOT which is most likely available though the  options are different.

i used your code and it produces below plot. 

 

forumq3.PNG

 

ballardw
Super User

@kk26 wrote:

First you have to have SAS/Graph module licensed. ::------ yes, i have licensed version 9.4. 

If you have the module licensed the code you provide creates a graph. If you are getting a graph and don't like the result the describe what you don't like or what you want that isn't appearing. ::------ it does not create a graph nor produce any error in log i am using 9.4. i am using 9.4 because CIF can only produced in 9.4 . 

here is log :

 


723 ods graphics on;
724 ods output ;
725
726 /*goptions reset=global ;*/
727 axis1 order=(0 to 30 by 5) ;
728 axis2 order=(0 to 1 by 0.1) ;
729
730 title1 "";
731 footnote1 "";
732 proc gplot data=test_(where=(AVAL^=.));
733 plot CIF*AVAL=trt01pn/ haxis=axis1 vaxis=axis2 ;
734 run;

735 quit;

NOTE: There were 14 observations read from the data set WORK.TEST_.
WHERE AVAL not = .;
NOTE: PROCEDURE GPLOT used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds

 

I am trying to produce a graph like below. i will deal with all the stats later and based .  

 

 

 

 

 

If you get an error that Proc Gplot isn't available then use SGPLOT which is most likely available though the  options are different.

i used your code and it produces below plot. 

 

 

 


You did NOT describe the type of plot you wanted. If using GPLOT then that depends on your SYMBOL statement definitions. The likely default after resetting goptions is to place plus shaped markers. To create lines you need to use and INTERPOLATION option.

There a quite a few things that can cause issues with the older graphics procedures because they expect output to be directed to a device. So if the default output is other than the monitor device it could be sent to a printer or file. Examine DEVICE setting.

You may need to run Proc Goptions to examine all of your settings.

To see your symbol statements if defined:

proc goptions symbol; 
run;

If there aren't any then you get a scatter plot with plus markers.

 

 

In SGPLOT that would be a Step or Series plot. To modify the example SGPLOT code in this case I think the only thing you need to change would be replace Scatter with Step or Series. If you want markers along with the line you would the Markers options and to control those add MARKERATTRS options.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 693 views
  • 2 likes
  • 2 in conversation