BookmarkSubscribeRSS Feed
PRO2
Calcite | Level 5

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
PaigeMiller
Diamond | Level 26

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
PRO2
Calcite | Level 5

Screenshot 2023-08-25 at 13.22.19.pngScreenshot 2023-08-25 at 13.23.24.pngScreenshot 2023-08-25 at 13.23.44.png

PaigeMiller
Diamond | Level 26

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

--
Paige Miller
PRO2
Calcite | Level 5

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;
ballardw
Super User

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;

 

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;

 

PaigeMiller
Diamond | Level 26

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

--
Paige Miller
PRO2
Calcite | Level 5

Screenshot 2023-08-25 at 17.19.45.pngScreenshot 2023-08-25 at 17.19.51.pngScreenshot 2023-08-25 at 17.19.57.pngScreenshot 2023-08-25 at 17.21.18.png

PaigeMiller
Diamond | Level 26

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
PRO2
Calcite | Level 5

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!

PaigeMiller
Diamond | Level 26

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
PRO2
Calcite | Level 5

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.

Reeza
Super User
So how are you getting them in the first place? What proc generates those values and why can't you capture it there?
PRO2
Calcite | Level 5

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.

Reeza
Super User

Where do the values, 0.0115, 0.000904 etc come from in the data step? I can't see them in the PROC REG output? Are those the values you're trying to capture?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 16 replies
  • 2422 views
  • 0 likes
  • 4 in conversation