Programming the statistical procedures from SAS

Regression

Reply
Contributor
Posts: 72

Regression

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?

Super User
Posts: 18,568

Re: Regression

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/

SAS Super FREQ
Posts: 3,547

Re: Regression

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;

 

Contributor
Posts: 72

Re: Regression

yes right.

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

SAS Super FREQ
Posts: 3,547

Re: Regression

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;

Contributor
Posts: 72

Re: Regression

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

 

Contributor
Posts: 72

Regression

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

Super User
Posts: 18,568

Re: Regression

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.

Contributor
Posts: 72

Re: Regression

I have again attached the file.

Super User
Posts: 18,568

Re: Regression

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. 

Contributor
Posts: 72

Re: Regression

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

Super User
Posts: 18,568

Re: Regression

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. 

Contributor
Posts: 72

Re: Regression

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. 

Super User
Posts: 18,568

Re: Regression

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. 

 

 

Contributor
Posts: 72

Re: Regression

 

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
Ask a Question
Discussion stats
  • 18 replies
  • 813 views
  • 9 likes
  • 3 in conversation