BookmarkSubscribeRSS Feed
pmorel3
Obsidian | Level 7

For my 5 funds (f1 ... f5), I would like to compare 2 series of intercepts relating to my 2 models MFS1 and MPM10.

The codes work very well. This was what blocked me before but I succeeded.

 

However, imagine that we have 100 funds, how could I do this proc univariate test on delta1 (see the last 3 lines) for each of the funds and find out the percentage of funds for which the null hypothesis is rejected (Ho: delta1 = 0)?

 

Could you please help me? Someone told me that it is possible to do this with Proc model by specifying all my regressions parameters (a, b, c, etc.) but I can't do it yet. Thanks a lot !

 

/***MFS1 obtenir les coeff de MFS1 dans une seule base de données pour les 5 fonds***/

data work.model;
   set test;
   array f f1-f5;
   do i=1 to dim(f);
      label=vname(f[i]);
      value=f[i];
      output;
   end;
   keep rm zdy ztbl ztms zdfy rmrsq rm_zdy rm_ztbl rm_ztms rm_zdfy pred_mean rm_pred_mean label value;
run;

proc sort data=work.model;
   by label;
run;

proc reg data=work.model
      outest=work.estMFS1
     ;
   by label;
   model value=rm rm_zdy rm_ztbl rm_ztms rm_zdfy;
run;
quit;
      

/***MPM10 obtenir les coeff de MPM10 dans une seule base de données pour les 5 fonds***/

data work.model;
   set test;
   array f f1-f5;
   do i=1 to dim(f);
      label=vname(f[i]);
      value=f[i];
      output;
   end;
   keep rm zdy ztbl ztms zdfy rmrsq rm_zdy rm_ztbl rm_ztms rm_zdfy pred_mean rm_pred_mean label value;
run;

proc sort data=work.model;
   by label;
run;

proc reg data=work.model
      outest=work.estMPM10
     ;
   by label;
   model value=rm rm_pred_mean;
run;
quit;

/*comparaison MFS1 et MPM10*/

PROC SQL;
	CREATE TABLE comp_MFS1_MPM10 as
	SELECT a.label, a.intercept AS estMFS1,  b.intercept AS estMPM10,
    a.intercept as int_MFS1,
    b.intercept as int_MPM10
	from work.estMFS1 as a INNER JOIN work.estMPM10 as b
	on a.label=b.label;
QUIT;
 RUN;

data comp_MFS1_MPM10;
   set comp_MFS1_MPM10;
   delta1=int_MFS1-int_MPM10;
run;


  proc print data=comp_MFS1_MPM10;
 run;

   proc univariate data=comp_MFS1_MPM10;
	  var delta1;
	run;
3 REPLIES 3
PaigeMiller
Diamond | Level 26

So you do a PROC REG with

 

outest=work.estMFS1

and after that, I'm not following you. If you want the percentage of funds for which the null hypothesis is rejected, you could use this output data set and count the number of times the p values is <0.05. Isn't that what you are trying to compute?

--
Paige Miller
pmorel3
Obsidian | Level 7

That's right if I have only 5 funds. I can easily count the number of times the p values is <0.05.

 

But if i deal with 100 or 1000 funds and I don't want to count it "by hand", is there a way to compute a proportion ?

PaigeMiller
Diamond | Level 26

SAS can do the counting for you. There are many ways: PROC FREQ, PROC SUMMARY, etc.

 

ods output parameterestimates = paramest;
proc reg;
 ...
run;
quit;

proc format;
    value intf low-0.05='Significant' other='Not Significant';
run;

proc freq data=paramest(where=(variable='Intercept'));
    tables probt;
    format probt intf.;
run;
--
Paige Miller

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!

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.

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
  • 3 replies
  • 371 views
  • 0 likes
  • 2 in conversation