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

Showing results for

- Home
- /
- Learn SAS
- /
- SAS Software for Learning Community
- /
- Get Errorterms from PROC REG

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

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

Posted 08-25-2023 07:32 AM
(517 views)

I want to write a SAS programme to find my errorterms without having to type the R2 values from the output, but rather pick them up from a data file.

I want to use the output function of PROC REG!

Can someone help me?

16 REPLIES 16

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

I can't view your .pdf files, as I never download any attachments.

All output from PROC REG (and really all PROCs) can be sent to SAS data sets, so you can obtain the numbers without typing them in. Depending on specifically which parts of the PROC REG output you want (please show us screen captures of the PROC REG output, and include them in your reply by clicking on the "camera" icon), we can provide code to obtain them.

--

Paige Miller

Paige Miller

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

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

Please show the code that produces this Squared Multiple Correlations output.

--

Paige Miller

Paige Miller

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

This is my full code. And this produces the Squared Multiple Correlations.

proc contents data=ess1;

run;

Proc Freq Data = ESS1;

Tables AGEA GNDR MARITAL HLPPPL TVTOT RLGDGR HAPPY;

Run;

Data ESS1;

Set ESS1;

HLPPPLRev = 8 - HLPPPL;

Label HLPPPLRev = 'Hoe vaak mensen helpen';

Run;

Proc Freq Data = ESS1;

Tables HLPPPL HLPPPLRev;

Run;

Data ESS1;

Set ESS1;

GNDRdum = (GNDR = 1);

IF GNDR <0 then GNDRdum = .;

D1marital = (MARITAL = 2);

If MARITAL <0 then D1marital = .;

D2marital = (MARITAL = 3);

If MARITAL <0 then D2marital = .;

D3marital = (MARITAL = 4);

If MARITAL <0 then D3marital = .;

D4marital = (MARITAL = 5);

If MARITAL <0 then D4marital = .;

Label GNDRdum = 'Dummy Geslacht - Man'

D1marital = 'Dummy BurgStaat – Uiteen'

D2marital = 'Dummy BurgStaat - Gescheiden'

D3marital = 'Dummy BurgStaat - Weduwe/weduwnaar'

D4marital = 'Dummy BurgStaat - Nooit gehuwd';

Run;

Proc Freq Data = ESS1;

Tables GNDR GNDRdum;

Run;

Proc Freq Data = ESS1;

Tables MARITAL D1marital D2marital D3marital D4marital;

Run;

Proc Calis Data = ESS1 kurtosis covariance modification toteff;

Lineqs

HAPPY = PV1V2 HLPPPLRev + PV1V3 TVTOT + PV1V4 RLGDGR + PV1V5 BLNCMIG + PV1V6 AGEA + PV1V7 GNDRDum + E1,

HLPPPLRev = PV2V4 RLGDGR + E2,

TVTOT = PV3V2 HLPPPLRev + PV3V6 AGEA + PV3V7 GNDRdum + E3,

RLGDGR = PV4V7 GNDRdum + PV4V8 D1marital + PV4V9 D2marital + PV4V10 D3marital + PV4V11 D4marital + E4;

STD

BLNCMIG = VarV5,

AGEA = VarV6,

GNDRdum = VarV7,

D1marital = VarV8,

D2marital = VarV9,

D3marital = VarV10,

D4marital = VarV11,

E1 = VarE1,

E2 = VarE2,

E3 = VarE3,

E4 = VarE4;

Cov

BLNCMIG AGEA = CV5V6,

BLNCMIG GNDRdum = CV5V7,

BLNCMIG D1marital = CV5V8,

BLNCMIG D2marital = CV5V9,

BLNCMIG D3marital = CV5V10,

BLNCMIG D4marital = CV5V11,

AGEA GNDRdum = CV6V7,

AGEA D1marital = CV6V8,

AGEA D2marital = CV6V9,

AGEA D3marital = CV6V10,

AGEA D4marital = CV6V11,

GNDRdum D1marital = CV7V8,

GNDRdum D2marital = CV7V9,

GNDRdum D3marital = CV7V10,

GNDRdum D4marital = CV7V11,

D1marital D2marital = CV8V9,

D1marital D3marital = CV8V10,

D1marital D4marital = CV8V11,

D2marital D3marital = CV9V10,

D2marital D4marital = CV9V11,

D3marital D4marital = CV10V11;

Var

AGEA GNDRdum D1marital D2marital D3marital D4marital BLNCMIG HLPPPLRev TVTOT RLGDGR HAPPY;

Run;

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

So where is the Prog REG in your original question?

I see Proc Freq and Proc Calis but no REG.

@PRO2 wrote:

This is my full code. And this produces the Squared Multiple Correlations.

proc contents data=ess1;

run;

Proc Freq Data = ESS1;

Tables AGEA GNDR MARITAL HLPPPL TVTOT RLGDGR HAPPY;

Run;

Data ESS1;

Set ESS1;

HLPPPLRev = 8 - HLPPPL;

Label HLPPPLRev = 'Hoe vaak mensen helpen';

Run;

Proc Freq Data = ESS1;

Tables HLPPPL HLPPPLRev;

Run;

Data ESS1;

Set ESS1;

GNDRdum = (GNDR = 1);

IF GNDR <0 then GNDRdum = .;

D1marital = (MARITAL = 2);

If MARITAL <0 then D1marital = .;

D2marital = (MARITAL = 3);

If MARITAL <0 then D2marital = .;

D3marital = (MARITAL = 4);

If MARITAL <0 then D3marital = .;

D4marital = (MARITAL = 5);

If MARITAL <0 then D4marital = .;

Label GNDRdum = 'Dummy Geslacht - Man'

D1marital = 'Dummy BurgStaat – Uiteen'

D2marital = 'Dummy BurgStaat - Gescheiden'

D3marital = 'Dummy BurgStaat - Weduwe/weduwnaar'

D4marital = 'Dummy BurgStaat - Nooit gehuwd';Run;

Proc Freq Data = ESS1;

Tables GNDR GNDRdum;

Run;

Proc Freq Data = ESS1;

Tables MARITAL D1marital D2marital D3marital D4marital;

Run;

Proc Calis Data = ESS1 kurtosis covariance modification toteff;

LineqsHAPPY = PV1V2 HLPPPLRev + PV1V3 TVTOT + PV1V4 RLGDGR + PV1V5 BLNCMIG + PV1V6 AGEA + PV1V7 GNDRDum + E1,HLPPPLRev = PV2V4 RLGDGR + E2,TVTOT = PV3V2 HLPPPLRev + PV3V6 AGEA + PV3V7 GNDRdum + E3,RLGDGR = PV4V7 GNDRdum + PV4V8 D1marital + PV4V9 D2marital + PV4V10 D3marital + PV4V11 D4marital + E4;STDBLNCMIG = VarV5,AGEA = VarV6,GNDRdum = VarV7,D1marital = VarV8,D2marital = VarV9,D3marital = VarV10,D4marital = VarV11,E1 = VarE1,E2 = VarE2,E3 = VarE3,E4 = VarE4;CovBLNCMIG AGEA = CV5V6,BLNCMIG GNDRdum = CV5V7,BLNCMIG D1marital = CV5V8,BLNCMIG D2marital = CV5V9,BLNCMIG D3marital = CV5V10,BLNCMIG D4marital = CV5V11,AGEA GNDRdum = CV6V7,AGEA D1marital = CV6V8,AGEA D2marital = CV6V9,AGEA D3marital = CV6V10,AGEA D4marital = CV6V11,GNDRdum D1marital = CV7V8,GNDRdum D2marital = CV7V9,GNDRdum D3marital = CV7V10,GNDRdum D4marital = CV7V11,D1marital D2marital = CV8V9,D1marital D3marital = CV8V10,D1marital D4marital = CV8V11,D2marital D3marital = CV9V10,D2marital D4marital = CV9V11,D3marital D4marital = CV10V11;VarAGEA GNDRdum D1marital D2marital D3marital D4marital BLNCMIG HLPPPLRev TVTOT RLGDGR HAPPY;Run;

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

You talked about PROC REG, that's the code I want to see. The rest is not needed for this discussion.

--

Paige Miller

Paige Miller

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

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

This does not produce a table named SQUARED MULTIPLE CORRELATIONS which I thought was what you wanted, after seeing your earlier message.

Could you just explain the whole thing in words, from start to finish, so we can understand what the problem is?

--

Paige Miller

Paige Miller

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

Okay so normally I calculate the errorterms by doing the syntax I sended earlier. Like here:

Data errortest;

ErrHAPPY = sqrt (1-0.0115);

ErrHLPPPLRev = sqrt (1-0.000904);

ErrTVTOT = sqrt (1-0.0387);

ErrRGLDGR = sqrt (1-0.0568);

Run;

But in that case, I have to search for the R squared values in my results in the SQUARED MULTIPLE CORRELATIONS matrix and manually type them over.

Now I have an assignment; it asks me to write a SAS programme that does NOT require me to type the R2 values from the output, but can pick them up from a data file. And I have to use the output function of PROC REG for it.

If someone knows which code I have to write with PROC REG to eventually get the errorterms (ErrHAPPY, ErrHLPPPLRev, ErrTVTOT, ErrRGLDGR), let me know.

Thank you!

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

The code you showed for PROC REG does not produce an output called Squared Multiple Correlations (or at least, you haven't shown us PROC REG code that produces this table, and the PROC REG output you did show us does not have this table). So I am at a loss to know what to say or how to proceed.

--

Paige Miller

Paige Miller

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

It's true. I don't get the Squared Multiple Correlations if I do it with PROC REG...

That's why I'm hoping that someone knows a different way to get to the errorterms.

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

So how are you getting them in the first place? What proc generates those values and why can't you capture it there?

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

So normally I get them out of this step. A PROC CALIS.

Proc Calis Data = ESS1 kurtosis covariance modification toteff;

But the assignment is to get the errorterms out the PROC REG output.

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

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. **

Upcoming Events

- Ask the Expert: Entdecken Sie die Möglichkeiten von SAS in Visual Studio Code | 07-Dec-2023
- Ask the Expert: Deploying SAS® Viya® on 4th Gen Intel® Xeon® Hardware | 12-Dec-2023
- SAS Bowl XXXVI, Data Simulation | 13-Dec-2023
- Ask the Expert: AI-Driven SAS Transformation – Generating Insights for the Customer | 14-Dec-2023

5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.