Dear SAS experts,
I have a problem with the residual graph, I need to get this graph bellow in the picture;
Residual values for each country and connect them with line between years
does someone know the code for residuals plots with multiple countries and connected with line
Thank you in advance.
best regards,
You named the output of the data set with the residuals (out=residual).
Then for the plotting step you use the original data set (data=sas_project), not the new one created with the residuals. Review the code I've posted and compare for the differences.
PROC SGPLOT can do this. Example
Hello,
I'm using this codes to create the model and output;
/*SAS kod*/
Proc means data=WORK.SAS_project;
var 'Housing_Loans_[millions]_y'n GDP_per_capita_x Active_population_x wages_Eurostat_x;
by drzava;
run;
/*SAS kod*/
data WORK.SAS_project; set WORK.SAS_project;
'Housing_Loans_[millions]_y'n=log('Housing_Loans_[millions]_y'n);
Active_population_x=log(Active_population_x);
wages_Eurostat_x=log(wages_Eurostat_x);
GDP_per_capita_x=log(GDP_per_capita_x);
run;
/*SAS code*/
title"Model fiksnih efekata";
proc panel data=WORK.SAS_project;
id drzava Year;
model 'Housing_Loans_[millions]_y'n= Active_population_x GDP_per_capita_x wages_Eurostat_x /fixone printfixed;
run;
now I need to create that graph for residual values on the y axis for each country, if would be easier to send a file maybe?
thank you in andvance
best regards
Add the following to your proc panel.
output out=residuals r=residual;
And then try the code I posted replacing 'godina' with year.
hello,
I have tried the code and the next error appears:
proc sgplot data=WORK.SAS_project;
series x=Year y=residual / group=drzava markers;
ERROR: Variable RESIDUAL not found.
run;
do You know why is something wrong in the code?
this is the code that I write:
proc panel data=WORK.SAS_project;
id drzava Year;
model 'Housing_Loans_[millions]_y'n= Active_population_x GDP_per_capita_x wages_Eurostat_x /fixone printfixed;
output out=residual r=residual;
run;
proc sgplot data=WORK.SAS_project;
series x=Year y=residual / group=drzava markers;
run;
the closest results corresponding to the graph above I get with next code:
/*SAS code*/
title"Model fiksnih efekata";
symbol value=circle;
proc reg data=WORK.SAS_project;
model Year= Active_population_x GDP_per_capita_x wages_Eurostat_x ;
plot residual. * predicted.;
by drzava;
run;
but as you can see in the picture bellow the results I get is for each country separately (I need all together in one graph) and additionally I don't know to connect the dots with line in this code
if someone knows please help
You named the output of the data set with the residuals (out=residual).
Then for the plotting step you use the original data set (data=sas_project), not the new one created with the residuals. Review the code I've posted and compare for the differences.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.