Turn on suggestions

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

Showing results for

- Home
- /
- Programming
- /
- Graphics
- /
- How to insert p-value in summary box of fit plots?

Options

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

☑ This topic is **solved**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 09-11-2022 12:04 AM
(517 views)

Does anyone know how to modify/edit the variables appearing in the fit plots' summary box (in the output)? I want to include the p-value and standard error.

I am using:

PROC REG DATA=Test1 CORR;

MODEL Y=X / CLB P CLM;

RUN;

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Save these statistics and Plot it by PROC SGPLOT.

ods output ParameterEstimates=x; PROC REG DATA=sashelp.class CORR ; MODEL height=weight / CLB P CLM; quit; proc sql ; select catx(' ',Variable,'StdErr:',put(StdErr,8.2)) into : StdErr from x where Variable='Weight' ; select catx(' ',Variable,'PValue:',put(Probt,pvalue8.2)) into : Probt from x where Variable='Weight' ; quit; proc sgplot data=sashelp.class; reg y=height x=weight/clm; inset "&StdErr." "&Probt."; run;

6 REPLIES 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Save these statistics and Plot it by PROC SGPLOT.

ods output ParameterEstimates=x; PROC REG DATA=sashelp.class CORR ; MODEL height=weight / CLB P CLM; quit; proc sql ; select catx(' ',Variable,'StdErr:',put(StdErr,8.2)) into : StdErr from x where Variable='Weight' ; select catx(' ',Variable,'PValue:',put(Probt,pvalue8.2)) into : Probt from x where Variable='Weight' ; quit; proc sgplot data=sashelp.class; reg y=height x=weight/clm; inset "&StdErr." "&Probt."; run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you so much, Ksharp.

I did try your code but it did not generate what I wanted. I found another one in this link https://support.sas.com/kb/65/202.html but the box with the summary is not shown correctly (as shown in the image). Any suggestions?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Maybe there is not enough room for INSET.

Try add this into your SGPLOT :

yaxis min=-10;

Try add this into your SGPLOT :

yaxis min=-10;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you so much, Ksharp.

I stopped using the software for several hours, and then when I tried again, it worked without putting your suggestion. However, now I get a warning that does not allow p-value and St Err to show in the summary box. As you can see in my previous graph, it worked (at least I could see the values), but now it does not. I wonder if it is a software issue. See the warning below. Any suggestion would be appreciated.

WARNING: Apparent symbolic reference PROBT not resolved.

229 "St Error"="&StdErr"

WARNING: Apparent symbolic reference STDERR not resolved.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

As DanH said, make sure your macro variable generated correctly . To check it, open your dataset that generate these macro variable,and check if is there any obs/value to generate macro variable.

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.