Hi Folks:
I'm running many bi-variate models. I'd like to have all variables along with their parameter estimates and p-value in one dataset afterwards. The code posted works. However, if I could produce t.&var
in the last data step with a common prefix. I could simply concatenate data with common prefix.
Any suggestions to come up with the datasets with a common prefix from output ods in macro?
data t.commonprefix: ; set t.&var._par;
if _n_=2 then output;
run;
ods trace on;
ods output ParameterEstimates=t.&var._par(keep=Parameter Estimate Probt);
proc countreg data=alldata Wmat=Wmatrix;
model n_covid = &var p55_64 p65_74 P75_84 p85/offset=ln dist=negbin;
spatialeffects db_trt_rate p55_64 p65_74 P75_84 p85;
run;
ods trace off;
data t.&var; set t.&var._par;
if _n_=2 then output;
run;
You don't show how you plan to run the many models, is this a macro?
In any event, you could just create a data set with the x and y variables for all of your bivariate models, with a "group" number, and then run PROC COUNTREG with a BY GROUP; statement, and then voila! all of the output is in one data set.
Also, your use of the word "bivariate" doesn't seem to match the code you show, where there are many x variables.
You don't show how you plan to run the many models, is this a macro?
In any event, you could just create a data set with the x and y variables for all of your bivariate models, with a "group" number, and then run PROC COUNTREG with a BY GROUP; statement, and then voila! all of the output is in one data set.
Also, your use of the word "bivariate" doesn't seem to match the code you show, where there are many x variables.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.