BookmarkSubscribeRSS Feed
Jahanzaib
Quartz | Level 8

I want to apply regression analysis by following way.

leverage=a+family+tangibility+market+sales+profit+e

here i want to analyze the leverage on family firms. family is a binary variable it has value 0 and 1, while other are control variables.

can anyone guide?

21 REPLIES 21
Reeza
Super User

What's your question?

 

Here's a tutorial on regression with SAS

http://www.ats.ucla.edu/stat/sas/webbooks/reg/chapter1/sasreg1.htm

 

And here are a list of topics/tutorials on SAS topcis. The first SAS course in data analysis, which includes regression is free, see the bottom right hand side of the page.

http://support.sas.com/training/tutorial/

Rick_SAS
SAS Super FREQ

I assume your question is "Wht procedure do I use?"

Try PROC LOGISTIC. The basic syntax is

 

proc logistic data=Have;

model leverage = family tangibility market sales profit;

run;

 

If any of those variable are discrete classification variables, put them on a CLASS statement, like this:

class family;

 

Jahanzaib
Quartz | Level 8

yes right.

my data also contain country name. what to add to get results for each country?

Rick_SAS
SAS Super FREQ

Reeza linked to several resources, which I hope you will find time to watch or read.  Simples questions like this are covered in the examples and in the syntax section for PROC LOGISTIC.

 

To get an analysis for each unique country name, you can sort the data by country and use the BY statement:

BY CountryName;

Jahanzaib
Quartz | Level 8

When i applied this regression

proc logistic data=have;

model bdr = fam tang MTB size prof;
class fam;
by count;

run;

 

Than i got this error. how to handle this?

ERROR: Variable F should be either numeric or specified in the CLASS statement

 

I want to get country wise results. and fam is the dummy variable having value 0 and 1

 

Jahanzaib
Quartz | Level 8

I applied this regression

proc logistic data=have;

model bdr = fam tang MTB size prof;
class fam;
by count;

run;

 

Than i got this error. how to handle this?

ERROR: Variable Fam should be either numeric or specified in the CLASS statement

 

I want to get country wise results. and fam is the dummy variable having value 0 and 1

Reeza
Super User

What values do the variable BDR take on?

 

Please post your log, your error doesn't align with the code you've posted and we'd just be guessing at what the issue might be.

Jahanzaib
Quartz | Level 8

I have again attached the file.

Reeza
Super User

You don't need logistic regression, you need a regression model, try PROC GLM. Your dependent variable is continuous not binary, logistic regression is intended for variables that take a binary outcome. 

 

If you get errors please post your log, otherwise we can't tell where you went wrong. As I mentioned above, your error doesn't match your code. 

Jahanzaib
Quartz | Level 8

i have applied following regression everytime same error. i have pasted my log over here. please take a look. i have applied regression by putting class fam and also without putting class fam, both time same error. 

 

proc glm data=d9;

model bdr = fam tang MTB size prof;
class fam;
by count;

run;

 

275 *logistic regression;
276 proc glm data=d9;
277
278 model bdr = fam tang MTB size prof;
ERROR: Variable Fam should be either numeric or specified in the CLASS statement.
NOTE: The previous statement has been deleted.
279 class fam;
280 by count;
281
282 run;

NOTE: Interactivity disabled with BY processing.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

Reeza
Super User

The log is clear. The variable FAM is a character variable but it's being included as a continuous variable. Convert it to numeric if it's a number or include it in the Class statement if it's a categorical variable. 

 

Proc glm is one of the few Procs that requires a quit at the end, in addition to the run statement. 

Jahanzaib
Quartz | Level 8

but in table i have seen fam has values 0 or 1. 

how to delete fam values if they are other than 0 or 1. 

Reeza
Super User

Run a proc contents on the dataset to see variable type. 

Run a proc freq to see what values your variable contains. 

Proc contents data=mydata;
Run;

Proc freq data= mydata;
Table FAM;
Run;

data converted;
set mydata;
fam_num = input(fam, 2.);
run;

Numbers can be stored in a character variable. 

 

Also, if it's 0/1 you can treat it as a categorical variable and include it in the Class statement. 

 

 

Jahanzaib
Quartz | Level 8

 

here is the frequency of fam. it contains value 0 and 1 but its types says that it is a character variable. i dont know how to run regression if it is so. 

Fam
Fam Frequency Percent Cumulative
Frequency
Cumulative
Percent
0 119807 94.31 119807 94.31
1 7234 5.69 127041 100.00

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 21 replies
  • 8026 views
  • 11 likes
  • 4 in conversation