using proc mixed to do SUR analysis

sas

    Sponsored Links

    Next

  • 1. datasets
    Hello, I am trying to do the following not sure if its possible I have a dataset as below a 3 1 b 2 2 c 1 3 d 2 4 I want to set a local variable to 1 if there is either a 1 or 2 in column 2. i.e. Based on this dataset temp should now equal 1 I dont want the following a 3 1 0 b 2 2 1 c 1 3 1 d 2 4 1 it should be a local variable that I will use as a parameter for another function. Another example a 3 1 b 5 2 c 6 3 d 7 4 Here temp is 0 many thanks for your help
  • 2. Running two lines of MS DOS code in SAS
    I'm trying to run stat transfer from SAS. I've tried to use the X command, but it opens a MS DOS application for each window. Is there any way to run these two lines in SAS? cd c:\program files\stattransfer9\ st w:\trees.sas7bdat w:\trees.dta
  • 3. SQL Passthru help needed please.
    I am attempting to write some code using the Oracle SQL Passthru. The code contains the following conditions: AND nvl(Date1,'01/01/1980') < sysdate AND nvl(Date2,'01/01/2090') >= sysdate; This will not run as the date stored in Oracle is in datetime format by default so SAS will not like that. Additionally I'm not certain that the nvl function can be used in passthru. Would Coalesce do the same job? Can anyone give any advice on how I could structure these conditions to allow the program to run successfully please? Thanks
  • 4. A simple question on graphics appearance
    Hi all, I have a simple question but cannot find the respective option in SAS. While preparing graphics I want to reduce the distance of the title statement to the graphics area. I would be happy if someone could give me a hint to the option to do this. Many thanks in advance, Micha

using proc mixed to do SUR analysis

Postby pacar » Tue, 24 Jan 2006 22:00:37 GMT

Hi folks:

I'm trying to run a seemingly unrelated regression using the following code
on SAS 8.2:

proc mixed;
class id time;
model rcon=time vis*time val*time /s noint;
repeated time/subject=id type AR(1) r=1,2 rcorr=1.2;
contrast 'equality of vis over time' vis*time -1 0 1, 0 -1 1;
run;

I get the following error messages:

error 22-322 expecting a qouted string
error 22-322 syntax error expecting one of the following: a name, INTERCEPT.

Can anyone tell me what is wrong with this code?  Any help is appreciated.
Thanks in advance.

F. Pinar Acar, Ph.D.
Department of Business Administration
Middle East Technical University

Re: using proc mixed to do SUR analysis

Postby stringplayer_2 » Wed, 25 Jan 2006 02:13:09 GMT




Pinar,

The only problem that I see with your code is with the
RCORR option which should be written as RCORR=1,2 rather
than RCORR=1.2.

But that has more the appearance of a typing mistake when
you posted your problem.  The error that the MIXED procedure
appears to be indicating is one of imbalanced quotation
marks.  But the quotation marks shown above are properly
balanced.  So, we need to look further.  I think you need
to post your log file showing the data step or procedure
which preceded your PROC MIXED code that failed, the PROC
MIXED code which was passed to SAS, and the NOTEs and
ERRORs generated by your MIXED code.

Dale


---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto:  XXXX@XXXXX.COM 
Ph:  (206) 667-2926
Fax: (206) 667-5977
---------------------------------------

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
 http://www.**--****.com/ 

Re: using proc mixed to do SUR analysis

Postby davidlcassell » Wed, 25 Jan 2006 14:32:21 GMT



[1] As has been pointed out, the error message is not coming from the above
code.  Either your error is in earlier code, with a missing quote causing
SAS to
*end* the quote with the first quote of the CONTRAST statement, or else
the above code is not what you ran.  So the above code doesn't help us
figure
out where the real problem lies.

[2] I don't see how this is supposed to yield SUR.  It might fit a repeated
measures
problem, but this does not look like it will address an SUR problem.  If you
don't have
SAS/ETS, I would just skip the SUR issue and fit separate OLS regressions.
You
won't lose much.

HTH,
David
_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to
get there!  http://www.**--****.com/ 

Re: using proc mixed to do SUR analysis

Postby pacar » Thu, 26 Jan 2006 18:39:55 GMT

Hi everyone,

As suggested by Dale and David I am including the log file I get when I try
to run proc mixed:

NOTE: Copyright (c) 1999-2001 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software Release 8.2 (TS2M0)
      Licensed to ORTA DOGU TEKNIK UNIV., Site 0085939001.
NOTE: This session is executing on the AIX 5.2 platform.




This message is contained in the SAS news file, and is presented upon
initialization.  Edit the files "news" in the "misc/base" directory to
display site-specific news and information in the program log.
The command line option "-nonews" will prevent this display.



NOTE: SAS initialization used:
      real time           44.71 seconds
      cpu time            0.54 seconds

1    options ls=80;
2    data dis1;
3    infile '/home504/pacar/data1.txt';
4    input time id vis val task rcon tcon sat grd gpa;

NOTE: The infile '/home504/pacar/data1.txt' is:
      File Name=/home504/pacar/data1.txt,
      Owner Name=pacar,Group Name=ba_rsc,
      Access Permission=rw-r--r--,
      File Size (bytes)=7903

NOTE: 156 records were read from the infile '/home504/pacar/data1.txt'.
      The minimum record length was 48.
      The maximum record length was 51.
NOTE: The data set WORK.DIS1 has 156 observations and 10 variables.
NOTE: DATA statement used:
      real time           37.72 seconds
      cpu time            0.12 seconds


5    proc print data=dis1;
6    run;

NOTE: There were 156 observations read from the data set WORK.DIS1.
NOTE: PROCEDURE PRINT used:
      real time           0.85 seconds
      cpu time            0.02 seconds


7    proc mixed method=ml data=dis1;
8    class id time;
NOTE: PROCEDURE MIXED used:
      real time           0.13 seconds
      cpu time            0.00 seconds

ERROR: Variable NAME not found.
NOTE: The SAS System stopped processing this step because of errors.
9    model rcon= time vis*time val*time /s noint;
10   repeated time/subject=id type=AR(1) r=1,2 rcorr=1,2;
11   contrast vis*time -1 0 1, 0 -1 1;
              ---
              22
ERROR 22-322: Expecting a quoted string.

11 ! contrast vis*time -1 0 1, 0 -1 1;
                               -
                               22
ERROR 22-322: Syntax error, expecting one of the following: a name,
INTERCEPT.
12   contrast val*time -1 0 1, 0 -1 1;
13   run;


14   proc mixed method=ml data=dis1;
15   class id time;
NOTE: PROCEDURE MIXED used:
      real time           0.00 seconds
      cpu time            0.00 seconds

ERROR: Variable NAME not found.
NOTE: The SAS System stopped processing this step because of errors.
16   model tcon= time val*time task*time /s noint;
17   repeated time/subject=id type=AR(1) r=1,2 rcorr=1,2;
18   contrast val*time -1 0 1, 0 -1 1;
              ---
              22
ERROR 22-322: Expecting a quoted string.

18 ! contrast val*time -1 0 1, 0 -1 1;
                               -
                               22
ERROR 22-322: Syntax error, expecting one of the following: a name,
INTERCEPT.
19   contrast task*time -1 0 1, 0 -1 1;
20   run;

Thank you very much for your help.

F. Pinar Acar, Ph.D.
Department of Business Administration
Middle East Technical University
Inonu Bulvari
Ankara 06531
TURKEY

Tel: 90-312-210 2052
Fax: 90-312-210 1243
E-mail:  XXXX@XXXXX.COM 
           or
            XXXX@XXXXX.COM 

Re: using proc mixed to do SUR analysis

Postby Paul.R.Swank » Thu, 26 Jan 2006 23:50:34 GMT

irst of all, in the contrast statement, SAS expected a quoted
description, such as

contrast "time 1 vs time 3" time*vis etc.

Secondly, why don't you have Vis and Val in the model statement? Having
only the interaction confounds the main effect with the interaction.


Paul R. S{*filter*}, Ph.D.
Professor, Developmental Pediatrics
Director of Research, Center for Improving the Readiness of Children for
Learning and Education (C.I.R.C.L.E.)
Medical School
UT Health Science Center at Houston

-----Original Message-----
From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ] On Behalf Of
Pinar Acar
Sent: Wednesday, January 25, 2006 3:40 AM
To: XXXX@XXXXX.COM
Subject: Re: using proc mixed to do SUR analysis

Hi everyone,

As suggested by Dale and David I am including the log file I get when I
try to run proc mixed:

NOTE: Copyright (c) 1999-2001 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software Release 8.2 (TS2M0)
Licensed to ORTA DOGU TEKNIK UNIV., Site 0085939001.
NOTE: This session is executing on the AIX 5.2 platform.




This message is contained in the SAS news file, and is presented upon
initialization. Edit the files "news" in the "misc/base" directory to
display site-specific news and information in the program log.
The command line option "-nonews" will prevent this display.



NOTE: SAS initialization used:
real time 44.71 seconds
cpu time 0.54 seconds

1 options ls=80;
2 data dis1;
3 infile '/home504/pacar/data1.txt';
4 input time id vis val task rcon tcon sat grd gpa;

NOTE: The infile '/home504/pacar/data1.txt' is:
File Name=/home504/pacar/data1.txt,
Owner Name=pacar,Group Name=ba_rsc,
Access Permission=rw-r--r--,
File Size (bytes)=7903

NOTE: 156 records were read from the infile '/home504/pacar/data1.txt'.
The minimum record length was 48.
The maximum record length was 51.
NOTE: The data set WORK.DIS1 has 156 observations and 10 variables.
NOTE: DATA statement used:
real time 37.72 seconds
cpu time 0.12 seconds


5 proc print data=dis1;
6 run;

NOTE: There were 156 observations read from the data set WORK.DIS1.
NOTE: PROCEDURE PRINT used:
real time 0.85 seconds
cpu time 0.02 seconds


7 proc mixed method=ml data=dis1;
8 class id time;
NOTE: PROCEDURE MIXED used:
real time 0.13 seconds
cpu time 0.00 seconds

ERROR: Variable NAME not found.
NOTE: The SAS System stopped processing this step because of errors.
9 model rcon= time vis*time val*time /s noint;
10 repeated time/subject=id type=AR(1) r=1,2 rcorr=1,2;
11 contrast vis*time -1 0 1, 0 -1 1;
---
22
ERROR 22-322: Expecting a quoted string.

11 ! contrast vis*time -1 0 1, 0 -1 1;
-
22
ERROR 22-322: Syntax error, expecting one of the following: a name,
INTERCEPT.
12 contrast val*time -1 0 1, 0 -1 1;
13 run;


14 proc mixed method=ml data=dis1;
15 class id time;
NOTE: PROCEDURE MIXED used:
real time 0.00 seconds
cpu time 0.00 seconds

ERROR: Variable NAME not found.
NOTE: The SAS System stopped processing this step because of errors.
16 model tcon= time val*time task*time /s noint;
17 repeated time/subject=id type=AR

Re: using proc mixed to do SUR analysis

Postby davidlcassell » Fri, 27 Jan 2006 08:04:18 GMT

I see that Dale has already solved your original problem.  So let me add to
your
woes.

[1] Why do you want SUR here?  You seem to have only 1 equation.

[2] Why did you feel that this is actually SUR?

[3] How did you expect to handle the modeling of cross-equation covariance
structures in PROC MIXED?

Feel free to write back to SAS-L and we can discuss this.  You may have
problems that you have not expressed yet.

HTH,
David
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
 http://www.**--****.com/ 

Similar Threads:

1.Issues with power analysis using PROC MIXED (long)

Greetings! (Sorr this is long...)

We are designing a longitudinal study, and have the luxury of some
pilot data available to us for planning purposes. The pilot data
suggest that there is an important effect of the predictor ( on
the outcome (. I decided to use some of the methodology described
in chapter 12 of SAS for Mixed Models to identify the minimum number
of subjects needed to detect the effect observed in the pilot data
with 80% power.  The result from that analysis was that we require
impossibly large numbers of subjects.

I found this somewhat surprising, and wanted to explore the
methodology from the book under much simpler circumstances without any
longitudinal component. Using either PROC POWER or PROC GLMPOWER for a
simple 2-sample t-test or ANOVA, we require a total of 40 subjects
(twice the pilot study sample size) to detect the observed effect.
Online calculators give the same requirement. The methods in Chap 12
of SAS for Mixed Models, however, require impossibly large sample
sizes, even for the greatly simplified example. I realize that this
sledge hammer approach would not be done in normal practice, but the
results should be the same.

I am certainly missing a crucial point. Any ideas??

**The pilot data;
data d1;
input x y;
datalines;
 0      0
 0      0
 0      0
 0      5
 0      0
 0      0
 0      5
 0      5
 0     -5
 0     -5
 0    -10
 1      5
 1      5
 1     -5
 1      0
 1     15
 1      5
 1     10
 1      0
 1      5
;
run;

** regress y on x and get type3 test output. This is directly from
section 12.2 in the book. Note that there are no random effects;

ods output tests3=t3;
proc mixed data = d1;
	model y = x ;
run;

data f_power;
	set t3;
		noncen=numDF*FValue;
		alpha=0.05;
		FCrit = finv(1-Alpha, NumDF, DenDF, 0);
		Power = 1-probF(FCrit,NumDF,DenDF,NonCen);
run;
proc print noobs data = f_power; run;
****F-statistic for predictor x is 4.32 (p=0.052) bservedpower is
about 50%;

***** data augmenting by doubling the observed data so that we have 40
subjects with same response and predictor profile as in the pilot
sample. This is also from the book p482.;
data AugD1;
	set d1;
	do i = 1 to 2;
		output;
	end;
run;

***** Compute denominator degrees of freedom with augmented data;
ods output tests3=t3Aug;
proc mixed data = AugD1;
	model y = x;
run;

********** Place ddfm from augmented data result into macrovar df;
proc sql;	select dendf into :df from t3Aug; quit;
%put &df;

******* New Power with augmented data;
ods output tests3=t3Update;
proc mixed data = d1;
	model y = x / ddf=&df.;
run;

data f_power2;
	set t3update;
		noncen=numDF*FValue;
		alpha=0.05;
		FCrit=finv(1-Alpha,NumDF, DenDF, 0);
		Power = 1-probF(FCrit,NumDF,DenDF,NonCen);
run;
proc print noobs data = f_power2; run;
****F-statistic for predictor x is still 4.32 (p=0.0445) bserved
power is only 0.52;
****The result is that with double the subjects we achieve only 52%
power to detect the pilot data effect size. You can augment the pilot
data by a factor of 20 and power is still only about 54%.;

2.UPDATE power analysis using SAS proc mixed

A little while back I posted a message about difficulties using PROC
MIXED for power analysis following chapter 12 in SAS System for Mixed
Models. I've since been in contact with Walt Stroup who identified
some errors in chapter 12. Below is a revision of code for section
12.2.

The revision uses the variance components estimates for the original
dataset in the replicate data analysis and power calculations.

title1 "Output 12.1 from the book";
ods select covparms tests3 ;
proc mixed data=mice nobound cl ;
   class cage condition diet;
   model gain= condition|diet / solution ddfm=satterth;
   random cage cage*condition;
   ods output tests3=t3 ;
run;

data f_power;
   set t3;
   Noncen = NumDF*FValue;
   Alpha  = 0.05;
   FCrit  = finv(1-Alpha,NumDF,DenDF,0);
   Power  = 1 - probf(FCrit,NumDF,DenDF,Noncen);
run;

title1 "Output 12.1 from the book (continued) ";
proc print data=f_power;
run;

data Mice1;
	set mice;
	cage = cage+6;
data mice2;
	set mice mice1;
run;

title1 "REVISED Output 12.2 from the book";
ods select tests3;
proc mixed data=mice2 nobound cl noprofile;  **** Do not profile the
likelihood for resid. variance;
   parms (5.0292) (-6.2415) (31.5567)/ noiter ;  **** use var comp
ests from original dataset;
   class cage condition diet;
   model gain=condition|diet /s ddfm=satterth;
   random cage cage*condition;
   ods output tests3 = tAug;
run;

data f_power2;
   set tAug;
   Alpha  = 0.05;
   Noncen = NumDF*FValue;
   FCrit  = finv(1-Alpha,NumDF,DenDF,0);
   Power  = 1 - probf(FCrit,NumDF,DenDF,Noncen);
run;

title1 "REVISED Output 12.3 from the book";
proc print data=f_power2;
run;

3.using proc mixed to do SUR analysis - still no improvement!

Hi all:

Although I incorporated a quoted description as suggested by Paul and
Matthew, I'm still getting error messages.  Below you can see the log
file.  Many thanks to Dale, David, Paul, and Matthew for suggestions to
improve my code.  Any help  is appreciated.

This is what I'm trying to do:

proc mixed;
class id time;
model rcon=time vis*time val*time /s noint;
repeated time/subject=id type AR(1) r=1,2 rcorr=1,2;
contrast 'equality of vis over time' vis*time -1 0 1, 0 -1 1;
run;

This the log file I get:

NOTE: SAS initialization used:
      real time           1.84 seconds
      cpu time            0.44 seconds

1    options ls=80;
2    data dis1;
3    infile '/home504/pacar/data1.txt';
4    input time idno visd vald taskd rcon tcon sat grd gpa;
5    int=rcon*tcon;
6    run;

NOTE: The infile '/home504/pacar/data1.txt' is:
      File Name=/home504/pacar/data1.txt,
      Owner Name=pacar,Group Name=ba_rsc,
      Access Permission=rw-r--r--,
      File Size (bytes)=7903

NOTE: 156 records were read from the infile '/home504/pacar/data1.txt'.
      The minimum record length was 48.
      The maximum record length was 51.
NOTE: The data set WORK.DIS1 has 156 observations and 11 variables.
NOTE: DATA statement used:
      real time           0.67 seconds
      cpu time            0.12 seconds


7    proc print data=dis1;
8    run;

NOTE: There were 156 observations read from the data set WORK.DIS1.
NOTE: PROCEDURE PRINT used:
      real time           0.15 seconds
      cpu time            0.01 seconds


9    proc mixed method=ml data=dis1;
10   title "regressing rel con on div var";
NOTE: PROCEDURE MIXED used:
      real time           0.02 seconds
      cpu time            0.00 seconds

ERROR: Variable NAME not found.
NOTE: The SAS System stopped processing this step because of errors.
11   class idno time;
12   model rcon=time visd*time vald*time/s noint;
13   repeated time/subject=idno type=ar(1) r=1,2 rcorr=1,2;
14   contrast 'equality of visd over time' visd*time -1 0 1, 0 -1 1;
                                                             -
                                                             22
ERROR 22-322: Syntax error, expecting one of the following: a name,
INTERCEPT.
15 run;

Thanks in advance.
F. Pinar Acar, Ph.D.
Department of Business Administration
Middle East Technical University

4.SUR linear restriction using Proc Syslin

Is there any economical way to apply Proc Syslin to test a linear
restriction across many models in a SUR?

I am working with CRSP financial data where each column's financial
variables are stacked by firm.  In SAS tutorials, each firm would have its
own columns of variables. However, using the 'by statement' does allow SUR
modeling without requiring the data to by rearranged side by side, as
shown in the pseudo-code below:

   proc syslin SUR;
      by firm;
      model ret = vwretd dummy;

Is there an equivalent 'by statement' that can be used with stest to
impose a linear restriction across models?  Such that the following psuedo-
code for imposing the cross-model linear restriction ('dummy' has no
impact on each firm individually),

   proc syslin SUR;
      mod001: model ret  = vwretd dummy;
      mod002: model ret  = vwretd dummy;
      [...]
      mod100: model ret  = vwretd dummy;
      progs: stest model1.dummy = model2.dummy = [...] = model3.dummy =0;

could be written without expliciting writing 100 models and 100
restrictions.

5.Using proc freq : add column after doing freq

Hi Every one,


i am doing following

proc freq data= ****;
tables a*b*e/ list out= abc;
run;


i have normal abnormal and not reported in B,
 were as i have only normal and abnormal  in E, i dont have not
reported.
here a is 1;


this is how my output  looks like




                                                                  |
Normal  |Abnormal|  Total
                                                --------------+--------
+--------+
                                                Normal
9          0              9
                                             ---------------+--------
+--------+
                                             Abnormal       |
0        3               3
                                              --------------+--------
+--------+
                                             Not Reported *
1         0              1
                                             ---------------+--------
+--------+
                                             Total
10        31            13
      in data set abc:

                                    obs  A
B                          E      COUNT    PERCENT

                                     1      1    Normal
Normal          99        75.5725
                                     2      1    Abnormal
Abnormal      31        23.6641
                                     3      1    Not Reported *
Normal         1          0.7634




How do i add not reported in E so my o/p looks like


                                                                  |
Normal  |Abnormal|  not reported  Total
                                                --------------+--------
+--------+
                                                Normal
9          0                0               9
                                             ---------------+--------
+--------+
                                             Abnormal       |
0        3                0                3
                                              --------------+--------
+--------+
                                             Not Reported *
1         0               0                  1
                                             ---------------+--------
+--------+
                                             Total
10        31               0            13



Thanks,
Raghu



6. Fw: Cost analyses using PROC GENMOD using link=log and dist=gamma

7. Cost analyses using PROC GENMOD using link=log and dist=gamma

8. proc mianalyze the random effect of null model using proc mixed



Return to sas

 

Who is online

Users browsing this forum: No registered users and 64 guest