Recent Activity
TLDR: I want to conduct a balancing test / F-statistic to see if 6 control variables (foed_kom_num, foed_mmyy, spacing_mon, mor_alder, far_alder, and andel_mor_foed) can predict the variable of interest ('brother'). THANK YOU! Dear everyone, this is my first post in this community—I hope someone has the time to help. I use SAS 9.4 (English with DBCS). I'm working on my thesis and replicating parts of the article "Brothers Increase Women’s Gender Conformity" by Anne Brenøe (2021). I'm using slightly different data and variables. In Table 1, Panel B, she conducts a balancing test/joint F-statistic to test whether all seven control variables in her OLS model can predict the variable of interest. Her model (simplified) is: y = alpha_0 + alpha_1 * brother + X * delta + error term, where 'brother' is the variable of interest, and X is a vector of the seven control variables. The outcome for the balancing test is reported as: joint F-statistic: 0.92 prob > F: 0.92 Please note that she provides only one result (0.92). My model follows the same structure: y = alpha_0 + alpha_1 * brother + X * delta + error term, where 'brother' is again the variable of interest. However, my vector X contains only six control variables: foed_kom_num, foed_mmyy, spacing_mon, mor_alder, far_alder, and andel_mor_foed (written in Danish so I can follow your answers—I hope this makes sense even though it’s not in English.) Variables formats: brother: 1 if boy, 2 if girl foed_kom_num: numeric best12. foed_mmyy: numeric best12. spacing_mon: numeric best12. mor_alder: numeric best12. far_alder: numeric best12. andel_mor_foed: numeric best12. I've spent a long time searching and using ChatGPT, but I can't seem to get just one joint result. The closest I've come is with the following code. (Note: I would like to use an OLS-based approach, as my supervisor is not fond of logistic approaches. I also believe Brenøe uses an OLS-based test.). Hope someone can help. Thanks a lot in advance. Best, Jo /* Step 1: Run the Full Model */
proc glm data=your_data outstat=full_stats noprint;
model brother= foed_kom foed_mmyy spacing_mon mor_alder far_alder andel_mor_foed;
run;
/* Step 2: Run the Reduced Model (Intercept Only) */
proc glm data=your_data outstat=reduced_stats noprint;
model brother = ;
run;
/* Step 3: Extract SSE and Compute F-Statistic */
data f_test;
merge full_stats (where=(_TYPE_='ERROR') rename=(SS=SSE_full DF=DF_full))
reduced_stats (where=(_TYPE_='ERROR') rename=(SS=SSE_reduced DF=DF_reduced));
p = 6; /* Number of predictors */
n = DF_reduced + 1; /* Total observations */
df_num = p;
df_den = DF_full;
/* Compute F-statistic */
F_stat = ((SSE_reduced - SSE_full) / df_num) / (SSE_full / df_den);
/* Compute p-value */
p_value = 1 - probf(F_stat, df_num, df_den);
run;
/* Step 4: Print the F-statistic and p-value */
proc print data=f_test;
var F_stat p_value;
run;
... View more

0
3
Hi Folks, I have a piece of SAS code that updates for a given user in Metadata (and a given Authentication doman of this particular user) its Login-Credentials: %macro update_login_in_metada(name, pwd, auth);
data _null_;
length uri_domain $256.;
length uri_user $256.;
length uri_login $256.;
length name_domain $200.;
length name_user $200.;
* initialize "uri*" and "name_*" variables;
call missing(of uri_: name_:);
* initialize variable "nobj1";
nobj1 = -1;
* write number of person objects found in metadata into "nobj1";
nobj1 = metadata_getnobj("omsobj:Person?@Id contains '.'", 1, uri_user);
* loop through all found person objects;
if nobj1 > 0 then
do;
do i = 1 to nobj1;
nobj2 = metadata_getnobj("omsobj:Person?@Id contains '.'", i, uri_user);
rc1 = metadata_getattr(uri_user, "Name", name_user);
* lookup person object;
if name_user = "&name." then
do;
* get corresponding Login-Account of Auth-Domain;
nobj3 = metadata_getnasn(uri_user, "Logins", 1, uri_login);
* loop through all Login-Accounts of particular user;
if nobj3 > 0 then
do;
do j = 1 to nobj3;
nobj4 = metadata_getnasn(uri_user, "Logins", j, uri_login);
nobj5 = metadata_getnasn(uri_login, "Domain", 1, uri_domain);
rc2 = metadata_getattr(uri_domain, "Name", name_domain);
if name_domain = "&auth." then /* update password for selected Auth-Domain*/
do;
rc3 = metadata_setattr(uri_login, "Password", "&pwd.");
end;
end;
end;
end;
end;
end;
run;
%mend update_login_in_metada; It takes approximately 50 seconds for one user to run this step: %update_login_in_metada(johndoe, abc123, DBAuth) To me it seems, that the Data Step Metadata Functions are very slow... I know of the Metadata Procedure as a potential alternative way to update metadata. However, I do not know, how to set up/write the appropriate xml file structure as input to the procedure. Also, is the Metadata Procedure faster than the Data Step Metadata Functions? Any help would be highly appreciated, FK21
... View more

0
12
Dear All, I have a large dataset stored on a remote SAS server with approximately 400 million rows and 88 columns. My goal is to create a new column by shifting a date variable by 1 month. I intend to do this with a simple left join, similar to what I would do in a SQL server. My problem is as follows: when I tried to use the ALTER TABLE command, it ran indefinitely without producing any results. However, when I created a new table, the process finished in 30 minutes. How should I properly execute this process? Here is the hard-copy version of my code: rsubmit;
%let start_time = %sysfunc(datetime());
proc sql;
drop table table_v2;
create table table_v2 as
select *,
t2.variable as shifted_variable
from table_v1 as t1
left join (select date, deal_id, variable from table_v1) as t2
on t1.deal_id = t2.deal_id and t1.date = intnx('month', t2.date, -1, 'E')
order by t1.deal_id, t1.date;
quit;
%let end_time = %sysfunc(datetime());
%let duration = %sysevalf(&end_time - &start_time);
%put NOTE: The query took &duration seconds to run.;
endrsubmit; Thank you for your assistance! Gabor
... View more

0
3
Howdy!
I am trying to use the PRESORTED option of PROC SORT to avoid multiple, very lengthy (~10 minutes) sorts. However, I am finding that SAS sometimes does not accept that a sorted dataset is truly sorted when also using NoDupRec.
My dataset, labs, I have already sorted by all variables. When I sort it with no options, SAS tells me it's already sorted. When I add PRESORTED, it tells me it's already sorted. But when I add PRESORTED and NoDupRec, it tells me the data is not sorted. However, the meta data does show the data sorted (of course). Does anyone know what's going on?
1125 proc sort data = labs;
1126 by _all_;
1127 run;
NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1456.12k
OS Memory 26644.00k
Timestamp 03/26/2025 10:21:41 PM
Step Count 50 Switch Count 0
1128 proc sort data = labs presorted;
1129 by _all_;
1130 run;
NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.01 seconds
memory 1456.12k
OS Memory 26644.00k
Timestamp 03/26/2025 10:21:41 PM
Step Count 51 Switch Count 0
1131 proc sort data = labs presorted noDupRec;
1132 by _all_;
1133 run;
NOTE: Input data set is not in sorted order.
When I tried a super simple example, it works fine.
1143 proc sort data = sasHelp.class out = class;
1144 by _all_;
1145 run;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: SAS sort was used.
NOTE: The data set WORK.CLASS has 19 observations and 5 variables.
NOTE: Compressing data set WORK.CLASS increased size by 100.00 percent.
Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
user cpu time 0.00 seconds
system cpu time 0.01 seconds
memory 1213.43k
OS Memory 26636.00k
Timestamp 03/26/2025 10:23:46 PM
Step Count 56 Switch Count 0
1146 proc sort data = class presorted;
1147 by _all_;
1148 run;
NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 328.28k
OS Memory 25860.00k
Timestamp 03/26/2025 10:23:46 PM
Step Count 57 Switch Count 0
1149 proc sort data = class presorted noDupRec;
1150 by _all_;
1151 run;
NOTE: Sort order of input data set has been verified.
NOTE: There were 19 observations read from the data set WORK.CLASS.
NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 328.28k
OS Memory 25860.00k
Timestamp 03/26/2025 10:23:46 PM
Step Count 58 Switch Count 0
Thanks,
Michael
... View more

0
6
Hello I am working on creating a SAS job using Proc HTTP (or any other SAS procedure) to extract token from the AWS Secret for accessing Databricks. Wondering if somebody has worked hands on it and can help? I am looking for something beyond these two references Any experience accessing AWS Secret Manager from SAS Viya 4 on EKS? - SAS Support Communities and AWS Secrets Manager - API Reference
... View more

0
2
Unanswered topics
These topics from the past 30 days have no replies. Can you help?
Subject | Likes | Author | Latest Post |
---|---|---|---|
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
2 |