Hello ,
I am Using Proc SGPLOT and i am stuck when data is zero obs when subject is missing from data
Please guide me how to display graph with X ,Y axis values with No data report in middle of graph box .
It will be better legends will dispaly.
I am using below code for sg plot.
Thank you,
Raja.B
Your example "code" is incomplete in that you show
%if &sqlobs > 0 %then %do;
but no matching end.
You would want a block of code inside.
%else %do;
%end;
Maybe something like:
%else %do;
Data dummy;
x=48;
y=3;
text="No Data";
run;
proc sgplot data=dummy;
text x=x y=y text=text;
<your xaxis and yaxis go here
as I am too lazy to retype
everything
>
run;
%end;
I picked x and y values should have the text appear near the middle of the graph with the XAXIS and YAXIS statements you showed. Feel free to play with them or the actual text of the text variable.
You really ought to provide the code as text pasted into the box that appears when you click on the "running man" icon, and not as a screen capture from now on.
To solve your problem, you would need to use a macro. You compute the number of observations in your data set. If the number of observations is above 0 (or above any number you choose) then you create the plot. Otherwise, you branch around the plot code.
Your example "code" is incomplete in that you show
%if &sqlobs > 0 %then %do;
but no matching end.
You would want a block of code inside.
%else %do;
%end;
Maybe something like:
%else %do;
Data dummy;
x=48;
y=3;
text="No Data";
run;
proc sgplot data=dummy;
text x=x y=y text=text;
<your xaxis and yaxis go here
as I am too lazy to retype
everything
>
run;
%end;
I picked x and y values should have the text appear near the middle of the graph with the XAXIS and YAXIS statements you showed. Feel free to play with them or the actual text of the text variable.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.