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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 332 views
  • 1 like
  • 2 in conversation