Data visualization with SAS programming

If X and Y are Zero No graph

Reply
N/A
Posts: 0

If X and Y are Zero No graph

Hello

i am working on Base SAS.
Can any one tell me the procedure for

If X and Y are zero then instead of empty graph, message should be displayed.

Is it possible in Base SAS to create such a report.

Thanks
Sid
SAS Employee
Posts: 967

Re: If X and Y are Zero No graph

I'll tackle 1/2 the question...

With just Base SAS (ie, without SAS/Graph), you can generate a simple scatter plot using 'proc plot', as follows...

proc plot data=sashelp.class;
plot height*weight='*';
run;

Per checking the values first, and writing out a message if they are zero - I guess you could do that in a little macro or something, and maybe 'put' statements (or 'proc print' of a file containing the desired text). Probably a lot of different ways to do this. I'll let an expert in that area field that part though! Smiley Happy
N/A
Posts: 0

Re: If X and Y are Zero No graph

thanks robert..
i tried but i couldnt get the code...if anybody know the solution please help me.
SAS Super FREQ
Posts: 8,716

Re: If X and Y are Zero No graph

Hi:
Well, I have several questions lumped into 2 main question categories:
1) Do you really only have Base SAS?? Or do you have Enterprise Guide? If so, can you produce charts using the Graph Tasks in EG?? Do you have SAS/GRAPH in addition to Base SAS?? What code are you using?? PROC GCHART? PROC GPLOT?? PROC SGPLOT??? PROC PLOT??? I would think the graphics produced by PROC PLOT would be unacceptable in look and feel. What code are you using to produce your graphs?

2) Using the terms X and Y implies to me that you have some kind of scatter plot or series plot. So you wouldn't be plotting just 1 X or 1 Y value??? Do you mean that ALL the X and Y values are 0??? What does your data look like???

For example, consider the program below. The dataset WORK.ZEROES has all 0 values for HEIGHT and WEIGHT -- a Graph -- not a very pretty one -is- produced for this data situation. As opposed to WORK.MISSING, where the values for HEIGHT and WEIGHT are all missing. In that case, a warning is issued in the SAS log.

Can you share some more information about your data and the code you've tried?? Given the output from my program, what would you expect to see for the graph on WORK.ZEROES and where you would you expect to see it??? A message in the graph, a message in the ODS file?? What ODS destination are you using for your output??? (I use ODS RTF for output below.)

cynthia
[pre]
data zeroes;
set sashelp.class;
height = 0;
weight = 0;
run;

data missing;
set sashelp.class;
height=.;
weight=.;
run;

ods listing close;
ods rtf file='use_gplot.rtf';
proc gplot data=sashelp.class;
title 'Have Values';
plot height*weight;
run;
quit;

proc gplot data=work.zeroes;
title 'Have ALL 0';
plot height*weight;
run;
quit;

proc gplot data=work.missing;
title 'Have ALL Missing Values';
plot height*weight;
run;
quit;
ods rtf close;
[/pre]
Ask a Question
Discussion stats
  • 3 replies
  • 238 views
  • 0 likes
  • 3 in conversation