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!
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.
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;
Sort your data by country and add a BY country statement in proc reg. You will get a separate regression analysis for each country.
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;
What does your log say is wrong with your code?
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.
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.
I solved the problem. Thank you very much for all your advice!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.