Thanks PG, I tried it but I got this error:
74 proc glm data=a;
75 where type="cash";
ERROR: WHERE clause operator requires compatible variables.
76 class ConsiStr year Industry;
77 model Acar1 = year / noint;
78 run;
WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
79 QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds
Shall I run the PROC GLMMOD before my PROC GLM statements?
The message "WHERE clause operator requires compatible variables" means that type must be numeric and "cash" is only the formatted representation of its value. You must either replace "cash" with a number or change the where condition to
where put(type, yourTypeFormat.) = "cash";
Sorry I made a mistake. In my data base "type" is numeric: 1for horizental deals, 2 for vertical and 3 for conglomerate.(so there is no horizental, vertical, conglomerate under type variable only 1 and 2 and3. "ConsiStr" is a character variable: Cash, stock, hybrid, unknown.
I changed the statements to:
proc glm data=a;
where type="3";
class ConsiStr year Industry;
model Acar1 = year / noint;
run;
QUIT;
proc glm data=a;
where put (ConsiStr,$char6.)="cash";
class ConsiStr type year Industry;
model Acar1 = ConsiStr / noint;
run;
QUIT;
and the error is still:
46 proc glm data=a;
147 where type="3";
ERROR: WHERE clause operator requires compatible variables.
148 class ConsiStr year Industry;
149 model Acar1 = year / noint;
150 run;
WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
151 QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
152 proc glm data=a;
153 where put (ConsiStr,$char6.)="cash";
154 class ConsiStr type year Industry;
155 model Acar1 = ConsiStr / noint;
156 run;
NOTE: No observations were selected from data set WORK.A.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
157 QUIT;
thanks,
Niloo
So, I guess the condition should be
where ConsiStr = "cash";
/* or */
where ConsiStr = "Cash";
/* or, to play safe */
where UPCASE(ConsiStr) = "CASH";
Thank you soooooo much PG it worked. i used the third one.
However the type variable still gives me errors:
proc glm data=a;
where UPCASE(type)="3";
class type ConsiStr year Industry;
model Acar1 = year / noint;
run;
QUIT;
error:
182 proc glm data=a;
183 where UPCASE(type)="3";
ERROR: Function UPCASE requires a character expression as argument 1.
184 class type ConsiStr year Industry;
185 model Acar1 = year / noint;
186 run;
WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
187 QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
type is numeric, so you need
where type = 3;
Thak you very much. It works perfectly now.
Hi again,
I used the following statements to first define dummy variables and then run a "proc reg" :
libname ev 'C:\Regression';
run;
***Majority All data set- Regression for Acquirors, CAR (-1, +1), announcment date ********/;
data final2;
set ev.final2(keep= tdscd ADSCD Aname Tname AnDate Wdate Acar1 Acar5 Tcar1 Tcar5 TobinQ ADebtratio DEBTRT HOSTATASS AMVal4wp TMVal4wp
EqValAn EnValAn ConsiStr TNation type AEQW);
proc sort;
by adscd andate;
run;
data a;
set ev.final2;
if amval4wp ne 0 and amval4wp ne . then
ratio=tmval4wp/amval4wp;
lnTEq=log(EqValAn);
lnTEn=log(EnValAn);
lnTMV=log(TMVal4wp);
lnAMV=log(amval4wp);
lnSIZE=log(HOSTATASS);
year = year(Andate);
Industry= AMaCode;
run;
proc glmmod data=a outdesign=b outparm=parm;
class ConsiStr type Industry year;
model Acar1 = ratio lnTEn lnSIZE TobinQ ADebtratio DEBTRT ConsiStr type year Industry AEQW / noint;
run;
proc print data=parm; run;
/* If you want, rename the variables created by GLMMOD */
data c;
set b;
rename col1=ratio col2=lnTEn col3=lnSIZE col4=TobinQ col5=ADebtratio col6=DEBTRT col7=Cash col8=HYBRID col9=OTHER col10=SHARES
col11=UNKNOWN col12=Horizental col13=Vertical col14=Conglomerate col15=zero col16=one col17=two col18=three col19=four col20=five
col21=six col22=seven col23=eight col24=nine col25=ten col26=eleven col27=twelve col28=thirteen col29=fourteen col30=CPS col31=ENERGY
col32=FINANCE col33=HEALTH col34=HT col35=IND col36=MATERLS col37=REALEST col38=RETAIL col39=STAPLES col40=TELECOM col41=AEQW;
run;
proc reg data=c;
model Acar1 = ratio lnTEn lnSIZE TobinQ ADebtratio DEBTRT Cash HYBRID OTHER SHARES UNKNOWN Horizental Vertical Conglomerate zero one
two three four five six seven eight nine ten eleven twelve thirteen fourteen CPS ENERGY FINANCE HEALTH HT IND MATERLS REALEST RETAIL
STAPLES TELECOM AEQW;
run;
But I get the following notes in my results viewer :
Note: | Model is not full rank. Least-squares solutions for the parameters are not unique. Some statistics will be misleading. A reported DF of 0 or B means that the estimate is biased. |
Note: | The following parameters have been set to 0, since the variables are a linear combination of other variables as shown. |
UNKNOWN = | Intercept - Cash - HYBRID - OTHER - SHARES |
---|---|
Conglomerate = | Intercept - Horizental - Vertical |
fourteen = | Intercept - zero - one - two - three - four - five - six - seven - eight - nine - ten - eleven - twelve - thirteen |
TELECOM = | Intercept - CPS - ENERGY - FINANCE - HEALTH - HT - IND - MATERLS - REALEST - RETAIL - STAPLES |
Parameter Estimates | ||||||
---|---|---|---|---|---|---|
Variable | Label | DF | Parameter Estimate |
Standard Error |
t Value | Pr > |t| |
Intercept | Intercept | B | 0.04524 | 0.10627 | 0.43 | 0.6721 |
ratio | ratio | 1 | 0.08509 | 0.03495 | 2.44 | 0.0184 |
lnTEn | lnTEn | 1 | -0.00575 | 0.00582 | -0.99 | 0.3281 |
lnSIZE | lnSIZE | 1 | -0.00398 | 0.00624 | -0.64 | 0.5269 |
TobinQ | TobinQ | 1 | 0.00001882 | 0.00003795 | 0.50 | 0.6220 |
ADebtratio | ADebtratio | 1 | 2.35285 | 3.60842 | 0.65 | 0.5172 |
DEBTRT | DEBTRT | 1 | -0.02118 | 0.02589 | -0.82 | 0.4170 |
Cash | ConsiStr CASHO | B | 0.00063236 | 0.03488 | 0.02 | 0.9856 |
HYBRID | ConsiStr HYBRID | B | 0.02644 | 0.04301 | 0.61 | 0.5414 |
OTHER | ConsiStr OTHER | B | 0.03852 | 0.05761 | 0.67 | 0.5067 |
SHARES | ConsiStr SHARES | B | 0.02220 | 0.03162 | 0.70 | 0.4857 |
UNKNOWN | ConsiStr UNKNOWN | 0 | 0 | . | . | . |
Horizental | Type 1 | B | -0.00760 | 0.01355 | -0.56 | 0.5775 |
Vertical | Type 2 | B | 0.01477 | 0.01575 | 0.94 | 0.3527 |
Conglomerate | Type 3 | 0 | 0 | . | . | . |
zero | year 2000 | B | 0.04037 | 0.03713 | 1.09 | 0.2819 |
one | year 2001 | B | 0.09816 | 0.03612 | 2.72 | 0.0089 |
two | year 2002 | B | 0.08024 | 0.03817 | 2.10 | 0.0404 |
three | year 2003 | B | 0.01385 | 0.03398 | 0.41 | 0.6853 |
four | year 2004 | B | 0.04770 | 0.03453 | 1.38 | 0.1731 |
five | year 2005 | B | 0.02025 | 0.03139 | 0.65 | 0.5217 |
six | year 2006 | B | 0.02535 | 0.02826 | 0.90 | 0.3738 |
seven | year 2007 | B | 0.00789 | 0.03068 | 0.26 | 0.7980 |
eight | year 2008 | B | 0.08945 | 0.03590 | 2.49 | 0.0159 |
nine | year 2009 | B | 0.04158 | 0.03096 | 1.34 | 0.1852 |
ten | year 2010 | B | -0.00238 | 0.04236 | -0.06 | 0.9553 |
eleven | year 2011 | B | 0.04103 | 0.03513 | 1.17 | 0.2482 |
twelve | year 2012 | B | 0.05978 | 0.03336 | 1.79 | 0.0789 |
thirteen | year 2013 | B | 0.04555 | 0.04313 | 1.06 | 0.2958 |
fourteen | year 2014 | 0 | 0 | . | . | . |
CPS | Industry CPS | B | 0.00974 | 0.05062 | 0.19 | 0.8481 |
ENERGY | Industry ENERGY | B | 0.07491 | 0.06755 | 1.11 | 0.2725 |
FINANCE | Industry FINANCE | B | 0.03148 | 0.05087 | 0.62 | 0.5388 |
HEALTH | Industry HEALTH | B | -0.01152 | 0.05331 | -0.22 | 0.8298 |
HT | Industry HT | B | 0.02942 | 0.05232 | 0.56 | 0.5763 |
IND | Industry IND | B | 0.00880 | 0.05026 | 0.18 | 0.8616 |
MATERLS | Industry MATERLS | B | 0.03385 | 0.05001 | 0.68 | 0.5015 |
REALEST | Industry REALEST | B | 0.01833 | 0.05719 | 0.32 | 0.7499 |
RETAIL | Industry RETAIL | B | 0.02712 | 0.05067 | 0.54 | 0.5947 |
STAPLES | Industry STAPLES | B | 0.05081 | 0.05409 | 0.94 | 0.3519 |
TELECOM | Industry TELECOM | 0 | 0 | . | . | . |
AEQW | AEQW | 1 | 0.00003368 | 0.00018967 | 0.18 | 0.8598 |
Is this an example of exact multicolinearity? Could you please let me know how I can create dummy variables and then run a proc reg on all variables?It seems that all my results are biased.
Thank you,
Niloo
Assuming you have a good reason to use proc reg instead of proc glm...
From the list of colinear variable equations, you can see that removing the intercept term will prevent all four cases of colinearity. Try adding option /noint to your proc reg model statement.
Hi PG,
I have used proc glm on the same set of data successfully but my professor insists that I also run a proc reg.
I changed my statements to:
proc reg data=c;
model Acar1 = ratio lnTEn lnSIZE TobinQ ADebtratio DEBTRT Cash HYBRID OTHER SHARES UNKNOWN Horizontal Vertical Conglomerate zero one
two three four five six seven eight nine ten eleven twelve thirteen fourteen CPS ENERGY FINANCE HEALTH HT IND MATERLS REALEST RETAIL
STAPLES TELECOM AEQW/noint;
run;
But I still get the notes:
Note: | Model is not full rank. Least-squares solutions for the parameters are not unique. Some statistics will be misleading. A reported DF of 0 or B means that the estimate is biased. |
Note: | The following parameters have been set to 0, since the variables are a linear combination of other variables as shown. |
Conglomerate = | Cash + HYBRID + OTHER + SHARES + UNKNOWN - Horizontal - Vertical |
---|---|
fourteen = | Cash + HYBRID + OTHER + SHARES + UNKNOWN - zero - one - two - three - four - five - six - seven - eight - nine - ten - eleven - twelve - thirteen |
TELECOM = | Cash + HYBRID + OTHER + SHARES + UNKNOWN - CPS - ENERGY - FINANCE - HEALTH - HT - IND - MATERLS - REALEST - RETAIL - STAPLES |
Parameter Estimates | ||||||
---|---|---|---|---|---|---|
Variable | Label | DF | Parameter Estimate |
Standard Error |
t Value | Pr > |t| |
ratio | ratio | 1 | 0.08509 | 0.03495 | 2.44 | 0.0184 |
lnTEn | lnTEn | 1 | -0.00575 | 0.00582 | -0.99 | 0.3281 |
lnSIZE | lnSIZE | 1 | -0.00398 | 0.00624 | -0.64 | 0.5269 |
TobinQ | TobinQ | 1 | 0.00001882 | 0.00003795 | 0.50 | 0.6220 |
ADebtratio | ADebtratio | 1 | 2.35285 | 3.60842 | 0.65 | 0.5172 |
DEBTRT | DEBTRT | 1 | -0.02118 | 0.02589 | -0.82 | 0.4170 |
Cash | ConsiStr CASHO | B | 0.04587 | 0.09930 | 0.46 | 0.6461 |
HYBRID | ConsiStr HYBRID | B | 0.07168 | 0.10062 | 0.71 | 0.4794 |
OTHER | ConsiStr OTHER | B | 0.08375 | 0.10428 | 0.80 | 0.4256 |
SHARES | ConsiStr SHARES | B | 0.06744 | 0.09908 | 0.68 | 0.4991 |
UNKNOWN | ConsiStr UNKNOWN | B | 0.04524 | 0.10627 | 0.43 | 0.6721 |
Horizontal | Type 1 | B | -0.00760 | 0.01355 | -0.56 | 0.5775 |
Vertical | Type 2 | B | 0.01477 | 0.01575 | 0.94 | 0.3527 |
Conglomerate | Type 3 | 0 | 0 | . | . | . |
zero | year 2000 | B | 0.04037 | 0.03713 | 1.09 | 0.2819 |
one | year 2001 | B | 0.09816 | 0.03612 | 2.72 | 0.0089 |
two | year 2002 | B | 0.08024 | 0.03817 | 2.10 | 0.0404 |
three | year 2003 | B | 0.01385 | 0.03398 | 0.41 | 0.6853 |
four | year 2004 | B | 0.04770 | 0.03453 | 1.38 | 0.1731 |
five | year 2005 | B | 0.02025 | 0.03139 | 0.65 | 0.5217 |
six | year 2006 | B | 0.02535 | 0.02826 | 0.90 | 0.3738 |
seven | year 2007 | B | 0.00789 | 0.03068 | 0.26 | 0.7980 |
eight | year 2008 | B | 0.08945 | 0.03590 | 2.49 | 0.0159 |
nine | year 2009 | B | 0.04158 | 0.03096 | 1.34 | 0.1852 |
ten | year 2010 | B | -0.00238 | 0.04236 | -0.06 | 0.9553 |
eleven | year 2011 | B | 0.04103 | 0.03513 | 1.17 | 0.2482 |
twelve | year 2012 | B | 0.05978 | 0.03336 | 1.79 | 0.0789 |
thirteen | year 2013 | B | 0.04555 | 0.04313 | 1.06 | 0.2958 |
fourteen | year 2014 | 0 | 0 | . | . | . |
CPS | Industry CPS | B | 0.00974 | 0.05062 | 0.19 | 0.8481 |
ENERGY | Industry ENERGY | B | 0.07491 | 0.06755 | 1.11 | 0.2725 |
FINANCE | Industry FINANCE | B | 0.03148 | 0.05087 | 0.62 | 0.5388 |
HEALTH | Industry HEALTH | B | -0.01152 | 0.05331 | -0.22 | 0.8298 |
HT | Industry HT | B | 0.02942 | 0.05232 | 0.56 | 0.5763 |
IND | Industry IND | B | 0.00880 | 0.05026 | 0.18 | 0.8616 |
MATERLS | Industry MATERLS | B | 0.03385 | 0.05001 | 0.68 | 0.5015 |
REALEST | Industry REALEST | B | 0.01833 | 0.05719 | 0.32 | 0.7499 |
RETAIL | Industry RETAIL | B | 0.02712 | 0.05067 | 0.54 | 0.5947 |
STAPLES | Industry STAPLES | B | 0.05081 | 0.05409 | 0.94 | 0.3519 |
TELECOM | Industry TELECOM | 0 | 0 | . | . | . |
AEQW | AEQW | 1 | 0.00003368 | 0.00018967 | 0.18 | 0.8598 |
Thanks,
Niloo
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.