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

Hello SAS experts,

 

I am a beginniner in SAS and need some help in performing multivaite analysis using SAS macro.

I have an unbalanced panel data by country (50 countries, sample period 2010-2014) as attached and each country has a number of banks by year. 

I would like to run a multivariate regression by country as follows and have an output of coefficient estimates, standard errors, t-value, adjusted R square and N by country from each regression. 

 

proc reg

model price = gain cashflow CPI

  

But I hope to find a more efficient way of performing analyses that allows running iterative regressions by country instead of running 50 times of regressions and put together each regressions restuls 50 times. 

 

I greatly appreciate your help with this matter.

 

Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Check the ODS Table Names section of the Details tab in the proc reg documentation. The procedure options that must be specified to get each ODS table are listed there.

PG

View solution in original post

8 REPLIES 8
Reeza
Super User

Have you looked at BY group processing -

 

proc sort data=sashelp.class out=class; by sex;
run;

proc reg data=class;
by sex;
model weight = height age;
run;
easygoing
Calcite | Level 5
Thank you for your response.
It works in terms of running regressions for 50 different countries at one
time. Would there be any way to have coefficient estimates, standard
errors, t-value, adjusted R square and N by country in one table?
Thank you again!

##- Please type your reply above this line. Simple formatting, no
attachments. -##
PGStats
Opal | Level 21

Sort your data by country and add a BY country statement in proc reg. You will get a separate regression analysis for each country.

PG
easygoing
Calcite | Level 5

Thank you veru much for your advice.

 

In addition, I would like to have results by country, especially estimates, standard errors, t-value and adjusted rsquares in one table and tried the codes as follows. But it did not work. What would be wrong with my codes?

 

proc reg data= xx;
MODEL Price = gain cashflow CPI;
by country;
ods select DataSummary FitStatistics;
ods output ParameterEstimates = tt;
run;

proc print data=tt; noobs;
var Parameter Estimate Standard Error tValue;
run;

Reeza
Super User

What does your log say is wrong with your code? 

easygoing
Calcite | Level 5

My log says as follows.

 

WARNING: Output 'ParameterEstimates' was not created. Make sure that the output object name,
label, or path is spelled correctly. Also, verify that the appropriate procedure
options are used to produce the requested output object. For example, verify that the
NOPRINT option is not used.
WARNING: Output 'FitStatistics' was not created. Make sure that the output object name, label,
or path is spelled correctly. Also, verify that the appropriate procedure options are
used to produce the requested output object. For example, verify that the NOPRINT
option is not used.
WARNING: Output 'DataSummary' was not created. Make sure that the output object name, label, or
path is spelled correctly. Also, verify that the appropriate procedure options are used
to produce the requested output object. For example, verify that the NOPRINT option is
not used.

PGStats
Opal | Level 21

Check the ODS Table Names section of the Details tab in the proc reg documentation. The procedure options that must be specified to get each ODS table are listed there.

PG
easygoing
Calcite | Level 5

I solved the problem. Thank you very much for all your advice!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2340 views
  • 0 likes
  • 3 in conversation