Data visualization with SAS programming

sgpanel using probplot from proc univariate

Accepted Solution Solved
Reply
Contributor das
Contributor
Posts: 44
Accepted Solution

sgpanel using probplot from proc univariate

I'm am interested in producing a panel of probplots, the sort that I can produce using proc univariate. I'm not seeing a way to output the probability data calculated by proc univariate. I think I'm expecting something like the outhistogram function within the univariate procedure but I can't find or recognize it. Perhaps there is another procedure that I should be using. For example, I thought there was an ODS procedure that could capture, essentially, graphs produced in a preceding procedure but then organize differently, like in a sgpanel procedure.

In case it helps, my data set contains a single response variable (Area%threshold) and 4 factors: animal ID (5 levels), antibody (two levels), antibody concentration (4 levels), replicates (two levels, so far). For right now, what I'd like to produce are probplots (x=percentile, y=Area%Threshold, overlay of antibody concentrations) organized as two columns (replicates 1 and 2) and rows as antibody within animal IDs.

Hope that is enough for someone to make a suggestion.

Thank you,

Dave


Accepted Solutions
Solution
‎02-03-2014 10:02 AM
SAS Super FREQ
Posts: 864

Re: sgpanel using probplot from proc univariate

There is a way that you can capture the data. First, say "ods trace on;" before the PROC UNIVARIATE and submit the job. In the log, you will the names of all the output objects from the run. One (or more) of those names should correspond to the graph output. Now, you can turn ODS TRACE to OFF and add this line before the PROC UNIVARIATE:

ods output <object name>=<output data set name>;

This statement will generate an output data set of the data used to create the data. You can then use this data in the SG procedures.

Hope this helps!

Dan

View solution in original post


All Replies
Solution
‎02-03-2014 10:02 AM
SAS Super FREQ
Posts: 864

Re: sgpanel using probplot from proc univariate

There is a way that you can capture the data. First, say "ods trace on;" before the PROC UNIVARIATE and submit the job. In the log, you will the names of all the output objects from the run. One (or more) of those names should correspond to the graph output. Now, you can turn ODS TRACE to OFF and add this line before the PROC UNIVARIATE:

ods output <object name>=<output data set name>;

This statement will generate an output data set of the data used to create the data. You can then use this data in the SG procedures.

Hope this helps!

Dan

Contributor das
Contributor
Posts: 44

Re: sgpanel using probplot from proc univariate

Dan, 

Thank you for the advice. I will give it a try. Sounds like just what I was looking for.

Dave ft

Contributor das
Contributor
Posts: 44

Re: sgpanel using probplot from proc univariate

Dan,

Here is a screen clipping of the log. I'm not sure what to use for the line of ods code you gave me. I assume I would enter multiple repeats to capture each graph in separate datasets.

Thanks for your help.

Clipboard.jpg

SAS Super FREQ
Posts: 864

Re: sgpanel using probplot from proc univariate

The data for all of those ProbPlot output object should have been concatenated into the data set you specified. Did that not happen?

Contributor das
Contributor
Posts: 44

Re: sgpanel using probplot from proc univariate

Dan,

Dan,

I wasn't sure which of the names in the trace log were to be used in the ods output statement. However, your reply helped me realize that your <objectname> statement could in fact refer to each of the ProbPlots created. So I entered the code as such: ods output ProbPlot=<my dataset name>; and yes it worked just as you said.

Thanks data_null, I figured this out just as you sent this. But that was my question.

Thank you both for such rapid help. I'll post my final figure once I have it just to show that I got it done with your help.

Dave

Respected Advisor
Posts: 3,768

Re: sgpanel using probplot from proc univariate

ODS OUTPUT PROBPLOT=sas-data-set-name;

The NAME from ODS TRACE ON.  I usually use the same name for my data set.

ODS OUTPUT PROBPLOT=PROBPLOT.

As Dan mentioned you should get all BY levels stacked into the data set.

Contributor das
Contributor
Posts: 44

Re: sgpanel using probplot from proc univariate

Below I've inserted two images of the outputs. "Probability Plot for threshold" is one of the panel plots generated by the univariate procedure and is what I am hoping to congregate as a single panel of such images. I used the following proc sgpanel code to generate the other image (sorry, no title). Not quite there but very close.

proc sgpanel data=RMTA_prplot;

panelby class1 replicate  goat / layout=panel onepanel columns=4 rowheaderpos=left;

scatter x=Percentile y=data / group=group;

run ;

Is there a way to get the same unique x-axis scaling into the panel of plots?

Also, these are very large datasets; the ods output dataset has just over a million rows. May need to first regress a curve to each data and plot just the curves. I had to bump up my java head space in order to process this output.

Thanks for any additional pointers or suggestions.

Dave

SGPanel.pngProbPlot15.png

SAS Super FREQ
Posts: 864

Re: sgpanel using probplot from proc univariate

What version of SAS are you using?

Contributor das
Contributor
Posts: 44

Re: sgpanel using probplot from proc univariate

9.3

Contributor das
Contributor
Posts: 44

Re: sgpanel using probplot from proc univariate

I've discovered that the quantile data (generated by proc univariate for use in qqplots but which was also exported into the ods output for probplot) essentially contains the scaling used in the probplot. So, using that data in an sgpanel procedure, I was able to produce summary graphs for each animal in the study (as seen below for one animal). And I think that is close enough for my purposes.

Thanks again for all the help starting me down the right path.

Dave

proc sgpanel data=RMTA_prplot ;

     by goat ;

     panelby class1 replicate /

                         layout=lattice

                         ROWHEADERPOS= LEFT

                         COLHEADERPOS= TOP

                         ;

     scatter x=Quantile y=data / group=group;

run ;

SGPanel5.png

Post a Question
Discussion Stats
  • 10 replies
  • 770 views
  • 3 likes
  • 3 in conversation