MACRO erro _ Proc Glimmix

Reply
Frequent Contributor
Posts: 103

MACRO erro _ Proc Glimmix

[ Edited ]

Good evening:

 

I tried to compile  this MACRO and i could not finish it:

 

data have;
input ANIMAL SIRE trait1 trait2 trait3 WEIGH_AT_BIRTH  ;
cards;
    2818     851     118       1       1    10.3
    2819     851     118       1       1     9.8
    2820     851     118       1       1     9.2
    2821     851     118       1       1    10.4
    2822     851     118       1       1     9.2
    2823     851     118       1       1    10.9
    2824     851     118       1       1     9.3
    2825     851     118       1       2    10.2
    2826     851     118       1       2    10.2
    2827     851     118       1       2      10
    2828     851     118       1       2     8.3
    2829     851     118       1       2     9.2
    2830     851     118       1       2       9
    2831     851     118       1       2     8.5
    2835     851     118       2       1      10
    2836     851     118       2       1     9.1
    2837     851     118       2       1     8.1
    2838     851     118       2       1     9.3
    2839     851     118       2       1      10
    2840     852     118       2       1     9.2
    2841     852     118       2       1     9.6
    2842     852     118       2       1     8.2
    2843     852     118       2       2     8.2
    2844     852     118       2       2      10
    2845     852     118       2       2     8.3
    2852     852     119       1       1     9.4
    2853     852     119       1       1    10.5
    2854     852     119       1       1    11.3
    2855     852     119       1       1    10.6
    2856     852     119       1       1       9
    2857     852     119       1       1    10.5
    2858     852     119       1       1      10
    2859     852     119       1       1    10.2
    2860     852     119       1       1    10.4
    2861     852     119       1       1    10.3
    2862     852     119       1       1      10
    2863     852     119       1       1    10.3
    2864     852     119       1       2    11.2
    2865     852     119       1       2     9.4
    2866     852     119       1       2      10
    2867     852     119       1       2    11.2
    2868     852     119       1       2    11.4
    2869     852     119       1       2      11
    2870     852     119       1       2      11
    2871     852     119       1       2     9.4
    2872     852     119       1       2    12.3
    2873     852     119       1       2     8.7
    2877     852     119       2       1      10
    2878     852     119       2       1     9.2
;

/*save estimates*/
%macro mymixed1(all_indeps, outest);
  %let k=1;
  %let indeps = %scan(&all_indeps, &k);
  %do %while("&indeps" NE "");
    title "independent variable is &indeps";
    proc glimmix data=have outest = _est&k;
      model WEIGH_AT_BIRTH = &indeps;
    run;
    %let k = %eval(&k + 1);
    %let indeps = %scan(&all_indeps, &k);
  %end;

  %if "&outest" NE "" %then
  %do;
    data &outest;
      set
      %do i = 1 %to &k - 1;
        _est&i
      %end;
      ;
    run;
 
    %let k = %eval(&k - 1);
    proc datasets;
      delete _est1 - _est&k;
    run;
  %end;
  %else
  %do;
    %put no dataset name was provided, files are not combined;
  %end;
%mend;

%mymixed1(trait1)

 

The log is here:

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 %mymixed1(trait1)
MLOGIC(MYMIXED1): Beginning execution.
MLOGIC(MYMIXED1): Parameter ALL_INDEPS has value trait1
MLOGIC(MYMIXED1): Parameter OUTEST has value
MLOGIC(MYMIXED1): %LET (variable name is K)
MLOGIC(MYMIXED1): %LET (variable name is INDEPS)
MLOGIC(MYMIXED1): %DO %WHILE("&indeps" NE "") loop beginning; condition is TRUE.
MPRINT(MYMIXED1): title "independent variable is trait1";
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ABS, ABSOLUTE, ALPHA, ANOVAF, ASYCORR, ASYCOV, BOXPLOT, CL,
CONVF, CONVG, CONVH, COVTEST, DATA, DFBW, EMPIRICAL, HUBER, IC, INFO, ITDETAILS, LOGNOTE, MAXFUNC, MAXITER, MAXTIME,
METHOD, MMEQ, MMEQSOL, NAMELEN, NOBOUND, NOCLPRINT, NOINFO, NOITPRINT, NOPROFILE, ORD, ORDER, PLOT, PLOTS, RANKS,
RATIO, RIDGE, SANDWICH, SCORING, UPDATE.
202: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
MPRINT(MYMIXED1): proc mixed data=have outest = _est1;
WARNING 10-155: Ignoring second data set reference.
NOTE 14-205: The SAS System stopped processing this step because of errors.
MPRINT(MYMIXED1): model WEIGH_AT_BIRTH = trait1;
MPRINT(MYMIXED1): run;
MLOGIC(MYMIXED1): %LET (variable name is K)
MLOGIC(MYMIXED1): %LET (variable name is INDEPS)
MLOGIC(MYMIXED1): %DO %WHILE() condition is FALSE; loop will not iterate again.
MLOGIC(MYMIXED1): %IF condition "&outest" NE "" is FALSE
MLOGIC(MYMIXED1): %PUT no dataset name was provided, files are not combined
no dataset name was provided, files are not combined
MLOGIC(MYMIXED1): Ending execution.
57
58
59 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
71
Respected Advisor
Posts: 3,776

Re: MACRO erro _ Proc mixed

Would it be easier to transpose the independent variables and use BY TRAIT;

 

proc transpose data=have out=havet name=trait prefix=Ind;
   by ANIMAL SIRE WEIGH_AT_BIRTH;
   var trait:;
   run;
proc sort data=havet;
   by trait;
   run;
options byline=1;
proc reg data=havet outest=est;
   by trait;
   model WEIGH_AT_BIRTH = ind1;
   run;
proc print;
   run;
Frequent Contributor
Posts: 103

Re: MACRO erro _ Proc mixed

Thanks for your contribution, but what i am looking for goes further, i will use the answer, as multivariate, to choose models.

Thanks a lot, its a nice idea of yours
Super User
Super User
Posts: 6,389

Re: MACRO erro _ Proc mixed

That is not a macro problem.  You have just not written valid PROC MIXED code. There is no OUTEST option on the PROC MIXED statement.

Frequent Contributor
Posts: 103

Re: MACRO erro _ Proc mixed

Dear Tom good night:

 

You are ok, i assume this, and will change de mixed procedure for GLIMMIX

 

Thanks for your answer

Ask a Question
Discussion stats
  • 4 replies
  • 306 views
  • 1 like
  • 3 in conversation