- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I wanted to use multiple odds ratios (&or_value. in the code below) for testoddratio and covoddsratios in the PROC POWER Logistic procedure. How can I set it up so that different combinations of all possible odds ratios are applied? For example, the list of odds ratios are 0.5, 0.9, 1.1, 1.5 and 2, covoddsratios will plug in all give possible values for each covariate. I'd also like to output the generated data files but cannot find appropriate output statement for PROC POWER. Below are the initial code I have:
data or_value;
infile datalines truncover dsd;
input ORs;
datalines;
0.5
0.9
1.1
1.5
2
;
run;
proc sql noprint;
select ORs
into :or_value separated by ','
from or_value
;quit;
%put or_value=&or_value.;
proc power;
logistic
vardist("treat") = ordinal((0 1):(0.2, 0.8))
vardist("time")=ordinal((1 2 3 4):(0.2 0.2 0.2 0.4))
testpredictor = "treat" "time"
testoddsratio = &or_value.
covariates = "intervention_prd" |"time" | "Female"
covoddsratios = &or_value.| &or_value.| &or_value. |&or_value.
responseprob = 0.03 0.4 0.5 0.6 0.7
alpha = 0.05
power =0.8
ntotal = .;
run;
Thank you all!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
No VARDIST for Intervention_prd.
No Vardist for Female.
I think the Covariates statement really wants a matching vardist to describe each item in its list.
Then you have Four groups of covoddsratios but only 3 covariates. Number of groups would have to match the number of covariates
For procedures that don't generate datasets with OUT= or similar statements generally you would use ODS OUTPUT. That would mean adding adding an ODS OUTPUT <object name>= <desired data set name> ; to the procedure code.
If you don't know the the name of the object(s) you create that you need use ODS Trace on/off around the procedure:
ods trace on; proc power; logistic vardist("treat") = ordinal((0 1):(0.2, 0.8)) vardist("time")=ordinal((1 2 3 4):(0.2 0.2 0.2 0.4)) testpredictor = "treat" "time" testoddsratio = &or_value. covariates = "time" covoddsratios = &or_value. responseprob = 0.03 0.4 0.5 0.6 0.7 alpha = 0.05 power =0.8 ntotal = .; run; ods trace off;
The log will show something similar to :
Output Added: ------------- Name: FixedElements Label: Fixed Scenario Elements Template: Stat.POWER.FixedElements Path: Power.Logistic.FixedElements ------------- Output Added: ------------- Name: Output Label: Output Template: Stat.POWER.LogisticOutput Path: Power.Logistic.Output ------------- NOTE: PROCEDURE POWER used (Total process time): real time 0.14 seconds cpu time 0.12 seconds
along with the code and other notes if the procedure runs.The object names you want are on the lines that start with Name: ;
To create output data sets you would rerun the procedure with the ODS OUTPUT referencing the objects such as:
proc power; logistic vardist("treat") = ordinal((0 1):(0.2, 0.8)) vardist("time")=ordinal((1 2 3 4):(0.2 0.2 0.2 0.4)) testpredictor = "treat" "time" testoddsratio = &or_value. covariates = "time" covoddsratios = &or_value. responseprob = 0.03 0.4 0.5 0.6 0.7 alpha = 0.05 power =0.8 ntotal = .; ods output fixedelements= work.fixed output=work.poweroutput ; run;
Suggestion: use a not very complicated, or in the case of procs using data sets, smaller data sets, to reduce computation time if you are just looking to find the names of the objects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
No VARDIST for Intervention_prd.
No Vardist for Female.
I think the Covariates statement really wants a matching vardist to describe each item in its list.
Then you have Four groups of covoddsratios but only 3 covariates. Number of groups would have to match the number of covariates
For procedures that don't generate datasets with OUT= or similar statements generally you would use ODS OUTPUT. That would mean adding adding an ODS OUTPUT <object name>= <desired data set name> ; to the procedure code.
If you don't know the the name of the object(s) you create that you need use ODS Trace on/off around the procedure:
ods trace on; proc power; logistic vardist("treat") = ordinal((0 1):(0.2, 0.8)) vardist("time")=ordinal((1 2 3 4):(0.2 0.2 0.2 0.4)) testpredictor = "treat" "time" testoddsratio = &or_value. covariates = "time" covoddsratios = &or_value. responseprob = 0.03 0.4 0.5 0.6 0.7 alpha = 0.05 power =0.8 ntotal = .; run; ods trace off;
The log will show something similar to :
Output Added: ------------- Name: FixedElements Label: Fixed Scenario Elements Template: Stat.POWER.FixedElements Path: Power.Logistic.FixedElements ------------- Output Added: ------------- Name: Output Label: Output Template: Stat.POWER.LogisticOutput Path: Power.Logistic.Output ------------- NOTE: PROCEDURE POWER used (Total process time): real time 0.14 seconds cpu time 0.12 seconds
along with the code and other notes if the procedure runs.The object names you want are on the lines that start with Name: ;
To create output data sets you would rerun the procedure with the ODS OUTPUT referencing the objects such as:
proc power; logistic vardist("treat") = ordinal((0 1):(0.2, 0.8)) vardist("time")=ordinal((1 2 3 4):(0.2 0.2 0.2 0.4)) testpredictor = "treat" "time" testoddsratio = &or_value. covariates = "time" covoddsratios = &or_value. responseprob = 0.03 0.4 0.5 0.6 0.7 alpha = 0.05 power =0.8 ntotal = .; ods output fixedelements= work.fixed output=work.poweroutput ; run;
Suggestion: use a not very complicated, or in the case of procs using data sets, smaller data sets, to reduce computation time if you are just looking to find the names of the objects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you! This works. But When there are multiple covariates at the same time like below, the program takes large space. Do loop may process each set of combination of odds ratios with less space...
proc power;
logistic
vardist("treat") = ordinal((0 1):(0.2, 0.8))
vardist("time")=ordinal((1 2 3 4):(0.2 0.2 0.2 0.4))
vardist("Female") = BINOMIAL (0.54, 1)
vardist("Age_4group") = ordinal((1 2 3 4):(0.251 0.265 0.215 0.269))
vardist("Race_Black") = BINOMIAL (0.105, 1)
vardist("Race_Other") = BINOMIAL (0.23, 1)
testpredictor = "treat" "time"
testoddsratio = &or_value.
covariates = "intervention_prd" |"time" | "Female" | "Age_4cat"|"Race_Black"|"Race_OthrNA"
covoddsratios = &or_value.|&or_value.|&or_value.|&or_value.|&or_value.|&or_value.
responseprob = 0.03 0.4 0.5 0.6 0.7
alpha = 0.05
power =0.8
ntotal = .;
ods output fixedelements= work.fixed
output=work.poweroutput
;
run;