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

Hello

 

I am asking for help which I want to explain in the following example:

 

I have data of 100 firms for the period 2000-2008. the data includes profit and No of directors for every firm. 

 

I want to estimate a model that takes the profit data of years 2001,2003,2005,2007 directors data of the years 2000,2002,2004,2006.

 

Which functions in SAS I have to read in order to proceed with it

 

Thanks a lot!!!! 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Here is an example where I model Weight as a function of Age, only for odd ages and use the model to estimate the weight of students of even ages.

 

data regClass;
set sashelp.class;
/* Decide which ages to include in the model */
includedAge = mod(age,2);
/* Copy only included weights, other will be set to missing */
if includedAge then regWeight = weight;
run;

/* Estimate the model, output predictions for all observations */
proc reg data=regClass plots=none;
model regWeight = age;
output out=predClass p=predWeight;
run;

proc sort data=predClass; by age; run;

proc sgplot data=predClass;
scatter x=age y=weight / group=includedAge;
series x=age y=predWeight;
run;

SGPlot1.png

of course, proc reg is only one of many procedures available to build predictive models, but most procs work about the same way.

PG

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Without knowing what the data looks like its hard to say, is there a variable for year, if so then just where clause that:
where year in (2001,2003,2005,2007);

For example.  To get good answers, it a good idea to post test data, in the form of a datastep, and what the output should be.  Posting the relevant code in this instance would also illustrate it.

PGStats
Opal | Level 21

Here is an example where I model Weight as a function of Age, only for odd ages and use the model to estimate the weight of students of even ages.

 

data regClass;
set sashelp.class;
/* Decide which ages to include in the model */
includedAge = mod(age,2);
/* Copy only included weights, other will be set to missing */
if includedAge then regWeight = weight;
run;

/* Estimate the model, output predictions for all observations */
proc reg data=regClass plots=none;
model regWeight = age;
output out=predClass p=predWeight;
run;

proc sort data=predClass; by age; run;

proc sgplot data=predClass;
scatter x=age y=weight / group=includedAge;
series x=age y=predWeight;
run;

SGPlot1.png

of course, proc reg is only one of many procedures available to build predictive models, but most procs work about the same way.

PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 909 views
  • 0 likes
  • 3 in conversation