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

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;
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 714 views
  • 1 like
  • 2 in conversation