Hi SAS Experts,
I have a dataset "merge_sample" as attached, I also cut a part of this dataset to describe here
TYPE	ENAME	                                    FIR_AGE       	wCCC	        wFIRM_SIZE	    wTOT_ASS  yr	pt
13016K	MOQ	                                        3.0445224377	6.0832021588	9.1344307779	9269	  2002	0
13016K	MOQ	                                        3.0445224377	22.363947386	9.0773802447	8755	  2004	1
13016K	MOQ	                                        3.0445224377	27.229342948	8.6550402581	5739	  2005	1
13016K	MOQ	                                        3.0445224377	21.777987591	7.8651879542	2605	  2007	1
13016K	MOQ	                                        3.0445224377	15.885944401	8.7225800211	6140	  2008	1
130769	SUB-SAHARA RESOURCES DEAD - DELIST.18/12/09	3.295836866	   -257.1999113	    7.9669334984	2884	  2001	0
130769	SUB-SAHARA RESOURCES DEAD - DELIST.18/12/09	3.295836866	   -257.1999113	    7.8943180638	2682	  2002	0TYPE, ENAME: character variables while the rest are numeric variables.
I want to run a regression where:
dependent variable: wTOT_ASS
independent variables: FIR_AGE, wFIRM_SIZE, pt
Controlled for fixed effect: TYPE and yr.
Can you please give me a hint to sort it out?
Many thanks and warmest regards.
proc glm data=merge_sample;
    class type yr;
    model wtot_ass = fir_age wfirm_size pt type yr/solution ss3;
run;proc glm data=merge_sample;
    class type yr;
    model wtot_ass = fir_age wfirm_size pt type yr/solution ss3;
run;Hi @PaigeMiller
Thank you for your helps.
Can I ask why I follow the sas document , the said that
So, if ss3 is displayed by default, why we need to call it out in the code as above?
Many thanks and warm regards.
When you request SS3, the PROC does not show you the SS1 (Type 1 sum of squares) which is probably meaningless with this data. If you leave SS3 out, then you get an output which contains both SS3 and SS1.
Hi @PaigeMiller
Thank you very much for your explanation, I follow this document about running fixed effect in SAS.
Simplistically speaking, their way of running fixed effect is quite similar to yours, but I found two points a little bit confusing to me:
First, so there is no delimiter or else to separate between identifier and indvars in the code below?
model depvar = indvars identifier / solution; run;And second, why they have the quit statement at the end but your?
Many thanks and warm regards.
Yes, you need a QUIT; at the end of PROC GLM, that was my mistake.
I'm not sure what your other question is, regarding using ABSORB or not.
Hi @PaigeMiller !
Thank you for your prompt reply.
Sorry for confusing you. I mean, in my case, I have two fixed effects ( by type and by year), so I am wondering if SAS misunderstand that one of these two dimensions is independent variables
proc glm data=merge_sample;
    class type yr;
    model wtot_ass = fir_age wfirm_size pt type yr/solution ss3;
run;Many thanks in advance!
The MODEL statement considers anything to the left of the equal sign to be the response variable. Anything to the right of the equal sign (and before the / indicating options) are independent variables (which could be CLASS or not CLASS variables).
Hi @PaigeMiller
Thank you, I see what you mean, sorry for confusing you again, what I mean is, comparing to the code
I am wondering that in your code, SAS is able to recognize that on the third line of your code that "type" and "yr" are identifiers or SAS just recognize that "yr" is identifier.
proc glm data=merge_sample;
    class type yr;
    model wtot_ass = fir_age wfirm_size pt type yr/solution ss3;
run;
quit;/*added line*/Many thanks in advance.
Hi @PaigeMiller
And can I ask, this regression will return the Intercept as well, is there any way to run the regression without the intercept?
Can I use?
noint
Many thanks
@Phil_NZ wrote:
Hi @PaigeMiller
And can I ask, this regression will return the Intercept as well, is there any way to run the regression without the intercept?
Can I use?
noint
I suggest you try it and find out. I also recommend not using NOINT when computing regressions, as this is appropriate only in very rare situations..
@Phil_NZ wrote:
Hi @PaigeMiller
And second, why they have the quit statement at the end but your?
Generic response for why to use "quit" to end a procedure. There are a number of procedures that run interactively and allow you to add additional statements. In the regression world that would mean typically additional Model statements or other output generating options. In effect that let's you look at part of the analysis and pick choices based on what you see and the procedure doesn't always have to reload the data. The term SAS will use for these procedures are "run groups": a number statements you provide and the procedure generates output when a Run; is encountered. So Quit is needed with the procedure to tell SAS you done with the data and can do it's internal clean up of temporary files and such.
Proc Reg and GLM are only a few. Here is an example with Proc Reg you could play with:
proc reg data=sashelp.class; var Age; model Weight = Height; run; model Weight = Height Age; run;
you can execute code through the first "run" and examine the results. Then highlight and run the second model and run statement. If you wanted you could even do something like:
Model age = height; run;
not likely meaningful but any dependent with other numeric independent variables until you execute a Quit.
Other procedures such as Proc Datasets, Proc Gmap and many of the SAS/Graph procedures also support run groups. Proc SQL also uses quit and "run" will generate warnings. These procedures will show a "running" status until a Quit statment is executed or a procedure boundary is encountered.
A dedicated and comprehensive explanation, @ballardw
Warmest regards!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
