BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ResoluteCarbon
Obsidian | Level 7

Hi all experts,

 

I am new to SAS from STATA. I a just wondering that in STATA, if I want to do two-way fixed effects (for example for var1 and var2), Ineed to transform these variables to numeric type by using the code

encode var2, generate(var22)
encode var1, generate(var12)

This ocde can transform from the combination of words and numbers to numeric type that we can run regression afterwards (for example, they can transform string "111AQW" to numeric 111AQW).

I am not sure whether we need to transform all variables to numeric style when running regression for the categorized variables as the regression below

proc glm data=work.have;
    class var1 var2;
    model dependentvar var3 var4 var1 var2 /solution ss3;
run;
quit;

So, in this regression, I run dependentvar on var3 and var4 and control fixed effects for var1 and var2. So whther I need to transform var1 and var2 to numeric, and is there any code to do so ?

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

You don't. Variables in the CLASS statement can be numeric or character.

View solution in original post

2 REPLIES 2
StatDave
SAS Super FREQ

You don't. Variables in the CLASS statement can be numeric or character.

PGStats
Opal | Level 21

as @StatDave said... and you must specify the model as

 

model dependentvar = var3 var4 var1 var2 / solution ss3;

PG

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 390 views
  • 2 likes
  • 3 in conversation