Help using Base SAS procedures

PROC REG: adding 2 Dummy Variables

Accepted Solution Solved
Reply
Contributor
Posts: 24
Accepted Solution

PROC REG: adding 2 Dummy Variables

Hi guys,

I have a muiltiple regression model with 2 dummy variables.  The qualitative variables in my data looks like this:

BroadSector
10
10
00
01
00

Each observation can belong to either the Broad category, Sector category, or neither.  This would require me to have 2 dummy variables.  How can I add these dummies to my model which looks like this so far:

PROC REG data=GH3 outest=est;

by symbol;

model ADV = Volume Volatility MarketCap;

(need to add my dummies to this model)

run;

quit;

data FINAL;
set est;
format Volume Volatility MarketCap e15.;
run;


proc print data = FINAL;
run;
quit;

-------------

Thanks in advance,

Razzle


Accepted Solutions
Solution
‎03-14-2013 06:55 PM
Super Contributor
Posts: 578

Re: PROC REG: adding 2 Dummy Variables

I think that most of the dummy variables are added to the input dataset.  If you don't want to recreate the data, you can create a view which has the dummy variables in it.

proc sql;

create view work.gh3_view as

select

t1.*

,case when t1.category='Broad' then 1 else 0 end as Broad

,case when t1.category='Sector' then 1 else 0 end as Sector

from work.gh3;

quit;

and then use that as the input data to your proc.

View solution in original post


All Replies
Solution
‎03-14-2013 06:55 PM
Super Contributor
Posts: 578

Re: PROC REG: adding 2 Dummy Variables

I think that most of the dummy variables are added to the input dataset.  If you don't want to recreate the data, you can create a view which has the dummy variables in it.

proc sql;

create view work.gh3_view as

select

t1.*

,case when t1.category='Broad' then 1 else 0 end as Broad

,case when t1.category='Sector' then 1 else 0 end as Sector

from work.gh3;

quit;

and then use that as the input data to your proc.

Contributor
Posts: 24

Re: PROC REG: adding 2 Dummy Variables

Thanks a lot.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 183 views
  • 0 likes
  • 2 in conversation