Hi guys:
I have many ANOVAs to be run and each of them has its respective p value and R squares.
All ANOVAs have the same amount of observations, this means thar ERROR I and III could be taken to make part of the table i need to get
There we go, we have 3 ANOVA, everyone is a different answer on each environment:
data have;
input order environment country$ observation;
cards; 1 1 a 11.7062885827733 2 1 a 12.5326186073177 3 1 a 12.1121866473611 4 1 a 10.6770770786762 5 1 b 12.7272303160372 6 1 b 12.5069020572854 7 1 b 10.3801953337563 8 1 b 11.3699075949466 9 1 b 14.7913170706891 10 2 c 11.7957215280586 11 2 c 12.7967928055036 12 2 c 12.3156597291194 13 2 c 11.4903775240095 14 2 c 12.2868489869184 15 2 d 12.0244581514243 16 2 d 11.2738963155379 17 2 d 11.2017213686765 18 2 d 12.6084387827896 19 2 d 13.2818434423956 20 3 e 12.7756560519949 21 3 e 11.0392289428102 22 3 e 12.0000826320338 23 3 e 11.139270842614 24 3 e 13.5663343765743 25 3 f 11.7650627921355 26 3 f 12.6102709811389 27 3 f 11.5515913330262 28 3 f 14.0639297127507 29 3 f 12.3158309468017
proc glm data = have;
where environment = 1; class country order; model observation = country order; random order; means country / duncan tukey lines; run; quit;
proc glm data = have;
where environment = 2; class country order; model observation = country order; random order; means country / duncan tukey lines; run; quit;
proc glm data = have;
where environment = 3; class country order; model observation = country order; random order; means country / duncan tukey lines; run; quit;
now, we have to mount a new table containing:
Environment
rsquared
P value Model
P value Error I
p value ERROR III
1
2
3
IMPORTANT INFORMATION IN BIG CAPS
DATA PRESENTED HERE IS ENOUGH TO ACCOMPLISH THE PUZZLE, NO NEED TO GET MORE DETAILS.
Thanks for the help
Bets regards, always
... View more
I have got the SAS re-installed in my personal laptop. Earlier when I used to open a new file whether it is a SAS data file or a SAS code, they used to open in separate windows. However, now when I open any kind of SAS files, all the files get clubbed under one window and within the process flow as shown in the attached screenshot. This makes it quite difficult to see these different files separately or at the same time. Could anyone please help me resolve this issue? Thanks
... View more
proc surveyreg data=XXX varmethod=brr(fay); model score_m=ESCS ST004D01T IMMIG ; weight w_fstuwt; repweights w_fsturwt; run; I have used the PROC SURVEYREG in SAS with the BRR (Fay) method for my analysis of the PISA 2022 survey data. I am now uncertain whether it estimates using OLS or GLS. In my thesis, I have stated that the estimation is conducted using the OLS estimator. I am concerned that this might be incorrect. Could anyone clarify whether the estimation method is indeed OLS or if it is GLS? xx
... View more
**ADDENDUM to original post: I realized that this issue was being caused by starting with a "RETAIN" statement, which I use to put the variables in the desired order. But I'd still like to leave this question up because I'd appreciate any feedback on: How does a RETAIN statement work? When does it affect the outputs of a command in a DATA step? Does anyone have alternate/preferred strategies for reordering the variables in a dataset? Thanks! *********************************************************************** Original post: Hello SAS community, I'm very confused about how SAS deciphers "IF" Statements in the DATA step. In this specific case, I'm working with an account dataset that has some conflicting information about when accounts close, and I am constructing an "effective" close date. Earlier in my data step, I used some IF statements to construct my desired close date. The last step is to convert that numeric close date to a string variable in the format YYYYMM. Here's what I tried: DATA WORK.dates_test;
SET WORK.raw_dates;
close_eff_n = acct_close_dte_n; IF closed = 1 AND acct_close_dte_n = . THEN DO; close_eff_n = maxdate_n; END;
*(omitting some additional logic used here for parsimony);
IF close_eff_n > 0 THEN DO;
close_dte_eff = put(close_eff_n,yymmn.);
END;
RUN; I had earlier written this last segment as: close_dte_eff = put(close_eff_n,yymmn.); but this populated the string variable close_dte_eff with a value of "." when close_eff_n was missing, which is why I'm now trying to implement this conditional logic. The problem is: where this condition fails, SAS populates the close_dte_eff field with whatever the last non-failed value was, which is completely incorrect. e.g. I have: close_eff_n 01MAR2023 01APR2023 . . 01JUL2021 I want: close_eff_n close_dte_eff 01MAR2023 202303 01APR2023 202304 . . 01JUL2021 202107 But instead I get: close_eff_n close_dte_eff 01MAR2023 202303 01APR2023 202304 . 202304 . 202304 01JUL2021 202107 When I tried to replicate this problem with a simplified dataset, i.e. just taking the final input variables and creating the desired output, I got the result I want, so I suspect it might have something to do with the preceding IF-statements. I can think of plenty of workarounds to get this to work as intended, so my question is not so much how to fix this, but why is this happening? There's something fundamental about how the "IF-statement" is being processed where rows that fail the "IF" condition are being populated with the value of the last row that met that condition, and I would like to understand when SAS applies this behavior and when it does not. I can see this being a useful feature in some limited cases, but it's generally not what I would want to do when applying conditional logic. I had thought that these sort of situations where SAS operates on one row depending on what was in the previous row only happen when there is a "BY" statement, but obviously that's incorrect as there is no "BY" statement in this DATA step. I'd really appreciate some explanation as to when actions are applied to rows that do not meet the specified condition in an "IF" statement, and how to control that behavior, so I can make sure that the commands I write are applying to the rows that I expect them to apply to. Please let me know if I can provide any other context or information that would be helpful. Many thanks, Scott
... View more
proc surveyreg data=XXX varmethod=brr(fay); model score_m=ESCS ST004D01T IMMIG ; weight w_fstuwt; repweights w_fsturwt; run; I have used the PROC SURVEYREG in SAS with the BRR (Fay) method for my analysis of the PISA 2022 survey data. I am now uncertain whether it estimates using OLS or GLS. In my thesis, I have stated that the estimation is conducted using the OLS estimator. I am concerned that this might be incorrect. Could anyone clarify whether the estimation method is indeed OLS or if it is GLS? xx
... View more