turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- If X and Y are Zero No graph

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-02-2010 05:14 PM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-02-2010 07:10 PM

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!

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!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-03-2010 01:30 PM

thanks robert..

i tried but i couldnt get the code...if anybody know the solution please help me.

i tried but i couldnt get the code...if anybody know the solution please help me.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-03-2010 05:41 PM

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]

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]