BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
3 REPLIES 3
GraphGuy
Meteorite | Level 14
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! 🙂
deleted_user
Not applicable
thanks robert..
i tried but i couldnt get the code...if anybody know the solution please help me.
Cynthia_sas
SAS Super FREQ
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]

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 3 replies
  • 1207 views
  • 0 likes
  • 3 in conversation