Greetings!
I frequently use proc GLM for repeated measures ANOVA and more recently proc corr for correlational work. In the case of proc GLM I would like to extract various sums of squares and degrees of freedom for other calculations, such power, effect size or ICC. In the case of the proc corr I would like to extract specific correlations in a matrix for further calculations such as confidence intervals or hypothesis testing of different correlation coefficients.
Is there a reference(s) where I can learn how to do this. Or a website of examples I can use to learn how to do this type of programming. I am getting bits and pieces as I search the web but there are gaps that make it impossible for me to figure it out on my own.
Best Wishes,
dg
you mean using ods?: https://analytics.ncsu.edu/sesug/2002/PS03.pdf
you mean using ods?: https://analytics.ncsu.edu/sesug/2002/PS03.pdf
Hello. Thank you. That looks pretty darn close. I will have to read it tomorrow morning. Once the variables are extracted, examples have thing "&" in front of the extracted variables and the word "symput". The link is one missing piece; that is, how to identify them to extract them. Thanks once again.
dg
a very common example is when we need to give the sample size (n) in the table column headings. The code would be something like this (we use "&" because we are making the statistic a macro variable so we can use it elsewhere eg when creating the table or figure):
ods output onewayfreqs=getn;
proc freq data=temp;
tables treatment;
run;
data _null_;
set getn;
if treatment=1 then call symput("trt11",strip(put(frequency,2.)));
else if treatment=2 then call symput("trt2",strip(put(frequency,2.)));
run;
proc report data=....;
column .... trt1 trt2 ....;
:
define trt1 / display width=10 right "Treatment 1 (n=&trt1)";
define trt2 / display width=10 right "Treatment 2 (n=&trt2)";
:
run;
PaulBrown,
The example is exactly the type of thing talking about. I can read the code and see exactly what what you are doing. I have been using SAS for a long time but only for straight forward text book examples. No coding. I so most of my data manipulation like that in MATLAB which learned it organically over 30 years. Now, I am trying to do the same with SAS programming to minimize going back and fourth between programs. That is, use SAS for statistics then type in the results into code written MATLAB for further analysis. The code below illustrates what I am trying to accomplish from beginning to end. Now, I have to apply to ANOVA and correlational work.
Best Wishes,
dg
If you see the required value in the procedure output, you can get it in an ODS table. Check the Details section of the procedure documentation for the ODS Table Names topic. Add the statement
ODS OUTPUT procTablename=myTableName;
to your code and look at the table contents. The value will be there somewhere.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.